1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-10-31 15:45:03 -04:00

Moved the REPLACES and FORCE package fields from DESC to DEPENDS db entry

This commit is contained in:
Aurelien Foret 2005-10-08 20:43:25 +00:00
parent 5ef51b3e26
commit 0d6a2edaa8
5 changed files with 34 additions and 34 deletions

View File

@ -378,7 +378,6 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm)
case PM_PKG_PACKAGER: case PM_PKG_PACKAGER:
case PM_PKG_SIZE: case PM_PKG_SIZE:
case PM_PKG_REASON: case PM_PKG_REASON:
case PM_PKG_REPLACES:
case PM_PKG_MD5SUM: case PM_PKG_MD5SUM:
if(!(pkg->infolevel & INFRQ_DESC)) { if(!(pkg->infolevel & INFRQ_DESC)) {
char target[(PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1]; 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_REQUIREDBY:
case PM_PKG_CONFLICTS: case PM_PKG_CONFLICTS:
case PM_PKG_PROVIDES: case PM_PKG_PROVIDES:
case PM_PKG_REPLACES:
if(!(pkg->infolevel & INFRQ_DEPENDS)) { if(!(pkg->infolevel & INFRQ_DEPENDS)) {
char target[(PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1]; 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); snprintf(target, (PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1, "%s-%s", pkg->name, pkg->version);

View File

@ -134,13 +134,13 @@ enum {
PM_PKG_PACKAGER, PM_PKG_PACKAGER,
PM_PKG_SIZE, PM_PKG_SIZE,
PM_PKG_REASON, PM_PKG_REASON,
PM_PKG_REPLACES, /* Sync DB only */
PM_PKG_MD5SUM, /* Sync DB only */ PM_PKG_MD5SUM, /* Sync DB only */
/* Depends entry */ /* Depends entry */
PM_PKG_DEPENDS, PM_PKG_DEPENDS,
PM_PKG_REQUIREDBY, PM_PKG_REQUIREDBY,
PM_PKG_CONFLICTS, PM_PKG_CONFLICTS,
PM_PKG_PROVIDES, PM_PKG_PROVIDES,
PM_PKG_REPLACES, /* Sync DB only */
/* Files entry */ /* Files entry */
PM_PKG_FILES, PM_PKG_FILES,
PM_PKG_BACKUP, PM_PKG_BACKUP,

View File

@ -346,22 +346,12 @@ int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info)
} }
_alpm_strtrim(tmp); _alpm_strtrim(tmp);
info->size = atol(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%")) { } else if(!strcmp(line, "%MD5SUM%")) {
/* MD5SUM tag only appears in sync repositories, /* MD5SUM tag only appears in sync repositories,
* not the local one. */ * not the local one. */
if(fgets(info->md5sum, sizeof(info->md5sum), fp) == NULL) { if(fgets(info->md5sum, sizeof(info->md5sum), fp) == NULL) {
return(-1); return(-1);
} }
} else if(!strcmp(line, "%FORCE%")) {
/* FORCE tag only appears in sync repositories,
* not the local one. */
info->force = 1;
} }
} }
fclose(fp); 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))) { while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
info->provides = pm_list_add(info->provides, strdup(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); fclose(fp);

View File

@ -100,17 +100,6 @@ db_write_entry()
done done
echo "" >>desc echo "" >>desc
fi fi
if [ ${#replaces[*]} -gt 0 ]; then
echo "%REPLACES%" >>desc
for it in "${replaces[@]}"; do
echo "$it" >>desc
done
echo "" >>desc
fi
if [ "$force" = "y" -o "$force" = "Y" ]; then
echo "%FORCE%" >>desc
echo "" >>desc
fi
# depends # depends
: >depends : >depends
if [ ${#depends[*]} -gt 0 ]; then if [ ${#depends[*]} -gt 0 ]; then
@ -134,6 +123,17 @@ db_write_entry()
done done
echo "" >>depends echo "" >>depends
fi fi
if [ ${#replaces[*]} -gt 0 ]; then
echo "%REPLACES%" >>depends
for it in "${replaces[@]}"; do
echo "$it" >>depends
done
echo "" >>depends
fi
if [ "$force" = "y" -o "$force" = "Y" ]; then
echo "%FORCE%" >>depends
echo "" >>depends
fi
# preserve the modification time # preserve the modification time
touch -r $1 desc depends touch -r $1 desc depends
} }

View File

@ -103,17 +103,6 @@ db_write_entry()
done done
echo "" >>desc echo "" >>desc
fi fi
if [ ${#replaces[*]} -gt 0 ]; then
echo "%REPLACES%" >>desc
for it in "${replaces[@]}"; do
echo "$it" >>desc
done
echo "" >>desc
fi
if [ "$force" = "y" -o "$force" = "Y" ]; then
echo "%FORCE%" >>desc
echo "" >>desc
fi
# depends # depends
: >depends : >depends
if [ ${#depends[*]} -gt 0 ]; then if [ ${#depends[*]} -gt 0 ]; then
@ -137,6 +126,17 @@ db_write_entry()
done done
echo "" >>depends echo "" >>depends
fi fi
if [ ${#replaces[*]} -gt 0 ]; then
echo "%REPLACES%" >>depends
for it in "${replaces[@]}"; do
echo "$it" >>depends
done
echo "" >>depends
fi
if [ "$force" = "y" -o "$force" = "Y" ]; then
echo "%FORCE%" >>depends
echo "" >>depends
fi
} }
delete_entry() delete_entry()