diff options
author | Aaron Griffin <aaronmgriffin@gmail.com> | 2008-01-10 01:24:11 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-01-12 08:33:57 +0100 |
commit | 26f4993e1d67a7daae1dcac47e112f9b15a6bf97 (patch) | |
tree | e6947fa9c1612813aeca3afe805c2375cab74603 /lib/libalpm/be_files.c | |
parent | 2630556bdef7a07fda056fdcd0a2fa00c3625d3c (diff) | |
download | pacman-26f4993e1d67a7daae1dcac47e112f9b15a6bf97.tar.gz pacman-26f4993e1d67a7daae1dcac47e112f9b15a6bf97.tar.xz |
Store replaces in the local DB too
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
[Dan: might as well store 'force' too]
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/be_files.c')
-rw-r--r-- | lib/libalpm/be_files.c | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c index acd102ad..443a55de 100644 --- a/lib/libalpm/be_files.c +++ b/lib/libalpm/be_files.c @@ -406,16 +406,12 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) } STRDUP(info->md5sum, _alpm_strtrim(line), goto error); } else if(strcmp(line, "%REPLACES%") == 0) { - /* the REPLACES tag is special -- it only appears in sync repositories, - * not the local one. */ while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) { char *linedup; STRDUP(linedup, _alpm_strtrim(line), goto error); info->replaces = alpm_list_add(info->replaces, linedup); } } else if(strcmp(line, "%FORCE%") == 0) { - /* FORCE tag only appears in sync repositories, - * not the local one. */ info->force = 1; } } @@ -484,19 +480,6 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) info->provides = alpm_list_add(info->provides, linedup); } } - /* TODO: we were going to move these things here, but it should wait. - * A better change would be to figure out how to restructure the DB. */ - /* else if(strcmp(line, "%REPLACES%") == 0) { - * the REPLACES tag is special -- it only appears in sync repositories, - * not the local one. * - while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) { - info->replaces = alpm_list_add(info->replaces, strdup(line)); - } - } else if(strcmp(line, "%FORCE%") == 0) { - * FORCE tag only appears in sync repositories, - * not the local one. * - info->force = 1; - } */ } fclose(fp); fp = NULL; @@ -711,18 +694,16 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) } fprintf(fp, "\n"); } - if(!local) { - if(info->replaces) { - fputs("%REPLACES%\n", fp); - for(lp = info->replaces; lp; lp = lp->next) { - fprintf(fp, "%s\n", (char *)lp->data); - } - fprintf(fp, "\n"); - } - if(info->force) { - fprintf(fp, "%%FORCE%%\n" - "\n"); + if(info->replaces) { + fputs("%REPLACES%\n", fp); + for(lp = info->replaces; lp; lp = lp->next) { + fprintf(fp, "%s\n", (char *)lp->data); } + fprintf(fp, "\n"); + } + if(info->force) { + /* note the extra newline character, which is necessary! */ + fprintf(fp, "%%FORCE%%\n\n"); } fclose(fp); fp = NULL; |