summaryrefslogtreecommitdiff
path: root/lib/libalpm/package.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-09-25 23:02:30 -0500
committerDan McGee <dan@archlinux.org>2007-09-25 23:02:30 -0500
commitfc0e83f05b29f57accb49544dabe856968349b3a (patch)
tree8a417de5ee3e2a522d6c13b1198a62b4c7a44155 /lib/libalpm/package.c
parent012f7939784358b02726c169543aa99436439335 (diff)
downloadpacman-fc0e83f05b29f57accb49544dabe856968349b3a.tar.xz
Preliminary support for optdepends
Add some alpm functions for getting optdepends, have makepkg include them in the PKGINFO file, and have a pacman -Qi operation display the raw string as stored by libalpm. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/package.c')
-rw-r--r--lib/libalpm/package.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 64a63b96..4a6e62b9 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -417,7 +417,6 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_groups(pmpkg_t *pkg)
return pkg->groups;
}
-/* depends */
alpm_list_t SYMEXPORT *alpm_pkg_get_depends(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
@@ -432,6 +431,20 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_depends(pmpkg_t *pkg)
return pkg->depends;
}
+alpm_list_t SYMEXPORT *alpm_pkg_get_optdepends(pmpkg_t *pkg)
+{
+ ALPM_LOG_FUNC;
+
+ /* Sanity checks */
+ ASSERT(handle != NULL, return(NULL));
+ ASSERT(pkg != NULL, return(NULL));
+
+ if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DEPENDS)) {
+ _alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DEPENDS);
+ }
+ return pkg->optdepends;
+}
+
alpm_list_t SYMEXPORT *alpm_pkg_get_requiredby(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
@@ -721,6 +734,7 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg)
newpkg->files = alpm_list_strdup(alpm_pkg_get_files(pkg));
newpkg->backup = alpm_list_strdup(alpm_pkg_get_backup(pkg));
newpkg->depends = alpm_list_strdup(alpm_pkg_get_depends(pkg));
+ newpkg->optdepends = alpm_list_strdup(alpm_pkg_get_optdepends(pkg));
newpkg->groups = alpm_list_strdup(alpm_pkg_get_groups(pkg));
newpkg->provides = alpm_list_strdup(alpm_pkg_get_provides(pkg));
newpkg->replaces = alpm_list_strdup(alpm_pkg_get_replaces(pkg));
@@ -746,6 +760,7 @@ void _alpm_pkg_free(pmpkg_t *pkg)
FREELIST(pkg->files);
FREELIST(pkg->backup);
FREELIST(pkg->depends);
+ FREELIST(pkg->optdepends);
FREELIST(pkg->conflicts);
FREELIST(pkg->requiredby);
FREELIST(pkg->groups);
@@ -876,6 +891,8 @@ static int parse_descfile(const char *descfile, pmpkg_t *info)
info->isize = atol(ptr);
} else if(!strcmp(key, "depend")) {
info->depends = alpm_list_add(info->depends, strdup(ptr));
+ } else if(!strcmp(key, "optdepend")) {
+ info->optdepends = alpm_list_add(info->optdepends, strdup(ptr));
} else if(!strcmp(key, "conflict")) {
info->conflicts = alpm_list_add(info->conflicts, strdup(ptr));
} else if(!strcmp(key, "replaces")) {