summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-03 19:13:22 +0200
committerDan McGee <dan@archlinux.org>2011-06-03 19:13:22 +0200
commit7f98460e37bc032b58ca7c82e70c357aa39370f8 (patch)
tree386cf7e9cd2045205458d38eeac31a43b98a987b /lib
parentc47d25d74be9ce1fbbfb8577687d9f37ba38d98b (diff)
downloadpacman-7f98460e37bc032b58ca7c82e70c357aa39370f8.tar.gz
pacman-7f98460e37bc032b58ca7c82e70c357aa39370f8.tar.xz
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 <dan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/be_local.c1
-rw-r--r--lib/libalpm/be_package.c2
-rw-r--r--lib/libalpm/be_sync.c3
-rw-r--r--lib/libalpm/package.c5
-rw-r--r--lib/libalpm/package.h3
5 files changed, 10 insertions, 4 deletions
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;