1
0
mirror of https://github.com/moparisthebest/pacman synced 2025-03-01 01:41:52 -05:00

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>
This commit is contained in:
Dan McGee 2011-06-03 12:13:22 -05:00
parent c47d25d74b
commit 7f98460e37
5 changed files with 10 additions and 4 deletions

View File

@ -415,6 +415,7 @@ static int local_db_populate(pmdb_t *db)
pkg->origin = PKG_FROM_LOCALDB; pkg->origin = PKG_FROM_LOCALDB;
pkg->origin_data.db = db; pkg->origin_data.db = db;
pkg->ops = &local_pkg_ops; pkg->ops = &local_pkg_ops;
pkg->handle = handle;
/* explicitly read with only 'BASE' data, accessors will handle the rest */ /* explicitly read with only 'BASE' data, accessors will handle the rest */
if(_alpm_local_db_read(db, pkg, INFRQ_BASE) == -1) { if(_alpm_local_db_read(db, pkg, INFRQ_BASE) == -1) {

View File

@ -32,6 +32,7 @@
#include "alpm_list.h" #include "alpm_list.h"
#include "util.h" #include "util.h"
#include "log.h" #include "log.h"
#include "handle.h"
#include "package.h" #include "package.h"
#include "deps.h" /* _alpm_splitdep */ #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 = PKG_FROM_FILE;
newpkg->origin_data.file = strdup(pkgfile); newpkg->origin_data.file = strdup(pkgfile);
newpkg->ops = get_file_pkg_ops(); newpkg->ops = get_file_pkg_ops();
newpkg->handle = handle;
if(full) { if(full) {
/* "checking for conflicts" requires a sorted list, ensure that here */ /* "checking for conflicts" requires a sorted list, ensure that here */

View File

@ -306,8 +306,9 @@ static int sync_db_populate(pmdb_t *db)
} }
pkg->origin = PKG_FROM_SYNCDB; pkg->origin = PKG_FROM_SYNCDB;
pkg->ops = &default_pkg_ops;
pkg->origin_data.db = db; pkg->origin_data.db = db;
pkg->ops = &default_pkg_ops;
pkg->handle = handle;
/* add to the collection */ /* add to the collection */
_alpm_log(PM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'\n", _alpm_log(PM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'\n",

View File

@ -408,14 +408,15 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg)
newpkg->deltas = alpm_list_copy_data(pkg->deltas, sizeof(pmdelta_t)); newpkg->deltas = alpm_list_copy_data(pkg->deltas, sizeof(pmdelta_t));
/* internal */ /* internal */
newpkg->infolevel = pkg->infolevel;
newpkg->origin = pkg->origin; newpkg->origin = pkg->origin;
newpkg->ops = pkg->ops;
if(newpkg->origin == PKG_FROM_FILE) { if(newpkg->origin == PKG_FROM_FILE) {
newpkg->origin_data.file = strdup(pkg->origin_data.file); newpkg->origin_data.file = strdup(pkg->origin_data.file);
} else { } else {
newpkg->origin_data.db = pkg->origin_data.db; newpkg->origin_data.db = pkg->origin_data.db;
} }
newpkg->infolevel = pkg->infolevel; newpkg->ops = pkg->ops;
newpkg->handle = handle;
return newpkg; return newpkg;
} }

View File

@ -110,6 +110,7 @@ struct __pmpkg_t {
int scriptlet; int scriptlet;
pmpkgreason_t reason; pmpkgreason_t reason;
pmdbinfrq_t infolevel;
pmpkgfrom_t origin; pmpkgfrom_t origin;
/* origin == PKG_FROM_FILE, use pkg->origin_data.file /* origin == PKG_FROM_FILE, use pkg->origin_data.file
* origin == PKG_FROM_*DB, use pkg->origin_data.db */ * origin == PKG_FROM_*DB, use pkg->origin_data.db */
@ -117,7 +118,7 @@ struct __pmpkg_t {
pmdb_t *db; pmdb_t *db;
char *file; char *file;
} origin_data; } origin_data;
pmdbinfrq_t infolevel; pmhandle_t *handle;
alpm_list_t *licenses; alpm_list_t *licenses;
alpm_list_t *replaces; alpm_list_t *replaces;