diff options
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/alpm.h | 5 | ||||
-rw-r--r-- | lib/libalpm/be_package.c | 16 | ||||
-rw-r--r-- | lib/libalpm/package.h | 6 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 2 |
4 files changed, 16 insertions, 13 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 8742eacd..f0af9451 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -368,6 +368,7 @@ int alpm_db_set_pkgreason(pmdb_t *db, const char *name, pmpkgreason_t reason); * metadata is found. If it is true, the entire archive is read, which * serves as a verification of integrity and the filelist can be created. * The allocated structure should be freed using alpm_pkg_free(). + * @param handle the context handle * @param filename location of the package tarball * @param full whether to stop the load after metadata is read or continue * through the full archive @@ -376,8 +377,8 @@ int alpm_db_set_pkgreason(pmdb_t *db, const char *name, pmpkgreason_t reason); * @param pkg address of the package pointer * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_pkg_load(const char *filename, int full, pgp_verify_t check_sig, - pmpkg_t **pkg); +int alpm_pkg_load(pmhandle_t *handle, const char *filename, int full, + pgp_verify_t check_sig, pmpkg_t **pkg); /** Free a package. * @param pkg package pointer to free diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 639179b9..9f8264b4 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -30,15 +30,13 @@ /* libalpm */ #include "alpm_list.h" +#include "alpm.h" #include "util.h" #include "log.h" #include "handle.h" #include "package.h" #include "deps.h" /* _alpm_splitdep */ -/* global handle variable */ -extern pmhandle_t *handle; - /** * Open a package changelog for reading. Similar to fopen in functionality, * except that the returned 'file stream' is from an archive. @@ -225,13 +223,15 @@ static int parse_descfile(struct archive *a, pmpkg_t *newpkg) /** * Load a package and create the corresponding pmpkg_t struct. + * @param handle the context handle * @param pkgfile path to the package file * @param full whether to stop the load after metadata is read or continue * through the full archive * @return An information filled pmpkg_t struct */ -pmpkg_t *_alpm_pkg_load_internal(const char *pkgfile, int full, - const char *md5sum, const char *base64_sig, pgp_verify_t check_sig) +pmpkg_t *_alpm_pkg_load_internal(pmhandle_t *handle, const char *pkgfile, + int full, const char *md5sum, const char *base64_sig, + pgp_verify_t check_sig) { int ret; int config = 0; @@ -384,13 +384,13 @@ error: return NULL; } -int SYMEXPORT alpm_pkg_load(const char *filename, int full, +int SYMEXPORT alpm_pkg_load(pmhandle_t *handle, const char *filename, int full, pgp_verify_t check_sig, pmpkg_t **pkg) { - /* Sanity checks */ + ASSERT(handle != NULL, return -1); ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); - *pkg = _alpm_pkg_load_internal(filename, full, NULL, NULL, check_sig); + *pkg = _alpm_pkg_load_internal(handle, filename, full, NULL, NULL, check_sig); if(*pkg == NULL) { /* pm_errno is set by pkg_load */ return -1; diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h index 4e2dcf3d..b5d8f738 100644 --- a/lib/libalpm/package.h +++ b/lib/libalpm/package.h @@ -141,8 +141,10 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg); void _alpm_pkg_free(pmpkg_t *pkg); void _alpm_pkg_free_trans(pmpkg_t *pkg); -pmpkg_t *_alpm_pkg_load_internal(const char *filename, int full, - const char *md5sum, const char *base64_sig, pgp_verify_t check_sig); + +pmpkg_t *_alpm_pkg_load_internal(pmhandle_t *handle, const char *pkgfile, + int full, const char *md5sum, const char *base64_sig, + pgp_verify_t check_sig); int _alpm_pkg_cmp(const void *p1, const void *p2); int _alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg); diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 16be6d9a..18828881 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -876,7 +876,7 @@ int _alpm_sync_commit(pmhandle_t *handle, alpm_list_t **data) /* load the package file and replace pkgcache entry with it in the target list */ /* TODO: alpm_pkg_get_db() will not work on this target anymore */ _alpm_log(PM_LOG_DEBUG, "replacing pkgcache entry with package file for target %s\n", spkg->name); - pmpkg_t *pkgfile =_alpm_pkg_load_internal(filepath, 1, spkg->md5sum, + pmpkg_t *pkgfile =_alpm_pkg_load_internal(handle, filepath, 1, spkg->md5sum, spkg->base64_sig, check_sig); if(!pkgfile) { errors++; |