Reworked the cache handling to only load DEPENDS info by default
This commit is contained in:
parent
0d6a2edaa8
commit
05ab859eab
4 changed files with 10 additions and 18 deletions
|
@ -327,8 +327,6 @@ int add_commit(pmtrans_t *trans, pmdb_t *db)
|
||||||
/* we'll need to save some record for backup checks later */
|
/* we'll need to save some record for backup checks later */
|
||||||
oldpkg = pkg_new();
|
oldpkg = pkg_new();
|
||||||
if(oldpkg) {
|
if(oldpkg) {
|
||||||
STRNCPY(oldpkg->name, local->name, PKG_NAME_LEN);
|
|
||||||
STRNCPY(oldpkg->version, local->version, PKG_VERSION_LEN);
|
|
||||||
if(!(local->infolevel & INFRQ_FILES)) {
|
if(!(local->infolevel & INFRQ_FILES)) {
|
||||||
char name[(PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1];
|
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);
|
snprintf(name, (PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1, "%s-%s", local->name, local->version);
|
||||||
|
|
|
@ -364,8 +364,6 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm)
|
||||||
if(pkg->origin == PKG_FROM_CACHE) {
|
if(pkg->origin == PKG_FROM_CACHE) {
|
||||||
switch(parm) {
|
switch(parm) {
|
||||||
/* Desc entry */
|
/* Desc entry */
|
||||||
/* ORE
|
|
||||||
not needed: the cache is loaded with DESC and DEPENDS by default
|
|
||||||
case PM_PKG_NAME:
|
case PM_PKG_NAME:
|
||||||
case PM_PKG_VERSION:
|
case PM_PKG_VERSION:
|
||||||
case PM_PKG_DESC:
|
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);
|
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);
|
db_read(pkg->data, target, INFRQ_DESC, pkg);
|
||||||
}
|
}
|
||||||
break;*/
|
break;
|
||||||
/* Depends entry */
|
/* Depends entry */
|
||||||
/* ORE
|
/* 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_DEPENDS:
|
||||||
case PM_PKG_REQUIREDBY:
|
case PM_PKG_REQUIREDBY:
|
||||||
case PM_PKG_CONFLICTS:
|
case PM_PKG_CONFLICTS:
|
||||||
|
|
|
@ -49,7 +49,7 @@ static int pkg_cmp(const void *p1, const void *p2)
|
||||||
int db_load_pkgcache(pmdb_t *db)
|
int db_load_pkgcache(pmdb_t *db)
|
||||||
{
|
{
|
||||||
pmpkg_t *info;
|
pmpkg_t *info;
|
||||||
unsigned char infolevel = INFRQ_DESC|INFRQ_DEPENDS;
|
unsigned char infolevel = INFRQ_DEPENDS;
|
||||||
|
|
||||||
if(db == NULL) {
|
if(db == NULL) {
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|
|
@ -266,6 +266,12 @@ int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info)
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(info->name[0] == 0) {
|
||||||
|
if(pkg_splitname(name, info->name, info->version) == -1) {
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* DESC */
|
/* DESC */
|
||||||
if(inforeq & INFRQ_DESC) {
|
if(inforeq & INFRQ_DESC) {
|
||||||
snprintf(path, PATH_MAX, "%s/%s/desc", db->path, name);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
_alpm_strtrim(line);
|
_alpm_strtrim(line);
|
||||||
if(!strcmp(line, "%NAME%")) {
|
if(!strcmp(line, "%DESC%")) {
|
||||||
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(fgets(info->desc, sizeof(info->desc), fp) == NULL) {
|
if(fgets(info->desc, sizeof(info->desc), fp) == NULL) {
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue