summaryrefslogtreecommitdiff
path: root/lib/libalpm/alpm.c
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-04-08 20:42:27 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-04-08 20:42:27 +0000
commit70481b0ee1e308de56b353b5932556326fa6474e (patch)
tree770d643b6d526ac5b4fee24a7bf1b227208cbf36 /lib/libalpm/alpm.c
parent3e77af5182daffa47604e51783b338af4cd31ea7 (diff)
downloadpacman-70481b0ee1e308de56b353b5932556326fa6474e.tar.xz
reworked alpm_db_readpkg
Diffstat (limited to 'lib/libalpm/alpm.c')
-rw-r--r--lib/libalpm/alpm.c49
1 files changed, 42 insertions, 7 deletions
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index a719b38d..63e66344 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -333,22 +333,57 @@ void *alpm_pkg_getinfo(PM_PKG *pkg, unsigned char parm)
ASSERT(pkg != NULL, return(NULL));
/* Update the cache package entry if needed */
- if(pkg->origin == PKG_FROM_CACHE && pkg->data == handle->db_local) {
+ 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:
+ case PM_PKG_GROUPS:
+ case PM_PKG_URL:
+ case PM_PKG_LICENSE:
+ case PM_PKG_ARCH:
+ case PM_PKG_BUILDDATE:
+ case PM_PKG_INSTALLDATE:
+ case PM_PKG_PACKAGER:
+ case PM_PKG_SIZE:
+ case PM_PKG_REASON:
+ case PM_PKG_REPLACES:
+ case PM_PKG_MD5SUM:
+ if(!(pkg->infolevel & INFRQ_DESC)) {
+ char target[PKG_NAME_LEN+PKG_VERSION_LEN];
+ snprintf(target, PKG_NAME_LEN+PKG_VERSION_LEN, "%s-%s", pkg->name, pkg->version);
+ db_read(pkg->data, target, INFRQ_DESC, pkg);
+ }
+ break;*/
+ /* Depends entry */
+ /* ORE
+ not needed: the cache is loaded with DESC and DEPENDS by default
+ case PM_PKG_DEPENDS:
+ case PM_PKG_REQUIREDBY:
+ case PM_PKG_CONFLICTS:
+ case PM_PKG_PROVIDES:
+ if(!(pkg->infolevel & INFRQ_DEPENDS)) {
+ char target[PKG_NAME_LEN+PKG_VERSION_LEN];
+ snprintf(target, PKG_NAME_LEN+PKG_VERSION_LEN, "%s-%s", pkg->name, pkg->version);
+ db_read(pkg->data, target, INFRQ_DEPENDS, pkg);
+ }
+ break;*/
+ /* Files entry */
case PM_PKG_FILES:
case PM_PKG_BACKUP:
- if(!(pkg->infolevel & INFRQ_FILES)) {
+ if(pkg->data == handle->db_local && !(pkg->infolevel & INFRQ_FILES)) {
char target[PKG_NAME_LEN+PKG_VERSION_LEN];
-
snprintf(target, PKG_NAME_LEN+PKG_VERSION_LEN, "%s-%s", pkg->name, pkg->version);
- db_read(pkg->data, pkg->name, INFRQ_FILES, pkg);
+ db_read(pkg->data, target, INFRQ_FILES, pkg);
}
break;
-
+ /* Scriptlet */
case PM_PKG_SCRIPLET:
- if(!(pkg->infolevel & INFRQ_SCRIPLET)) {
+ if(pkg->data == handle->db_local && !(pkg->infolevel & INFRQ_SCRIPLET)) {
char target[PKG_NAME_LEN+PKG_VERSION_LEN];
-
snprintf(target, PKG_NAME_LEN+PKG_VERSION_LEN, "%s-%s", pkg->name, pkg->version);
db_read(pkg->data, target, INFRQ_SCRIPLET, pkg);
}