summaryrefslogtreecommitdiff
path: root/lib/libalpm/package.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-12-13 21:00:23 -0600
committerDan McGee <dan@archlinux.org>2010-12-13 21:25:14 -0600
commit580fe21065896a1cc239db72e66107f7997b3039 (patch)
treee92a89ea4ca5de40a618941956bbadd15757c147 /lib/libalpm/package.c
parentc00e05992e142219c30caf154d62d6166ae28338 (diff)
downloadpacman-580fe21065896a1cc239db72e66107f7997b3039.tar.xz
Abstract has_scriptlet() to package ops struct
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/package.c')
-rw-r--r--lib/libalpm/package.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index f4322bf1..57ab9a67 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -112,6 +112,7 @@ off_t _pkg_get_size(pmpkg_t *pkg) { return pkg->size; }
off_t _pkg_get_isize(pmpkg_t *pkg) { return pkg->isize; }
pmpkgreason_t _pkg_get_reason(pmpkg_t *pkg) { return pkg->reason; }
int _pkg_get_epoch(pmpkg_t *pkg) { return pkg->epoch; }
+int _pkg_has_scriptlet(pmpkg_t *pkg) { return pkg->scriptlet; }
alpm_list_t *_pkg_get_licenses(pmpkg_t *pkg) { return pkg->licenses; }
alpm_list_t *_pkg_get_groups(pmpkg_t *pkg) { return pkg->groups; }
@@ -142,6 +143,7 @@ struct pkg_operations default_pkg_ops = {
.get_isize = _pkg_get_isize,
.get_reason = _pkg_get_reason,
.get_epoch = _pkg_get_epoch,
+ .has_scriptlet = _pkg_has_scriptlet,
.get_licenses = _pkg_get_licenses,
.get_groups = _pkg_get_groups,
.get_depends = _pkg_get_depends,
@@ -338,17 +340,7 @@ int SYMEXPORT alpm_pkg_changelog_close(const pmpkg_t *pkg, void *fp)
int SYMEXPORT alpm_pkg_has_scriptlet(pmpkg_t *pkg)
{
- ALPM_LOG_FUNC;
-
- /* Sanity checks */
- ASSERT(handle != NULL, return(-1));
- ASSERT(pkg != NULL, return(-1));
-
- if(pkg->origin == PKG_FROM_LOCALDB
- && !(pkg->infolevel & INFRQ_SCRIPTLET)) {
- _alpm_local_db_read(pkg->origin_data.db, pkg, INFRQ_SCRIPTLET);
- }
- return pkg->scriptlet;
+ return pkg->ops->has_scriptlet(pkg);
}
static void find_requiredby(pmpkg_t *pkg, pmdb_t *db, alpm_list_t **reqs)