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>
This commit is contained in:
Mark Weiman 2017-01-03 17:32:27 -05:00 committed by Allan McRae
parent aa44824788
commit 0994893b0e
4 changed files with 38 additions and 2 deletions

View file

@ -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); 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. /** Returns the list of packages conflicting with pkg.
* @param pkg a pointer to package * @param pkg a pointer to package
* @return a reference to an internal list of alpm_depend_t structures. * @return a reference to an internal list of alpm_depend_t structures.

View file

@ -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); alpm_depend_t *optdep = alpm_dep_from_string(ptr);
newpkg->optdepends = alpm_list_add(newpkg->optdepends, optdep); newpkg->optdepends = alpm_list_add(newpkg->optdepends, optdep);
} else if(strcmp(key, "makedepend") == 0) { } 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) { } 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) { } else if(strcmp(key, "conflict") == 0) {
alpm_depend_t *conflict = alpm_dep_from_string(ptr); alpm_depend_t *conflict = alpm_dep_from_string(ptr);
newpkg->conflicts = alpm_list_add(newpkg->conflicts, conflict); newpkg->conflicts = alpm_list_add(newpkg->conflicts, conflict);

View file

@ -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_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_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_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_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_provides(alpm_pkg_t *pkg) { return pkg->provides; }
static alpm_list_t *_pkg_get_replaces(alpm_pkg_t *pkg) { return pkg->replaces; } 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_groups = _pkg_get_groups,
.get_depends = _pkg_get_depends, .get_depends = _pkg_get_depends,
.get_optdepends = _pkg_get_optdepends, .get_optdepends = _pkg_get_optdepends,
.get_checkdepends = _pkg_get_checkdepends,
.get_makedepends = _pkg_get_makedepends,
.get_conflicts = _pkg_get_conflicts, .get_conflicts = _pkg_get_conflicts,
.get_provides = _pkg_get_provides, .get_provides = _pkg_get_provides,
.get_replaces = _pkg_get_replaces, .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); 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) alpm_list_t SYMEXPORT *alpm_pkg_get_conflicts(alpm_pkg_t *pkg)
{ {
ASSERT(pkg != NULL, return NULL); ASSERT(pkg != NULL, return NULL);

View file

@ -59,6 +59,8 @@ struct pkg_operations {
alpm_list_t *(*get_groups) (alpm_pkg_t *); alpm_list_t *(*get_groups) (alpm_pkg_t *);
alpm_list_t *(*get_depends) (alpm_pkg_t *); alpm_list_t *(*get_depends) (alpm_pkg_t *);
alpm_list_t *(*get_optdepends) (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_conflicts) (alpm_pkg_t *);
alpm_list_t *(*get_provides) (alpm_pkg_t *); alpm_list_t *(*get_provides) (alpm_pkg_t *);
alpm_list_t *(*get_replaces) (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 *backup;
alpm_list_t *depends; alpm_list_t *depends;
alpm_list_t *optdepends; alpm_list_t *optdepends;
alpm_list_t *checkdepends;
alpm_list_t *makedepends;
alpm_list_t *conflicts; alpm_list_t *conflicts;
alpm_list_t *provides; alpm_list_t *provides;
alpm_list_t *deltas; alpm_list_t *deltas;