[pacman-dev] Problems with alpm
Dan McGee
dpmcgee at gmail.com
Wed Jun 13 01:08:22 EDT 2007
On 6/4/07, Georg Grabler <ggrabler at gmail.com> wrote:
> 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
I still have this email sitting around in my inbox, unanswered, mostly
because I don't really know what to tell you. We are just as aware of
the bad documentation, and wish it could improve a bit, but I sure
haven't started writing it. I'm not completely sure what the problem
is- your best bet is to look at pacman as being a "reference"
implementation, and seeing how what you are doing is different than
it.
-Dan
More information about the pacman-dev
mailing list