index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
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_sync.c | |
parent | bd5ec9cd8e23bba4334a7b3a5a73843c3667c085 (diff) |
-rw-r--r-- | lib/libalpm/be_sync.c | 19 |
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index 069e39dd..66808a7f 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -460,6 +460,12 @@ static int sync_db_populate(alpm_db_t *db) f = alpm_list_add(f, linedup); \ } while(1) /* note the while(1) and not (0) */ +#define READ_AND_SPLITDEP(f) do { \ + if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \ + if(_alpm_strip_newline(buf.line) == 0) break; \ + f = alpm_list_add(f, _alpm_splitdep(line)); \ +} while(1) /* note the while(1) and not (0) */ + static int sync_db_read(alpm_db_t *db, struct archive *archive, struct archive_entry *entry, alpm_pkg_t **likely_pkg) { @@ -547,20 +553,15 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive, } else if(strcmp(line, "%PGPSIG%") == 0) { READ_AND_STORE(pkg->base64_sig); } else if(strcmp(line, "%REPLACES%") == 0) { - READ_AND_STORE_ALL(pkg->replaces); + READ_AND_SPLITDEP(pkg->replaces); } else if(strcmp(line, "%DEPENDS%") == 0) { - /* Different than the rest because of the _alpm_splitdep call. */ - while(1) { - READ_NEXT(); - if(strlen(line) == 0) break; - pkg->depends = alpm_list_add(pkg->depends, _alpm_splitdep(line)); - } + READ_AND_SPLITDEP(pkg->depends); } else if(strcmp(line, "%OPTDEPENDS%") == 0) { READ_AND_STORE_ALL(pkg->optdepends); } else if(strcmp(line, "%CONFLICTS%") == 0) { - READ_AND_STORE_ALL(pkg->conflicts); + READ_AND_SPLITDEP(pkg->conflicts); } else if(strcmp(line, "%PROVIDES%") == 0) { - READ_AND_STORE_ALL(pkg->provides); + READ_AND_SPLITDEP(pkg->provides); } else if(strcmp(line, "%DELTAS%") == 0) { /* Different than the rest because of the _alpm_delta_parse call. */ while(1) { |