[pacman-dev] [PATCH] New public alpm_pkg_get_db function
From 88ca14b8e7d4c53d886bc7397adbbf6c8a338c5d Mon Sep 17 00:00:00 2001 From: Nagy Gabor <ngaba@bibl.u-szeged.hu> Date: Sun, 17 Aug 2008 18:32:39 +0200 Subject: [PATCH] New public alpm_pkg_get_db function This function returns with the origin database of a package. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> --- lib/libalpm/alpm.h | 1 + lib/libalpm/package.c | 9 +++++++++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index fbef057..4ea03a9 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -218,6 +218,7 @@ alpm_list_t *alpm_pkg_get_deltas(pmpkg_t *pkg); alpm_list_t *alpm_pkg_get_replaces(pmpkg_t *pkg); alpm_list_t *alpm_pkg_get_files(pmpkg_t *pkg); alpm_list_t *alpm_pkg_get_backup(pmpkg_t *pkg); +pmdb_t *alpm_pkg_get_db(pmpkg_t *pkg); void *alpm_pkg_changelog_open(pmpkg_t *pkg); size_t alpm_pkg_changelog_read(void *ptr, size_t size, const pmpkg_t *pkg, const void *fp); diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 49238ea..4ed908f 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -409,6 +409,15 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_backup(pmpkg_t *pkg) return pkg->backup; } +pmdb_t SYMEXPORT *alpm_pkg_get_db(pmpkg_t *pkg) +{ + /* Sanity checks */ + ASSERT(pkg != NULL, return(NULL)); + ASSERT(pkg->origin == PKG_FROM_CACHE, return(NULL)); + + return(pkg->origin_data.db); +} + /** * Open a package changelog for reading. Similar to fopen in functionality, * except that the returned 'file stream' could really be from an archive -- 1.5.6.5
participants (1)
-
Nagy Gabor