summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-10-08 21:32:14 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-10-08 21:32:14 +0000
commit05ab859eab8dbe14f1957d0a4e64b3f005630d45 (patch)
treeac53d2941e0f924384bb7986052baa858155a767
parent0d6a2edaa8e39f9d7b77f0a023e8a2bfdab7a16d (diff)
downloadpacman-05ab859eab8dbe14f1957d0a4e64b3f005630d45.tar.xz
Reworked the cache handling to only load DEPENDS info by default
-rw-r--r--lib/libalpm/add.c2
-rw-r--r--lib/libalpm/alpm.c6
-rw-r--r--lib/libalpm/cache.c2
-rw-r--r--lib/libalpm/db.c18
4 files changed, 10 insertions, 18 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 327b5407..6c6fc6b6 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -327,8 +327,6 @@ int add_commit(pmtrans_t *trans, pmdb_t *db)
/* we'll need to save some record for backup checks later */
oldpkg = pkg_new();
if(oldpkg) {
- STRNCPY(oldpkg->name, local->name, PKG_NAME_LEN);
- STRNCPY(oldpkg->version, local->version, PKG_VERSION_LEN);
if(!(local->infolevel & INFRQ_FILES)) {
char name[(PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1];
snprintf(name, (PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1, "%s-%s", local->name, local->version);
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 85665833..fd8641b1 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -364,8 +364,6 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm)
if(pkg->origin == PKG_FROM_CACHE) {
switch(parm) {
/* Desc entry */
- /* ORE
- not needed: the cache is loaded with DESC and DEPENDS by default
case PM_PKG_NAME:
case PM_PKG_VERSION:
case PM_PKG_DESC:
@@ -384,10 +382,10 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm)
snprintf(target, (PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1, "%s-%s", pkg->name, pkg->version);
db_read(pkg->data, target, INFRQ_DESC, pkg);
}
- break;*/
+ break;
/* Depends entry */
/* ORE
- not needed: the cache is loaded with DESC and DEPENDS by default
+ not needed: the cache is loaded with DEPENDS by default
case PM_PKG_DEPENDS:
case PM_PKG_REQUIREDBY:
case PM_PKG_CONFLICTS:
diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c
index 31257c08..d4e19416 100644
--- a/lib/libalpm/cache.c
+++ b/lib/libalpm/cache.c
@@ -49,7 +49,7 @@ static int pkg_cmp(const void *p1, const void *p2)
int db_load_pkgcache(pmdb_t *db)
{
pmpkg_t *info;
- unsigned char infolevel = INFRQ_DESC|INFRQ_DEPENDS;
+ unsigned char infolevel = INFRQ_DEPENDS;
if(db == NULL) {
return(-1);
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 7052d132..60850489 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -266,6 +266,12 @@ int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info)
return(-1);
}
+ if(info->name[0] == 0) {
+ if(pkg_splitname(name, info->name, info->version) == -1) {
+ return(-1);
+ }
+ }
+
/* DESC */
if(inforeq & INFRQ_DESC) {
snprintf(path, PATH_MAX, "%s/%s/desc", db->path, name);
@@ -279,17 +285,7 @@ int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info)
break;
}
_alpm_strtrim(line);
- if(!strcmp(line, "%NAME%")) {
- if(fgets(info->name, sizeof(info->name), fp) == NULL) {
- return(-1);
- }
- _alpm_strtrim(info->name);
- } else if(!strcmp(line, "%VERSION%")) {
- if(fgets(info->version, sizeof(info->version), fp) == NULL) {
- return(-1);
- }
- _alpm_strtrim(info->version);
- } else if(!strcmp(line, "%DESC%")) {
+ if(!strcmp(line, "%DESC%")) {
if(fgets(info->desc, sizeof(info->desc), fp) == NULL) {
return(-1);
}