[pacman-dev] Problems with alpm

Georg Grabler ggrabler at gmail.com
Mon Jun 4 17:40:34 EDT 2007


Hey guys,

I'm once again having problems with the code in alpm. I can't seem to find out 
how to correctly register databases.

I've the bindings basically ready, and need to do the implementation now 
(pyalpm). So, the following problem occured:

I set the database path to /var/lib/pacman (or /var/lib/pacman/community, 
tried both). It seems as if alpm_option_set_dbpath can't cause errors (void 
return), so i ignored it.

alpm_trans_init runs without returning -1, so i expect it to be succeeded.

On alpm_trans_addtarget, i finally get the -1, with pm_errno 11, meaning 
PM_ERR_DB_NULL. I don't know (lacking docs) what this means, and why this can 
occur.

Do you have any hints for me?

Some codelines:

cdef pyalpm_config c_config
c_config = pyalpm_config()
config = c_config

alpm_initialize()

def addPackage(in_pname)
  db = config.getDatabasePath()
  print db # output is OK
  pyalpm_db_register('community')

  if (alpm_trans_init(PM_TRANS_TYPE_ADD, 
<pmtransflag_t((<int>PM_TRANS_FLAG_CASCADE) | (<int>PM_TRANS_FLAG_RECURSE)), 
NULL, NULL, NULL) == -1):
    os.remove("/tmp/pacman.lck")
    print pm_errno
    return -1

  if (alpm_trans_addtarget(in_name) == -1):
    os.remove("/tmp/pacman.lck")
    print pm_errno
    return -2 # here it exits

###test.py###
import pyalpm
pyalpm.config.setDatabasePath('/var/lib/pacman')

print pyalpm.addPackage('yaz')

###output###
11
-2


Seems as if i'm missing something


-- 
Yours,
Georg (STiAT)




More information about the pacman-dev mailing list