summaryrefslogtreecommitdiff
path: root/lib/libalpm/db.c
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2010-10-09 23:31:29 +1000
committerAllan McRae <allan@archlinux.org>2010-10-14 13:17:39 +1000
commit5e61f077357de1767efada259aeb824bcbfe0086 (patch)
tree3ce5d90510e1ca484efab9c87cda6a4e0bcafcc4 /lib/libalpm/db.c
parentfc32faaa6ab4081e2046b2a81e4f9949af2f7282 (diff)
downloadpacman-5e61f077357de1767efada259aeb824bcbfe0086.tar.xz
Populate sync db from archive
Read in list of packages for sync db from tar archive. Breaks reading in _alpm_sync_db_read and a lot of pactests (which is expected as they do not handle sync db in archives...). Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/db.c')
-rw-r--r--lib/libalpm/db.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 2e6bf31b..1adf549b 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -414,10 +414,10 @@ const char *_alpm_db_path(pmdb_t *db)
CALLOC(db->_path, 1, pathsize, RET_ERR(PM_ERR_MEMORY, NULL));
sprintf(db->_path, "%s%s/", dbpath, db->treename);
} else {
- pathsize = strlen(dbpath) + 5 + strlen(db->treename) + 2;
+ pathsize = strlen(dbpath) + 5 + strlen(db->treename) + 4;
CALLOC(db->_path, 1, pathsize, RET_ERR(PM_ERR_MEMORY, NULL));
/* all sync DBs now reside in the sync/ subdir of the dbpath */
- sprintf(db->_path, "%ssync/%s/", dbpath, db->treename);
+ sprintf(db->_path, "%ssync/%s.db", dbpath, db->treename);
}
_alpm_log(PM_LOG_DEBUG, "database path for tree %s set to %s\n",
db->treename, db->_path);
@@ -766,6 +766,12 @@ int splitname(const char *target, pmpkg_t *pkg)
STRDUP(tmp, target, RET_ERR(PM_ERR_MEMORY, -1));
p = tmp + strlen(tmp);
+ /* remove any trailing '/' */
+ while (*(p - 1) == '/') {
+ --p;
+ *p = '\0';
+ }
+
/* do the magic parsing- find the beginning of the version string
* by doing two iterations of same loop to lop off two hyphens */
for(q = --p; *q && *q != '-'; q--);