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>
This commit is contained in:
parent
012f793978
commit
fc0e83f05b
6 changed files with 36 additions and 2 deletions
|
@ -213,6 +213,7 @@ pmpkgreason_t alpm_pkg_get_reason(pmpkg_t *pkg);
|
||||||
alpm_list_t *alpm_pkg_get_licenses(pmpkg_t *pkg);
|
alpm_list_t *alpm_pkg_get_licenses(pmpkg_t *pkg);
|
||||||
alpm_list_t *alpm_pkg_get_groups(pmpkg_t *pkg);
|
alpm_list_t *alpm_pkg_get_groups(pmpkg_t *pkg);
|
||||||
alpm_list_t *alpm_pkg_get_depends(pmpkg_t *pkg);
|
alpm_list_t *alpm_pkg_get_depends(pmpkg_t *pkg);
|
||||||
|
alpm_list_t *alpm_pkg_get_optdepends(pmpkg_t *pkg);
|
||||||
alpm_list_t *alpm_pkg_get_requiredby(pmpkg_t *pkg);
|
alpm_list_t *alpm_pkg_get_requiredby(pmpkg_t *pkg);
|
||||||
alpm_list_t *alpm_pkg_get_conflicts(pmpkg_t *pkg);
|
alpm_list_t *alpm_pkg_get_conflicts(pmpkg_t *pkg);
|
||||||
alpm_list_t *alpm_pkg_get_provides(pmpkg_t *pkg);
|
alpm_list_t *alpm_pkg_get_provides(pmpkg_t *pkg);
|
||||||
|
|
|
@ -388,6 +388,10 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
|
||||||
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
||||||
info->depends = alpm_list_add(info->depends, strdup(line));
|
info->depends = alpm_list_add(info->depends, strdup(line));
|
||||||
}
|
}
|
||||||
|
} else if(!strcmp(line, "%OPTDEPENDS%")) {
|
||||||
|
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
||||||
|
info->optdepends = alpm_list_add(info->optdepends, strdup(line));
|
||||||
|
}
|
||||||
} else if(!strcmp(line, "%REQUIREDBY%")) {
|
} else if(!strcmp(line, "%REQUIREDBY%")) {
|
||||||
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
||||||
info->requiredby = alpm_list_add(info->requiredby, strdup(line));
|
info->requiredby = alpm_list_add(info->requiredby, strdup(line));
|
||||||
|
@ -587,6 +591,13 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
|
||||||
}
|
}
|
||||||
fprintf(fp, "\n");
|
fprintf(fp, "\n");
|
||||||
}
|
}
|
||||||
|
if(info->optdepends) {
|
||||||
|
fputs("%OPTDEPENDS%\n", fp);
|
||||||
|
for(lp = info->optdepends; lp; lp = lp->next) {
|
||||||
|
fprintf(fp, "%s\n", (char *)lp->data);
|
||||||
|
}
|
||||||
|
fprintf(fp, "\n");
|
||||||
|
}
|
||||||
if(local && info->requiredby) {
|
if(local && info->requiredby) {
|
||||||
fputs("%REQUIREDBY%\n", fp);
|
fputs("%REQUIREDBY%\n", fp);
|
||||||
for(lp = info->requiredby; lp; lp = lp->next) {
|
for(lp = info->requiredby; lp; lp = lp->next) {
|
||||||
|
|
|
@ -417,7 +417,6 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_groups(pmpkg_t *pkg)
|
||||||
return pkg->groups;
|
return pkg->groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* depends */
|
|
||||||
alpm_list_t SYMEXPORT *alpm_pkg_get_depends(pmpkg_t *pkg)
|
alpm_list_t SYMEXPORT *alpm_pkg_get_depends(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
@ -432,6 +431,20 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_depends(pmpkg_t *pkg)
|
||||||
return pkg->depends;
|
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_list_t SYMEXPORT *alpm_pkg_get_requiredby(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
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->files = alpm_list_strdup(alpm_pkg_get_files(pkg));
|
||||||
newpkg->backup = alpm_list_strdup(alpm_pkg_get_backup(pkg));
|
newpkg->backup = alpm_list_strdup(alpm_pkg_get_backup(pkg));
|
||||||
newpkg->depends = alpm_list_strdup(alpm_pkg_get_depends(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->groups = alpm_list_strdup(alpm_pkg_get_groups(pkg));
|
||||||
newpkg->provides = alpm_list_strdup(alpm_pkg_get_provides(pkg));
|
newpkg->provides = alpm_list_strdup(alpm_pkg_get_provides(pkg));
|
||||||
newpkg->replaces = alpm_list_strdup(alpm_pkg_get_replaces(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->files);
|
||||||
FREELIST(pkg->backup);
|
FREELIST(pkg->backup);
|
||||||
FREELIST(pkg->depends);
|
FREELIST(pkg->depends);
|
||||||
|
FREELIST(pkg->optdepends);
|
||||||
FREELIST(pkg->conflicts);
|
FREELIST(pkg->conflicts);
|
||||||
FREELIST(pkg->requiredby);
|
FREELIST(pkg->requiredby);
|
||||||
FREELIST(pkg->groups);
|
FREELIST(pkg->groups);
|
||||||
|
@ -876,6 +891,8 @@ static int parse_descfile(const char *descfile, pmpkg_t *info)
|
||||||
info->isize = atol(ptr);
|
info->isize = atol(ptr);
|
||||||
} else if(!strcmp(key, "depend")) {
|
} else if(!strcmp(key, "depend")) {
|
||||||
info->depends = alpm_list_add(info->depends, strdup(ptr));
|
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")) {
|
} else if(!strcmp(key, "conflict")) {
|
||||||
info->conflicts = alpm_list_add(info->conflicts, strdup(ptr));
|
info->conflicts = alpm_list_add(info->conflicts, strdup(ptr));
|
||||||
} else if(!strcmp(key, "replaces")) {
|
} else if(!strcmp(key, "replaces")) {
|
||||||
|
|
|
@ -71,6 +71,7 @@ struct __pmpkg_t {
|
||||||
alpm_list_t *files;
|
alpm_list_t *files;
|
||||||
alpm_list_t *backup;
|
alpm_list_t *backup;
|
||||||
alpm_list_t *depends;
|
alpm_list_t *depends;
|
||||||
|
alpm_list_t *optdepends;
|
||||||
alpm_list_t *requiredby;
|
alpm_list_t *requiredby;
|
||||||
alpm_list_t *conflicts;
|
alpm_list_t *conflicts;
|
||||||
alpm_list_t *provides;
|
alpm_list_t *provides;
|
||||||
|
|
|
@ -815,6 +815,9 @@ create_package() {
|
||||||
for it in "${depends[@]}"; do
|
for it in "${depends[@]}"; do
|
||||||
echo "depend = $it" >>.PKGINFO
|
echo "depend = $it" >>.PKGINFO
|
||||||
done
|
done
|
||||||
|
for it in "${optdepends[@]}"; do
|
||||||
|
echo "optdepend = $it" >>.PKGINFO
|
||||||
|
done
|
||||||
for it in "${conflicts[@]}"; do
|
for it in "${conflicts[@]}"; do
|
||||||
echo "conflict = $it" >>.PKGINFO
|
echo "conflict = $it" >>.PKGINFO
|
||||||
done
|
done
|
||||||
|
@ -1177,7 +1180,7 @@ fi
|
||||||
|
|
||||||
unset pkgname pkgver pkgrel pkgdesc url license groups provides md5sums force
|
unset pkgname pkgver pkgrel pkgdesc url license groups provides md5sums force
|
||||||
unset replaces depends conflicts backup source install build makedepends
|
unset replaces depends conflicts backup source install build makedepends
|
||||||
unset options noextract
|
unset optdepends options noextract
|
||||||
|
|
||||||
if [ ! -f "$BUILDSCRIPT" ]; then
|
if [ ! -f "$BUILDSCRIPT" ]; then
|
||||||
error "$(gettext "%s does not exist.")" "$BUILDSCRIPT"
|
error "$(gettext "%s does not exist.")" "$BUILDSCRIPT"
|
||||||
|
|
|
@ -75,6 +75,7 @@ void dump_pkg_full(pmpkg_t *pkg, int level)
|
||||||
list_display(_("Groups :"), alpm_pkg_get_groups(pkg));
|
list_display(_("Groups :"), alpm_pkg_get_groups(pkg));
|
||||||
list_display(_("Provides :"), alpm_pkg_get_provides(pkg));
|
list_display(_("Provides :"), alpm_pkg_get_provides(pkg));
|
||||||
list_display(_("Depends On :"), alpm_pkg_get_depends(pkg));
|
list_display(_("Depends On :"), alpm_pkg_get_depends(pkg));
|
||||||
|
list_display(_("Optional Deps :"), alpm_pkg_get_optdepends(pkg));
|
||||||
/* Only applicable if installed */
|
/* Only applicable if installed */
|
||||||
if(level > 0) {
|
if(level > 0) {
|
||||||
list_display(_("Required By :"), alpm_pkg_get_requiredby(pkg));
|
list_display(_("Required By :"), alpm_pkg_get_requiredby(pkg));
|
||||||
|
|
Loading…
Add table
Reference in a new issue