mirror of
https://github.com/moparisthebest/pacman
synced 2024-08-13 17:03:46 -04:00
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>
This commit is contained in:
parent
2630556bde
commit
26f4993e1d
@ -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);
|
STRDUP(info->md5sum, _alpm_strtrim(line), goto error);
|
||||||
} else if(strcmp(line, "%REPLACES%") == 0) {
|
} 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))) {
|
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
||||||
char *linedup;
|
char *linedup;
|
||||||
STRDUP(linedup, _alpm_strtrim(line), goto error);
|
STRDUP(linedup, _alpm_strtrim(line), goto error);
|
||||||
info->replaces = alpm_list_add(info->replaces, linedup);
|
info->replaces = alpm_list_add(info->replaces, linedup);
|
||||||
}
|
}
|
||||||
} else if(strcmp(line, "%FORCE%") == 0) {
|
} else if(strcmp(line, "%FORCE%") == 0) {
|
||||||
/* FORCE tag only appears in sync repositories,
|
|
||||||
* not the local one. */
|
|
||||||
info->force = 1;
|
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);
|
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);
|
fclose(fp);
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
@ -711,7 +694,6 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
|
|||||||
}
|
}
|
||||||
fprintf(fp, "\n");
|
fprintf(fp, "\n");
|
||||||
}
|
}
|
||||||
if(!local) {
|
|
||||||
if(info->replaces) {
|
if(info->replaces) {
|
||||||
fputs("%REPLACES%\n", fp);
|
fputs("%REPLACES%\n", fp);
|
||||||
for(lp = info->replaces; lp; lp = lp->next) {
|
for(lp = info->replaces; lp; lp = lp->next) {
|
||||||
@ -720,9 +702,8 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
|
|||||||
fprintf(fp, "\n");
|
fprintf(fp, "\n");
|
||||||
}
|
}
|
||||||
if(info->force) {
|
if(info->force) {
|
||||||
fprintf(fp, "%%FORCE%%\n"
|
/* note the extra newline character, which is necessary! */
|
||||||
"\n");
|
fprintf(fp, "%%FORCE%%\n\n");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user