summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/be_files.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-09-26 06:02:30 +0200
committerDan McGee <dan@archlinux.org>2007-09-26 06:02:30 +0200
commitfc0e83f05b29f57accb49544dabe856968349b3a (patch)
tree8a417de5ee3e2a522d6c13b1198a62b4c7a44155 /lib/libalpm/be_files.c
parent012f7939784358b02726c169543aa99436439335 (diff)
downloadpacman-fc0e83f05b29f57accb49544dabe856968349b3a.tar.gz
pacman-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/be_files.c')
-rw-r--r--lib/libalpm/be_files.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index 8998f678..af222136 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -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))) {
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%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(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");
}
+ 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) {
fputs("%REQUIREDBY%\n", fp);
for(lp = info->requiredby; lp; lp = lp->next) {