From 040083b97fab61c8afc16a1c49a8384d097c272a Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 28 Aug 2011 23:41:17 -0500 Subject: Allow access to package origin data Add new alpm_pkg_get_origin() method, use it in the front end now that the enum constants are publicly available. Signed-off-by: Dan McGee --- src/pacman/package.c | 7 +++---- src/pacman/package.h | 2 +- src/pacman/query.c | 4 ++-- src/pacman/sync.c | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/pacman/package.c b/src/pacman/package.c index f7065d54..5654944c 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -61,7 +61,7 @@ static void deplist_display(const char *title, * @param from the type of package we are dealing with * @param extra should we show extra information */ -void dump_pkg_full(alpm_pkg_t *pkg, alpm_pkgfrom_t from, int extra) +void dump_pkg_full(alpm_pkg_t *pkg, int extra) { const char *reason; time_t bdate, idate; @@ -69,10 +69,9 @@ void dump_pkg_full(alpm_pkg_t *pkg, alpm_pkgfrom_t from, int extra) const char *label; double size; alpm_list_t *requiredby = NULL; + alpm_pkgfrom_t from; - if(pkg == NULL) { - return; - } + from = alpm_pkg_get_origin(pkg); /* set variables here, do all output below */ bdate = alpm_pkg_get_builddate(pkg); diff --git a/src/pacman/package.h b/src/pacman/package.h index 4bbc2ba0..890b4fe1 100644 --- a/src/pacman/package.h +++ b/src/pacman/package.h @@ -22,7 +22,7 @@ #include -void dump_pkg_full(alpm_pkg_t *pkg, alpm_pkgfrom_t from, int extra); +void dump_pkg_full(alpm_pkg_t *pkg, int extra); void dump_pkg_backups(alpm_pkg_t *pkg); void dump_pkg_files(alpm_pkg_t *pkg, int quiet); diff --git a/src/pacman/query.c b/src/pacman/query.c index ec98c999..5f2b37eb 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -460,9 +460,9 @@ static int display(alpm_pkg_t *pkg) if(config->op_q_info) { if(config->op_q_isfile) { - dump_pkg_full(pkg, PKG_FROM_FILE, 0); + dump_pkg_full(pkg, 0); } else { - dump_pkg_full(pkg, PKG_FROM_LOCALDB, config->op_q_info > 1); + dump_pkg_full(pkg, config->op_q_info > 1); } } if(config->op_q_list) { diff --git a/src/pacman/sync.c b/src/pacman/sync.c index a7fe5be9..e97da37a 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -469,7 +469,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) alpm_pkg_t *pkg = alpm_list_getdata(k); if(strcmp(alpm_pkg_get_name(pkg), pkgstr) == 0) { - dump_pkg_full(pkg, PKG_FROM_SYNCDB, config->op_s_info > 1); + dump_pkg_full(pkg, config->op_s_info > 1); foundpkg = 1; break; } @@ -494,7 +494,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) { alpm_pkg_t *pkg = alpm_list_getdata(j); - dump_pkg_full(pkg, PKG_FROM_SYNCDB, config->op_s_info > 1); + dump_pkg_full(pkg, config->op_s_info > 1); } } } -- cgit v1.2.3-70-g09d2