From 7f98460e37bc032b58ca7c82e70c357aa39370f8 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 3 Jun 2011 12:13:22 -0500 Subject: Add handle attribute to pmpkg_t struct 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 --- 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(-) (limited to 'lib') diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index c470cbad..738bdfeb 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 8da317fc..a3d5304d 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 1d633982..ab0001ec 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 205bc103..d19549d1 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 debb239c..4e2dcf3d 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; -- cgit v1.2.3-70-g09d2