summaryrefslogtreecommitdiff
path: root/lib/libalpm/package.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-03-01 19:07:38 +0000
committerDan McGee <dan@archlinux.org>2007-03-01 19:07:38 +0000
commitefca1cc0106fd4b1eea795b6ff8ae208e1196042 (patch)
tree6fe6a4b5689a5d239ffb568a673c17b6cc66caf7 /lib/libalpm/package.c
parentca139e985017652fa1d25b2ff8ac4a8ebbe4c648 (diff)
downloadpacman-efca1cc0106fd4b1eea795b6ff8ae208e1196042.tar.xz
* Modified values of INFRQ_* options so we start at 0x01 and not 0x00. This
allows for the same bit operators to be used across the board on pkg_get operations. * Changed name of INFRQ_NONE -> INFRQ_BASE to more clearly reflect what it does (loads pkg name and version). * Added a few missing things on package functions, such as SYMEXPORT and ALPM_LOG_FUNC. * Slight updates to pmenv to print 'pass' and 'fail' instead of 'passed' and 'failed'. Keeps output a bit more concise. * Fixed a doxygen comment spelling error. :P
Diffstat (limited to 'lib/libalpm/package.c')
-rw-r--r--lib/libalpm/package.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index e979af63..f7753d7c 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -567,7 +567,7 @@ void _alpm_pkg_update_requiredby(pmpkg_t *pkg)
}
}
-const char *alpm_pkg_get_filename(pmpkg_t *pkg)
+const char SYMEXPORT *alpm_pkg_get_filename(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
@@ -577,10 +577,15 @@ const char *alpm_pkg_get_filename(pmpkg_t *pkg)
if(!strlen(pkg->filename)) {
/* construct the file name, it's not in the desc file */
+ if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
+ _alpm_db_read(pkg->data, pkg, INFRQ_DESC);
+ }
if(pkg->arch && strlen(pkg->arch) > 0) {
- snprintf(pkg->filename, PKG_FILENAME_LEN, "%s-%s-%s" PM_EXT_PKG, pkg->name, pkg->version, pkg->arch);
+ snprintf(pkg->filename, PKG_FILENAME_LEN, "%s-%s-%s" PM_EXT_PKG,
+ pkg->name, pkg->version, pkg->arch);
} else {
- snprintf(pkg->filename, PKG_FILENAME_LEN, "%s-%s" PM_EXT_PKG, pkg->name, pkg->version);
+ snprintf(pkg->filename, PKG_FILENAME_LEN, "%s-%s" PM_EXT_PKG,
+ pkg->name, pkg->version);
}
}
@@ -589,19 +594,29 @@ const char *alpm_pkg_get_filename(pmpkg_t *pkg)
const char SYMEXPORT *alpm_pkg_get_name(pmpkg_t *pkg)
{
+ ALPM_LOG_FUNC;
+
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
+ if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_BASE)) {
+ _alpm_db_read(pkg->data, pkg, INFRQ_BASE);
+ }
return pkg->name;
}
const char SYMEXPORT *alpm_pkg_get_version(pmpkg_t *pkg)
{
+ ALPM_LOG_FUNC;
+
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
+ if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_BASE)) {
+ _alpm_db_read(pkg->data, pkg, INFRQ_BASE);
+ }
return pkg->version;
}
@@ -649,6 +664,8 @@ const char SYMEXPORT *alpm_pkg_get_builddate(pmpkg_t *pkg)
const char SYMEXPORT *alpm_pkg_get_buildtype(pmpkg_t *pkg)
{
+ ALPM_LOG_FUNC;
+
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
@@ -929,6 +946,7 @@ unsigned short SYMEXPORT alpm_pkg_has_scriptlet(pmpkg_t *pkg)
return pkg->scriptlet;
}
+/* TODO this should either be public, or done somewhere else */
int _alpm_pkg_istoonew(pmpkg_t *pkg)
{
time_t t;