diff options
author | Benedikt Morbach <benedikt.morbach@googlemail.com> | 2011-07-18 01:54:06 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-03-09 00:26:46 +0100 |
commit | e85e77e6f9f0979a16d69cd93ee6ea35583e9bfb (patch) | |
tree | 9620ed6fb2efcd866dd1cff1b7e7cdfc1846e3ea /lib/libalpm | |
parent | 00f29cbc14ec24f1e432eadaf35742857285a01a (diff) | |
download | pacman-e85e77e6f9f0979a16d69cd93ee6ea35583e9bfb.tar.gz pacman-e85e77e6f9f0979a16d69cd93ee6ea35583e9bfb.tar.xz |
Hook new optdepend structures up
No new behaviour introduced, everything should work exactly as before.
Dan: refactored to use the single alpm_depend_t structure.
Signed-off-by: Benedikt Morbach <benedikt.morbach@googlemail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/alpm.h | 2 | ||||
-rw-r--r-- | lib/libalpm/be_local.c | 6 | ||||
-rw-r--r-- | lib/libalpm/be_package.c | 5 | ||||
-rw-r--r-- | lib/libalpm/be_sync.c | 2 | ||||
-rw-r--r-- | lib/libalpm/package.c | 4 |
5 files changed, 11 insertions, 8 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 8a418dc0..a6b7c789 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -820,7 +820,7 @@ alpm_list_t *alpm_pkg_get_depends(alpm_pkg_t *pkg); /** Returns the list of package optional dependencies. * @param pkg a pointer to package - * @return a reference to an internal list of strings. + * @return a reference to an internal list of alpm_depend_t structures. */ alpm_list_t *alpm_pkg_get_optdepends(alpm_pkg_t *pkg); diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index 20b7895c..0d423fa7 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -611,7 +611,7 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq) } else if(strcmp(line, "%DEPENDS%") == 0) { READ_AND_SPLITDEP(info->depends); } else if(strcmp(line, "%OPTDEPENDS%") == 0) { - READ_AND_STORE_ALL(info->optdepends); + READ_AND_SPLITDEP(info->optdepends); } else if(strcmp(line, "%CONFLICTS%") == 0) { READ_AND_SPLITDEP(info->conflicts); } else if(strcmp(line, "%PROVIDES%") == 0) { @@ -829,7 +829,9 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq if(info->optdepends) { fputs("%OPTDEPENDS%\n", fp); for(lp = info->optdepends; lp; lp = lp->next) { - fprintf(fp, "%s\n", (char *)lp->data); + char *optstring = alpm_dep_compute_string(lp->data); + fprintf(fp, "%s\n", optstring); + free(optstring); } fprintf(fp, "\n"); } diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 40081954..c076f610 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -36,7 +36,7 @@ #include "log.h" #include "handle.h" #include "package.h" -#include "deps.h" /* _alpm_splitdep */ +#include "deps.h" struct package_changelog { struct archive *archive; @@ -214,7 +214,8 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t * alpm_depend_t *dep = _alpm_splitdep(ptr); newpkg->depends = alpm_list_add(newpkg->depends, dep); } else if(strcmp(key, "optdepend") == 0) { - newpkg->optdepends = alpm_list_add(newpkg->optdepends, strdup(ptr)); + alpm_depend_t *optdep = _alpm_splitdep(ptr); + newpkg->optdepends = alpm_list_add(newpkg->optdepends, optdep); } else if(strcmp(key, "conflict") == 0) { alpm_depend_t *conflict = _alpm_splitdep(ptr); newpkg->conflicts = alpm_list_add(newpkg->conflicts, conflict); diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index b7b2acd3..c4032032 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -566,7 +566,7 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive, } else if(strcmp(line, "%DEPENDS%") == 0) { READ_AND_SPLITDEP(pkg->depends); } else if(strcmp(line, "%OPTDEPENDS%") == 0) { - READ_AND_STORE_ALL(pkg->optdepends); + READ_AND_SPLITDEP(pkg->optdepends); } else if(strcmp(line, "%CONFLICTS%") == 0) { READ_AND_SPLITDEP(pkg->conflicts); } else if(strcmp(line, "%PROVIDES%") == 0) { diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index f66c3073..5b075634 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -522,7 +522,7 @@ int _alpm_pkg_dup(alpm_pkg_t *pkg, alpm_pkg_t **new_ptr) newpkg->backup = alpm_list_add(newpkg->backup, _alpm_backup_dup(i->data)); } newpkg->depends = list_depdup(pkg->depends); - newpkg->optdepends = alpm_list_strdup(pkg->optdepends); + newpkg->optdepends = list_depdup(pkg->optdepends); newpkg->conflicts = list_depdup(pkg->conflicts); newpkg->provides = list_depdup(pkg->provides); for(i = pkg->deltas; i; i = i->next) { @@ -597,7 +597,7 @@ void _alpm_pkg_free(alpm_pkg_t *pkg) alpm_list_free_inner(pkg->backup, (alpm_list_fn_free)_alpm_backup_free); alpm_list_free(pkg->backup); free_deplist(pkg->depends); - FREELIST(pkg->optdepends); + free_deplist(pkg->optdepends); free_deplist(pkg->conflicts); free_deplist(pkg->provides); alpm_list_free_inner(pkg->deltas, (alpm_list_fn_free)_alpm_delta_free); |