From 0d6a2edaa8e39f9d7b77f0a023e8a2bfdab7a16d Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Sat, 8 Oct 2005 20:43:25 +0000 Subject: Moved the REPLACES and FORCE package fields from DESC to DEPENDS db entry --- lib/libalpm/alpm.c | 2 +- lib/libalpm/alpm.h | 2 +- lib/libalpm/db.c | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index 10444fa4..85665833 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -378,7 +378,6 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm) case PM_PKG_PACKAGER: case PM_PKG_SIZE: case PM_PKG_REASON: - case PM_PKG_REPLACES: case PM_PKG_MD5SUM: if(!(pkg->infolevel & INFRQ_DESC)) { char target[(PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1]; @@ -393,6 +392,7 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm) case PM_PKG_REQUIREDBY: case PM_PKG_CONFLICTS: case PM_PKG_PROVIDES: + case PM_PKG_REPLACES: if(!(pkg->infolevel & INFRQ_DEPENDS)) { char target[(PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1]; snprintf(target, (PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1, "%s-%s", pkg->name, pkg->version); diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 75493365..539d988a 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -134,13 +134,13 @@ enum { PM_PKG_PACKAGER, PM_PKG_SIZE, PM_PKG_REASON, - PM_PKG_REPLACES, /* Sync DB only */ PM_PKG_MD5SUM, /* Sync DB only */ /* Depends entry */ PM_PKG_DEPENDS, PM_PKG_REQUIREDBY, PM_PKG_CONFLICTS, PM_PKG_PROVIDES, + PM_PKG_REPLACES, /* Sync DB only */ /* Files entry */ PM_PKG_FILES, PM_PKG_BACKUP, diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index cee36454..7052d132 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -346,22 +346,12 @@ int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info) } _alpm_strtrim(tmp); info->size = atol(tmp); - } else if(!strcmp(line, "%REPLACES%")) { - /* 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 = pm_list_add(info->replaces, strdup(line)); - } } else if(!strcmp(line, "%MD5SUM%")) { /* MD5SUM tag only appears in sync repositories, * not the local one. */ if(fgets(info->md5sum, sizeof(info->md5sum), fp) == NULL) { return(-1); } - } else if(!strcmp(line, "%FORCE%")) { - /* FORCE tag only appears in sync repositories, - * not the local one. */ - info->force = 1; } } fclose(fp); @@ -417,6 +407,16 @@ int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info) while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) { info->provides = pm_list_add(info->provides, strdup(line)); } + } else if(!strcmp(line, "%REPLACES%")) { + /* 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 = pm_list_add(info->replaces, strdup(line)); + } + } else if(!strcmp(line, "%FORCE%")) { + /* FORCE tag only appears in sync repositories, + * not the local one. */ + info->force = 1; } } fclose(fp); -- cgit v1.2.3-54-g00ecf