diff options
author | Mark Weiman <mark.weiman@markzz.com> | 2017-01-03 23:32:27 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2017-01-04 04:59:15 +0100 |
commit | 0994893b0e6b627d45a63884ac01af7d0967eff2 (patch) | |
tree | a8bba222e088abd8bc53f332c05d804b0ae3934b /lib/libalpm | |
parent | aa44824788582cd3278ff74a60dfb276cf1aebfc (diff) | |
download | pacman-0994893b0e6b627d45a63884ac01af7d0967eff2.tar.gz pacman-0994893b0e6b627d45a63884ac01af7d0967eff2.tar.xz |
Add alpm_pkg_get_makedepends and alpm_pkg_get_checkdepends
makepkg adds makedepends and checkdepends to a package's .PKGINFO file.
Add functions that allow use of these from libalpm.
Signed-off-by: Mark Weiman <mark.weiman@markzz.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/alpm.h | 12 | ||||
-rw-r--r-- | lib/libalpm/be_package.c | 6 | ||||
-rw-r--r-- | lib/libalpm/package.c | 18 | ||||
-rw-r--r-- | lib/libalpm/package.h | 4 |
4 files changed, 38 insertions, 2 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 97fa02eb..49cf200a 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -1261,6 +1261,18 @@ alpm_list_t *alpm_pkg_get_depends(alpm_pkg_t *pkg); */ alpm_list_t *alpm_pkg_get_optdepends(alpm_pkg_t *pkg); +/** Returns a list of package check dependencies + * @param pkg a pointer to package + * @return a reference to an internal list of alpm_depend_t structures. + */ +alpm_list_t *alpm_pkg_get_checkdepends(alpm_pkg_t *pkg); + +/** Returns a list of package make dependencies + * @param pkg a pointer to package + * @return a reference to an internal list of alpm_depend_t structures. + */ +alpm_list_t *alpm_pkg_get_makedepends(alpm_pkg_t *pkg); + /** Returns the list of packages conflicting with pkg. * @param pkg a pointer to package * @return a reference to an internal list of alpm_depend_t structures. diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 6859118d..7e8b7920 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -223,9 +223,11 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t * alpm_depend_t *optdep = alpm_dep_from_string(ptr); newpkg->optdepends = alpm_list_add(newpkg->optdepends, optdep); } else if(strcmp(key, "makedepend") == 0) { - /* not used atm */ + alpm_depend_t *makedep = alpm_dep_from_string(ptr); + newpkg->makedepends = alpm_list_add(newpkg->makedepends, makedep); } else if(strcmp(key, "checkdepend") == 0) { - /* not used atm */ + alpm_depend_t *checkdep = alpm_dep_from_string(ptr); + newpkg->checkdepends = alpm_list_add(newpkg->checkdepends, checkdep); } else if(strcmp(key, "conflict") == 0) { alpm_depend_t *conflict = alpm_dep_from_string(ptr); newpkg->conflicts = alpm_list_add(newpkg->conflicts, conflict); diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 2206afe8..d0f902f0 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -99,6 +99,8 @@ static alpm_list_t *_pkg_get_licenses(alpm_pkg_t *pkg) { return pkg->licenses; static alpm_list_t *_pkg_get_groups(alpm_pkg_t *pkg) { return pkg->groups; } static alpm_list_t *_pkg_get_depends(alpm_pkg_t *pkg) { return pkg->depends; } static alpm_list_t *_pkg_get_optdepends(alpm_pkg_t *pkg) { return pkg->optdepends; } +static alpm_list_t *_pkg_get_checkdepends(alpm_pkg_t *pkg) { return pkg->checkdepends; } +static alpm_list_t *_pkg_get_makedepends(alpm_pkg_t *pkg) { return pkg->makedepends; } static alpm_list_t *_pkg_get_conflicts(alpm_pkg_t *pkg) { return pkg->conflicts; } static alpm_list_t *_pkg_get_provides(alpm_pkg_t *pkg) { return pkg->provides; } static alpm_list_t *_pkg_get_replaces(alpm_pkg_t *pkg) { return pkg->replaces; } @@ -161,6 +163,8 @@ struct pkg_operations default_pkg_ops = { .get_groups = _pkg_get_groups, .get_depends = _pkg_get_depends, .get_optdepends = _pkg_get_optdepends, + .get_checkdepends = _pkg_get_checkdepends, + .get_makedepends = _pkg_get_makedepends, .get_conflicts = _pkg_get_conflicts, .get_provides = _pkg_get_provides, .get_replaces = _pkg_get_replaces, @@ -335,6 +339,20 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_optdepends(alpm_pkg_t *pkg) return pkg->ops->get_optdepends(pkg); } +alpm_list_t SYMEXPORT *alpm_pkg_get_checkdepends(alpm_pkg_t *pkg) +{ + ASSERT(pkg != NULL, return NULL); + pkg->handle->pm_errno = ALPM_ERR_OK; + return pkg->ops->get_checkdepends(pkg); +} + +alpm_list_t SYMEXPORT *alpm_pkg_get_makedepends(alpm_pkg_t *pkg) +{ + ASSERT(pkg != NULL, return NULL); + pkg->handle->pm_errno = ALPM_ERR_OK; + return pkg->ops->get_makedepends(pkg); +} + alpm_list_t SYMEXPORT *alpm_pkg_get_conflicts(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h index 2db3740c..8531b212 100644 --- a/lib/libalpm/package.h +++ b/lib/libalpm/package.h @@ -59,6 +59,8 @@ struct pkg_operations { alpm_list_t *(*get_groups) (alpm_pkg_t *); alpm_list_t *(*get_depends) (alpm_pkg_t *); alpm_list_t *(*get_optdepends) (alpm_pkg_t *); + alpm_list_t *(*get_checkdepends) (alpm_pkg_t *); + alpm_list_t *(*get_makedepends) (alpm_pkg_t *); alpm_list_t *(*get_conflicts) (alpm_pkg_t *); alpm_list_t *(*get_provides) (alpm_pkg_t *); alpm_list_t *(*get_replaces) (alpm_pkg_t *); @@ -112,6 +114,8 @@ struct __alpm_pkg_t { alpm_list_t *backup; alpm_list_t *depends; alpm_list_t *optdepends; + alpm_list_t *checkdepends; + alpm_list_t *makedepends; alpm_list_t *conflicts; alpm_list_t *provides; alpm_list_t *deltas; |