libalpm: parse {check, make}depends when reading database

Commit 0994893b0e added the
alpm_pkg_get_{make,check}depends functions but forgot to include
logic for parsing these fields from the database. As a result these
functions will always return an empty list.

This commit adds the parsing logic.

Signed-off-by: morganamilo <morganamilo@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
morganamilo 2018-10-09 02:05:15 +01:00 committed by Allan McRae
parent 238fa4af45
commit f9eb2aacb4
2 changed files with 20 additions and 10 deletions

View file

@ -153,6 +153,18 @@ static alpm_list_t *_cache_get_optdepends(alpm_pkg_t *pkg)
return pkg->optdepends; return pkg->optdepends;
} }
static alpm_list_t *_cache_get_makedepends(alpm_pkg_t *pkg)
{
LAZY_LOAD(INFRQ_DESC);
return pkg->makedepends;
}
static alpm_list_t *_cache_get_checkdepends(alpm_pkg_t *pkg)
{
LAZY_LOAD(INFRQ_DESC);
return pkg->checkdepends;
}
static alpm_list_t *_cache_get_conflicts(alpm_pkg_t *pkg) static alpm_list_t *_cache_get_conflicts(alpm_pkg_t *pkg)
{ {
LAZY_LOAD(INFRQ_DESC); LAZY_LOAD(INFRQ_DESC);
@ -318,6 +330,8 @@ static struct pkg_operations local_pkg_ops = {
.get_groups = _cache_get_groups, .get_groups = _cache_get_groups,
.get_depends = _cache_get_depends, .get_depends = _cache_get_depends,
.get_optdepends = _cache_get_optdepends, .get_optdepends = _cache_get_optdepends,
.get_makedepends = _cache_get_makedepends,
.get_checkdepends = _cache_get_checkdepends,
.get_conflicts = _cache_get_conflicts, .get_conflicts = _cache_get_conflicts,
.get_provides = _cache_get_provides, .get_provides = _cache_get_provides,
.get_replaces = _cache_get_replaces, .get_replaces = _cache_get_replaces,
@ -773,6 +787,10 @@ static int local_db_read(alpm_pkg_t *info, int inforeq)
READ_AND_SPLITDEP(info->depends); READ_AND_SPLITDEP(info->depends);
} else if(strcmp(line, "%OPTDEPENDS%") == 0) { } else if(strcmp(line, "%OPTDEPENDS%") == 0) {
READ_AND_SPLITDEP(info->optdepends); READ_AND_SPLITDEP(info->optdepends);
} else if(strcmp(line, "%MAKEDEPENDS%") == 0) {
READ_AND_SPLITDEP(info->makedepends);
} else if(strcmp(line, "%CHECKDEPENDS%") == 0) {
READ_AND_SPLITDEP(info->checkdepends);
} else if(strcmp(line, "%CONFLICTS%") == 0) { } else if(strcmp(line, "%CONFLICTS%") == 0) {
READ_AND_SPLITDEP(info->conflicts); READ_AND_SPLITDEP(info->conflicts);
} else if(strcmp(line, "%PROVIDES%") == 0) { } else if(strcmp(line, "%PROVIDES%") == 0) {

View file

@ -700,17 +700,9 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
} else if(strcmp(line, "%OPTDEPENDS%") == 0) { } else if(strcmp(line, "%OPTDEPENDS%") == 0) {
READ_AND_SPLITDEP(pkg->optdepends); READ_AND_SPLITDEP(pkg->optdepends);
} else if(strcmp(line, "%MAKEDEPENDS%") == 0) { } else if(strcmp(line, "%MAKEDEPENDS%") == 0) {
/* currently unused */ READ_AND_SPLITDEP(pkg->makedepends);
while(1) {
READ_NEXT();
if(strlen(line) == 0) break;
}
} else if(strcmp(line, "%CHECKDEPENDS%") == 0) { } else if(strcmp(line, "%CHECKDEPENDS%") == 0) {
/* currently unused */ READ_AND_SPLITDEP(pkg->checkdepends);
while(1) {
READ_NEXT();
if(strlen(line) == 0) break;
}
} else if(strcmp(line, "%CONFLICTS%") == 0) { } else if(strcmp(line, "%CONFLICTS%") == 0) {
READ_AND_SPLITDEP(pkg->conflicts); READ_AND_SPLITDEP(pkg->conflicts);
} else if(strcmp(line, "%PROVIDES%") == 0) { } else if(strcmp(line, "%PROVIDES%") == 0) {