diff options
author | Dan McGee <dan@archlinux.org> | 2011-08-09 01:00:16 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-08-15 12:56:41 -0500 |
commit | a628feee46f2200db7d3303091813f050a61d0a3 (patch) | |
tree | 47e9924d205098c48a6ef3db33e4424b9845c0fc /lib/libalpm/be_package.c | |
parent | bd5ec9cd8e23bba4334a7b3a5a73843c3667c085 (diff) | |
download | pacman-a628feee46f2200db7d3303091813f050a61d0a3.tar.xz |
Parse conflicts/provides/replaces at database load time
We did this with depends way back in commit c244cfecf654d3 in 2007. We
can do it with these fields as well.
Of note is the inclusion of provides even though only '=' is supported-
we'll parse other things, but no guarantees are given as to behavior,
which is more or less similar to before since we only looked for the
equals sign.
Also of note is the non-inclusion of optdepends; this will likely be
resolved down the road.
The biggest benefactors of this change will be the resolving code that
formerly had to parse and reparse several of these fields; it only
happens once now at load time. This does lead to the disadvantage that
we will now always be parsing this information up front even if we never
need it in the split form, but as these are uncommon fields and our
parser is quite efficient it shouldn't be a big concern.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/be_package.c')
-rw-r--r-- | lib/libalpm/be_package.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 9762cbca..3b5b0d0c 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -194,11 +194,14 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t * } else if(strcmp(key, "optdepend") == 0) { newpkg->optdepends = alpm_list_add(newpkg->optdepends, strdup(ptr)); } else if(strcmp(key, "conflict") == 0) { - newpkg->conflicts = alpm_list_add(newpkg->conflicts, strdup(ptr)); + alpm_depend_t *conflict = _alpm_splitdep(ptr); + newpkg->conflicts = alpm_list_add(newpkg->conflicts, conflict); } else if(strcmp(key, "replaces") == 0) { - newpkg->replaces = alpm_list_add(newpkg->replaces, strdup(ptr)); + alpm_depend_t *replace = _alpm_splitdep(ptr); + newpkg->replaces = alpm_list_add(newpkg->replaces, replace); } else if(strcmp(key, "provides") == 0) { - newpkg->provides = alpm_list_add(newpkg->provides, strdup(ptr)); + alpm_depend_t *provide = _alpm_splitdep(ptr); + newpkg->provides = alpm_list_add(newpkg->provides, provide); } else if(strcmp(key, "backup") == 0) { alpm_backup_t *backup; CALLOC(backup, 1, sizeof(alpm_backup_t), return -1); |