From 219808714f94788a66a430786c552f60e95b1a01 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 27 Sep 2007 23:39:37 -0500 Subject: Add 'full' parameter to alpm_pkg_load In most cases, we want to fully scan a package when we load it, which serves as a integrity verification check. However, there are times when it is only desired to read the metadata and nothing else, so allow the caller of pkg_load to choose the behavior they need. This pays big dividends in speeding up pacman cache cleaning functionality. Old (729 packages): real 1m43.717s user 1m20.785s sys 0m2.993s New (729 packages): real 0m25.607s user 0m19.389s sys 0m0.543s Signed-off-by: Dan McGee --- src/pacman/query.c | 2 +- src/pacman/sync.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/pacman') diff --git a/src/pacman/query.c b/src/pacman/query.c index 26a1bd8f..4e4002cf 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -369,7 +369,7 @@ int pacman_query(alpm_list_t *targets) pmpkg_t *pkg = NULL; if(config->op_q_isfile) { - alpm_pkg_load(strname, &pkg); + alpm_pkg_load(strname, 1, &pkg); } else { pkg = alpm_db_get_pkg(db_local, strname); } diff --git a/src/pacman/sync.c b/src/pacman/sync.c index bb4926e2..11941eb3 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -82,8 +82,9 @@ static int sync_cleancache(int level) snprintf(path, PATH_MAX, "%s/%s", cachedir, ent->d_name); /* attempt to load the package, skip file on failures as we may have - * files here that aren't valid packages */ - if(alpm_pkg_load(path, &localpkg) != 0 || localpkg == NULL) { + * files here that aren't valid packages. we also don't need a full + * load of the package, just the metadata. */ + if(alpm_pkg_load(path, 0, &localpkg) != 0 || localpkg == NULL) { continue; } /* check if this package is in the local DB */ -- cgit v1.2.3-24-g4f1b