summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChantry Xavier <shiningxc@gmail.com>2008-02-13 20:42:43 +0100
committerDan McGee <dan@archlinux.org>2008-04-26 18:54:47 +0200
commit481c3edc89fa674f9723c13ab4d12f032cf8ca02 (patch)
tree7f80c30d87878864720c45768711b0888566cede
parent8fdf08ef782d234efe7957873839433ced64ffcc (diff)
downloadpacman-481c3edc89fa674f9723c13ab4d12f032cf8ca02.tar.gz
pacman-481c3edc89fa674f9723c13ab4d12f032cf8ca02.tar.xz
get_filename : use the FILENAME db field only.
Reference : FS#9547. The get_filename function first tries to get the filename field from the database, and if it doesn't find it, it tries to guess it based on the name, version and arch. This field was introduced in 3.0, but there are still many old entries in the official databases without it. So the databases need to be regenerated first before this patch can be applied. There is a second problem with the delta code, which needs the filename for locally installed packages too, but this field is not present in the local db. So the delta code needs to be fixed first. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--lib/libalpm/package.c13
-rw-r--r--lib/libalpm/sync.c4
2 files changed, 4 insertions, 13 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 4baa1588..ffaa96b3 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -152,19 +152,6 @@ const char SYMEXPORT *alpm_pkg_get_filename(pmpkg_t *pkg)
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
}
- if(pkg->filename == NULL || strlen(pkg->filename) == 0) {
- /* construct the file name, it's not in the desc file */
- char buffer[PATH_MAX];
- if(pkg->arch && strlen(pkg->arch) > 0) {
- snprintf(buffer, PATH_MAX, "%s-%s-%s" PKGEXT,
- pkg->name, pkg->version, pkg->arch);
- } else {
- snprintf(buffer, PATH_MAX, "%s-%s" PKGEXT,
- pkg->name, pkg->version);
- }
- STRDUP(pkg->filename, buffer, RET_ERR(PM_ERR_MEMORY, NULL));
- }
-
return pkg->filename;
}
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 8dc02e06..9d087d7e 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -819,6 +819,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
const char *fname = NULL;
fname = alpm_pkg_get_filename(spkg);
+ ASSERT(fname != NULL, RET_ERR(PM_ERR_PKG_INVALID_NAME, -1));
if(trans->flags & PM_TRANS_FLAG_PRINTURIS) {
EVENT(trans, PM_TRANS_EVT_PRINTURI, (char *)alpm_db_get_url(current),
(char *)fname);
@@ -985,6 +986,9 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
char *fpath;
fname = alpm_pkg_get_filename(spkg);
+ if(fname == NULL) {
+ goto error;
+ }
/* Loop through the cache dirs until we find a matching file */
fpath = _alpm_filecache_find(fname);