From aba1c4cac64582771f76fc6e681bc1066af5fcf9 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Mon, 10 Feb 2020 21:59:07 +1000 Subject: Store and read name of alternatives Add the names of supplied alternatives to the .PKGINFO file. Read and store these values in libalpm. This information is currently not used anywhere. Signed-off-by: Allan McRae --- lib/libalpm/package.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/libalpm/package.c') diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 5c5fa073..8a9b64e6 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -98,6 +98,7 @@ 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_filelist_t *_pkg_get_files(alpm_pkg_t *pkg) { return &(pkg->files); } static alpm_list_t *_pkg_get_backup(alpm_pkg_t *pkg) { return pkg->backup; } +static alpm_list_t *_pkg_get_alternatives(alpm_pkg_t *pkg) { return pkg->alternatives; } static void *_pkg_changelog_open(alpm_pkg_t UNUSED *pkg) { @@ -162,6 +163,7 @@ struct pkg_operations default_pkg_ops = { .get_replaces = _pkg_get_replaces, .get_files = _pkg_get_files, .get_backup = _pkg_get_backup, + .get_alternatives = _pkg_get_alternatives, .changelog_open = _pkg_changelog_open, .changelog_read = _pkg_changelog_read, @@ -380,6 +382,13 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_backup(alpm_pkg_t *pkg) return pkg->ops->get_backup(pkg); } +alpm_list_t SYMEXPORT *alpm_pkg_get_alternatives(alpm_pkg_t *pkg) +{ + ASSERT(pkg != NULL, return NULL); + pkg->handle->pm_errno = ALPM_ERR_OK; + return pkg->ops->get_alternatives(pkg); +} + alpm_db_t SYMEXPORT *alpm_pkg_get_db(alpm_pkg_t *pkg) { /* Sanity checks */ @@ -594,6 +603,7 @@ int _alpm_pkg_dup(alpm_pkg_t *pkg, alpm_pkg_t **new_ptr) newpkg->optdepends = list_depdup(pkg->optdepends); newpkg->conflicts = list_depdup(pkg->conflicts); newpkg->provides = list_depdup(pkg->provides); + newpkg->alternatives = alpm_list_strdup(pkg->alternatives); if(pkg->files.count) { size_t filenum; @@ -671,6 +681,7 @@ void _alpm_pkg_free(alpm_pkg_t *pkg) free_deplist(pkg->provides); alpm_list_free(pkg->removes); _alpm_pkg_free(pkg->oldpkg); + FREELIST(pkg->alternatives); if(pkg->origin == ALPM_PKG_FROM_FILE) { FREE(pkg->origin_data.file); -- cgit v1.2.3-24-g4f1b