diff options
author | Nagy Gabor <ngaba@bibl.u-szeged.hu> | 2008-05-03 19:59:11 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-05-29 13:37:20 +0200 |
commit | da1c11cc30d0286f07d46bf2d910482c9a72f31c (patch) | |
tree | c76145caaefce864e7fe0ed6c12e74b5beb3305d | |
parent | ad54b286802fd739532c9fd6f3bc6c7c431bddf4 (diff) | |
download | pacman-da1c11cc30d0286f07d46bf2d910482c9a72f31c.tar.gz pacman-da1c11cc30d0286f07d46bf2d910482c9a72f31c.tar.xz |
Add some verbosity to _alpm_db_read.
Name and version are computed from "/var/lib/pacman/..." pathname. And the
%NAME% and %VERSION% fields from the desc file were not even read. So now,
when we read the desc file, we make sure the %NAME% and %VERSION% fields are
consistent.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | lib/libalpm/be_files.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c index 65196e99..7b3d824d 100644 --- a/lib/libalpm/be_files.c +++ b/lib/libalpm/be_files.c @@ -387,12 +387,28 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) break; } _alpm_strtrim(line); - if(strcmp(line, "%FILENAME%") == 0) { + if(strcmp(line, "%NAME%") == 0) { + if(fgets(line, 512, fp) == NULL) { + goto error; + } + if(strcmp(_alpm_strtrim(line), info->name) != 0) { + _alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: name " + "mismatch on package %s\n"), db->treename, info->name); + } + } else if(strcmp(line, "%VERSION%") == 0) { + if(fgets(line, 512, fp) == NULL) { + goto error; + } + if(strcmp(_alpm_strtrim(line), info->version) != 0) { + _alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: version " + "mismatch on package %s\n"), db->treename, info->name); + } + } else if(strcmp(line, "%FILENAME%") == 0) { if(fgets(line, 512, fp) == NULL) { goto error; } STRDUP(info->filename, _alpm_strtrim(line), goto error); - } else if(strcmp(line, "%DESC%") == 0) { + } else if(strcmp(line, "%DESC%") == 0) { if(fgets(line, 512, fp) == NULL) { goto error; } |