summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/be_local.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/be_local.c')
-rw-r--r--lib/libalpm/be_local.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index 9ebdfa40..2b9e2594 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -195,6 +195,12 @@ static alpm_list_t *_cache_get_backup(alpm_pkg_t *pkg)
return pkg->backup;
}
+static alpm_list_t *_cache_get_alternatives(alpm_pkg_t *pkg)
+{
+ LAZY_LOAD(INFRQ_DESC);
+ return pkg->alternatives;
+}
+
/**
* Open a package changelog for reading. Similar to fopen in functionality,
* except that the returned 'file stream' is from the database.
@@ -351,6 +357,7 @@ static struct pkg_operations local_pkg_ops = {
.get_replaces = _cache_get_replaces,
.get_files = _cache_get_files,
.get_backup = _cache_get_backup,
+ .get_alternatives = _cache_get_alternatives,
.changelog_open = _cache_changelog_open,
.changelog_read = _cache_changelog_read,
@@ -806,6 +813,8 @@ static int local_db_read(alpm_pkg_t *info, int inforeq)
READ_AND_SPLITDEP(info->conflicts);
} else if(strcmp(line, "%PROVIDES%") == 0) {
READ_AND_SPLITDEP(info->provides);
+ } else if(strcmp(line, "%ALTERNATIVES%") == 0) {
+ READ_AND_STORE_ALL(info->alternatives);
}
}
fclose(fp);
@@ -1047,6 +1056,15 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, int inforeq)
write_deps(fp, "%CONFLICTS%", info->conflicts);
write_deps(fp, "%PROVIDES%", info->provides);
+ if(info->alternatives) {
+ fputs("%ALTERNATIVES%\n", fp);
+ for(lp = info->alternatives; lp; lp = lp->next) {
+ fputs(lp->data, fp);
+ fputc('\n', fp);
+ }
+ fputc('\n', fp);
+ }
+
fclose(fp);
fp = NULL;
}