be_files : stores REPLACES and FORCE in desc.

repo-add and db_read both assume that REPLACES and FORCE fields are in the
desc file, so do that for db_write as well (instead of depends file).

Note that db_write is currently only used on the local database. And the
only purpose of replaces and force in local database is for information
purpose (available on -Qi operations). So this is not a big problem.

Ref: http://www.archlinux.org/pipermail/pacman-dev/2008-May/011859.html

Acked-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Xavier Chantry 2008-05-22 23:59:10 +02:00 committed by Dan McGee
parent f30dab4b5a
commit b262ddb2ed
1 changed files with 10 additions and 11 deletions

View File

@ -672,6 +672,16 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
}
fprintf(fp, "\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) {
fprintf(fp, "%%FORCE%%\n\n");
}
if(local) {
if(info->url) {
fprintf(fp, "%%URL%%\n"
@ -795,17 +805,6 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
}
fprintf(fp, "\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;
}