Similar to what we just did for the database; this will make it easy to always know what handle a given package originated from. Signed-off-by: Dan McGee <dan@archlinux.org> --- lib/libalpm/be_local.c | 1 + lib/libalpm/be_package.c | 2 ++ lib/libalpm/be_sync.c | 3 ++- lib/libalpm/package.c | 5 +++-- lib/libalpm/package.h | 3 ++- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index c470cba..738bdfe 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -415,6 +415,7 @@ static int local_db_populate(pmdb_t *db) pkg->origin = PKG_FROM_LOCALDB; pkg->origin_data.db = db; pkg->ops = &local_pkg_ops; + pkg->handle = handle; /* explicitly read with only 'BASE' data, accessors will handle the rest */ if(_alpm_local_db_read(db, pkg, INFRQ_BASE) == -1) { diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 8da317f..a3d5304 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -32,6 +32,7 @@ #include "alpm_list.h" #include "util.h" #include "log.h" +#include "handle.h" #include "package.h" #include "deps.h" /* _alpm_splitdep */ @@ -350,6 +351,7 @@ pmpkg_t *_alpm_pkg_load_internal(const char *pkgfile, int full, newpkg->origin = PKG_FROM_FILE; newpkg->origin_data.file = strdup(pkgfile); newpkg->ops = get_file_pkg_ops(); + newpkg->handle = handle; if(full) { /* "checking for conflicts" requires a sorted list, ensure that here */ diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index 1d63398..ab0001e 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -306,8 +306,9 @@ static int sync_db_populate(pmdb_t *db) } pkg->origin = PKG_FROM_SYNCDB; - pkg->ops = &default_pkg_ops; pkg->origin_data.db = db; + pkg->ops = &default_pkg_ops; + pkg->handle = handle; /* add to the collection */ _alpm_log(PM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'\n", diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 205bc10..d19549d 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -408,14 +408,15 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg) newpkg->deltas = alpm_list_copy_data(pkg->deltas, sizeof(pmdelta_t)); /* internal */ + newpkg->infolevel = pkg->infolevel; newpkg->origin = pkg->origin; - newpkg->ops = pkg->ops; if(newpkg->origin == PKG_FROM_FILE) { newpkg->origin_data.file = strdup(pkg->origin_data.file); } else { newpkg->origin_data.db = pkg->origin_data.db; } - newpkg->infolevel = pkg->infolevel; + newpkg->ops = pkg->ops; + newpkg->handle = handle; return newpkg; } diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h index debb239..4e2dcf3 100644 --- a/lib/libalpm/package.h +++ b/lib/libalpm/package.h @@ -110,6 +110,7 @@ struct __pmpkg_t { int scriptlet; pmpkgreason_t reason; + pmdbinfrq_t infolevel; pmpkgfrom_t origin; /* origin == PKG_FROM_FILE, use pkg->origin_data.file * origin == PKG_FROM_*DB, use pkg->origin_data.db */ @@ -117,7 +118,7 @@ struct __pmpkg_t { pmdb_t *db; char *file; } origin_data; - pmdbinfrq_t infolevel; + pmhandle_t *handle; alpm_list_t *licenses; alpm_list_t *replaces; -- 1.7.5.2