summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-02-21 08:34:36 +0000
committerDan McGee <dan@archlinux.org>2007-02-21 08:34:36 +0000
commita5f630fda6ef984b39c867da28c3eeef8abbb30d (patch)
tree550a0c096fda4bceccf2ff70c3b156d2ca4f492c
parent829ac8369b49219c988bb7553a3093615ddcb76d (diff)
downloadpacman-a5f630fda6ef984b39c867da28c3eeef8abbb30d.tar.xz
* Fixed inconsistency of args- _alpm_db_read, _alpm_db_write.
-rw-r--r--TODO.dan2
-rw-r--r--lib/libalpm/be_files.c6
-rw-r--r--lib/libalpm/cache.c2
-rw-r--r--lib/libalpm/db.h2
-rw-r--r--lib/libalpm/deps.c12
-rw-r--r--lib/libalpm/package.c48
-rw-r--r--lib/libalpm/trans.c4
7 files changed, 37 insertions, 39 deletions
diff --git a/TODO.dan b/TODO.dan
index 6369c00d..292e021a 100644
--- a/TODO.dan
+++ b/TODO.dan
@@ -112,8 +112,6 @@ Revamp the downloadprog function a bit. Seems kind of messy.
Add localized pkgdesc variables to makepkg.
-Fix inconsistency of args- _alpm_db_read, _alpm_db_write
-
--print-uri option to sync should not require saying yes or no to up to date
Add testing scripts to pactest for issues we have been working on (especially
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index dad81972..faa1f300 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -183,7 +183,7 @@ pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, pmdbinfrq_t inforeq)
_alpm_log(PM_LOG_ERROR, _("invalid name for dabatase entry '%s'"), ent->d_name);
return(NULL);
}
- if(_alpm_db_read(db, inforeq, pkg) == -1) {
+ if(_alpm_db_read(db, pkg, inforeq) == -1) {
/* TODO removed corrupt entry from the FS here */
FREEPKG(pkg);
}
@@ -193,7 +193,7 @@ pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, pmdbinfrq_t inforeq)
return(pkg);
}
-int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
+int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
{
FILE *fp = NULL;
struct stat buf;
@@ -471,7 +471,7 @@ error:
return(-1);
}
-int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
+int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
{
FILE *fp = NULL;
char path[PATH_MAX];
diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c
index 41038fe3..456c98bd 100644
--- a/lib/libalpm/cache.c
+++ b/lib/libalpm/cache.c
@@ -124,7 +124,7 @@ int _alpm_db_ensure_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel)
for(p = db->pkgcache; p; p = p->next) {
pmpkg_t *pkg = (pmpkg_t *)p->data;
if(infolevel != INFRQ_NONE && !(pkg->infolevel & infolevel)) {
- if(_alpm_db_read(db, infolevel, pkg) == -1) {
+ if(_alpm_db_read(db, pkg, infolevel) == -1) {
/* TODO should we actually remove from the filesystem here as well? */
_alpm_db_remove_pkgfromcache(db, pkg);
} else {
diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h
index a37f3ce7..9c4645f8 100644
--- a/lib/libalpm/db.h
+++ b/lib/libalpm/db.h
@@ -59,7 +59,7 @@ int _alpm_db_open(pmdb_t *db);
void _alpm_db_close(pmdb_t *db);
void _alpm_db_rewind(pmdb_t *db);
pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, pmdbinfrq_t inforeq);
-int _alpm_db_read(pmdb_t *db, pmdbinfrq_t inforeq, pmpkg_t *info);
+int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
int _alpm_db_remove(pmdb_t *db, pmpkg_t *info);
int _alpm_db_getlastupdate(pmdb_t *db, char *ts);
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 99056071..d6aabaca 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -223,7 +223,7 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op,
_alpm_log(PM_LOG_DEBUG, _("cannot find package installed '%s'"), tp->name);
continue;
}
- _alpm_db_read(db, INFRQ_DEPENDS, oldpkg);
+ _alpm_db_read(db, oldpkg, INFRQ_DEPENDS);
for(j = oldpkg->requiredby; j; j = j->next) {
pmpkg_t *p;
found = 0;
@@ -235,7 +235,7 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op,
/* this package also in the upgrade list, so don't worry about it */
continue;
}
- _alpm_db_read(db, INFRQ_DEPENDS, p);
+ _alpm_db_read(db, p, INFRQ_DEPENDS);
for(k = p->depends; k && !found; k = k->next) {
/* find the dependency info in p->depends */
_alpm_splitdep(k->data, &depend);
@@ -278,7 +278,7 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op,
/* ensure package has depends data */
pmdb_t *pkgdb = tp->data;
- _alpm_db_read(pkgdb, INFRQ_DEPENDS, tp);
+ _alpm_db_read(pkgdb, tp, INFRQ_DEPENDS);
if(!tp->depends) {
_alpm_log(PM_LOG_DEBUG, _("no dependencies for target '%s'"), tp->name);
}
@@ -503,7 +503,7 @@ alpm_list_t *_alpm_removedeps(pmdb_t *db, alpm_list_t *targs)
pmpkg_t *provpkg = k->data;
if(can_remove_package(db, provpkg, newtargs)) {
pmpkg_t *pkg = _alpm_pkg_new(provpkg->name, provpkg->version);
- _alpm_db_read(db, INFRQ_ALL, pkg);
+ _alpm_db_read(db, pkg, INFRQ_ALL);
_alpm_log(PM_LOG_DEBUG, _("adding '%s' to the targets"), pkg->name);
@@ -515,7 +515,7 @@ alpm_list_t *_alpm_removedeps(pmdb_t *db, alpm_list_t *targs)
FREELISTPTR(provides);
} else if(can_remove_package(db, dep, newtargs)) {
pmpkg_t *pkg = _alpm_pkg_new(dep->name, dep->version);
- _alpm_db_read(db, INFRQ_ALL, pkg);
+ _alpm_db_read(db, pkg, INFRQ_ALL);
_alpm_log(PM_LOG_DEBUG, _("adding '%s' to the targets"), pkg->name);
@@ -579,7 +579,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
/* check literals */
for(j = dbs_sync; !sync && j; j = j->next) {
sync = _alpm_db_get_pkgfromcache(j->data, miss->depend.name);
- _alpm_db_read(j->data, INFRQ_DEPENDS, sync);
+ _alpm_db_read(j->data, sync, INFRQ_DEPENDS);
}
/* check provides */
for(j = dbs_sync; !sync && j; j = j->next) {
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 93e3aa9c..d5738703 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -137,7 +137,7 @@ int alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg)
if(pkg->origin == PKG_FROM_CACHE) {
/* ensure we have the /desc file, which contains the 'force' option */
- _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DESC);
}
/* compare versions and see if we need to upgrade */
@@ -598,7 +598,7 @@ const char SYMEXPORT *alpm_pkg_get_desc(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
- _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DESC);
}
return pkg->desc;
}
@@ -612,7 +612,7 @@ const char SYMEXPORT *alpm_pkg_get_url(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
- _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DESC);
}
return pkg->url;
}
@@ -626,7 +626,7 @@ const char SYMEXPORT *alpm_pkg_get_builddate(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
- _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DESC);
}
return pkg->builddate;
}
@@ -638,7 +638,7 @@ const char SYMEXPORT *alpm_pkg_get_buildtype(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
- _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DESC);
}
return pkg->buildtype;
}
@@ -652,7 +652,7 @@ const char SYMEXPORT *alpm_pkg_get_installdate(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
- _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DESC);
}
return pkg->installdate;
}
@@ -666,7 +666,7 @@ const char SYMEXPORT *alpm_pkg_get_packager(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
- _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DESC);
}
return pkg->packager;
}
@@ -680,7 +680,7 @@ const char SYMEXPORT *alpm_pkg_get_md5sum(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
- _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DESC);
}
return pkg->md5sum;
}
@@ -694,7 +694,7 @@ const char SYMEXPORT *alpm_pkg_get_sha1sum(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
- _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DESC);
}
return pkg->sha1sum;
}
@@ -708,7 +708,7 @@ const char SYMEXPORT *alpm_pkg_get_arch(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
- _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DESC);
}
return pkg->arch;
}
@@ -722,7 +722,7 @@ unsigned long SYMEXPORT alpm_pkg_get_size(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(-1));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
- _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DESC);
}
return pkg->size;
}
@@ -736,7 +736,7 @@ unsigned long SYMEXPORT alpm_pkg_get_isize(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(-1));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
- _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DESC);
}
return pkg->isize;
}
@@ -750,7 +750,7 @@ pmpkgreason_t SYMEXPORT alpm_pkg_get_reason(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(-1));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
- _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DESC);
}
return pkg->reason;
}
@@ -764,7 +764,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_licenses(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
- _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DESC);
}
return pkg->license;
}
@@ -778,7 +778,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_groups(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
- _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DESC);
}
return pkg->groups;
}
@@ -793,7 +793,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_depends(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DEPENDS)) {
- _alpm_db_read(pkg->data, INFRQ_DEPENDS, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DEPENDS);
}
return pkg->depends;
}
@@ -807,7 +807,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_removes(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DEPENDS)) {
- _alpm_db_read(pkg->data, INFRQ_DEPENDS, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DEPENDS);
}
return pkg->removes;
}
@@ -821,7 +821,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_requiredby(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DEPENDS)) {
- _alpm_db_read(pkg->data, INFRQ_DEPENDS, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DEPENDS);
}
return pkg->requiredby;
}
@@ -835,7 +835,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_conflicts(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DEPENDS)) {
- _alpm_db_read(pkg->data, INFRQ_DEPENDS, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DEPENDS);
}
return pkg->conflicts;
}
@@ -849,7 +849,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_provides(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DEPENDS)) {
- _alpm_db_read(pkg->data, INFRQ_DEPENDS, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DEPENDS);
}
return pkg->provides;
}
@@ -863,7 +863,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_replaces(pmpkg_t *pkg)
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DEPENDS)) {
- _alpm_db_read(pkg->data, INFRQ_DEPENDS, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_DEPENDS);
}
return pkg->replaces;
}
@@ -878,7 +878,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_files(pmpkg_t *pkg)
if(pkg->origin == PKG_FROM_CACHE && pkg->data == handle->db_local
&& !(pkg->infolevel & INFRQ_FILES)) {
- _alpm_db_read(pkg->data, INFRQ_FILES, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_FILES);
}
return pkg->files;
}
@@ -893,7 +893,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_backup(pmpkg_t *pkg)
if(pkg->origin == PKG_FROM_CACHE && pkg->data == handle->db_local
&& !(pkg->infolevel & INFRQ_FILES)) {
- _alpm_db_read(pkg->data, INFRQ_FILES, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_FILES);
}
return pkg->backup;
}
@@ -908,7 +908,7 @@ unsigned short SYMEXPORT alpm_pkg_has_scriptlet(pmpkg_t *pkg)
if(pkg->origin == PKG_FROM_CACHE && pkg->data == handle->db_local
&& !(pkg->infolevel & INFRQ_SCRIPTLET)) {
- _alpm_db_read(pkg->data, INFRQ_SCRIPTLET, pkg);
+ _alpm_db_read(pkg->data, pkg, INFRQ_SCRIPTLET);
}
return pkg->scriptlet;
}
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 64cb47c5..0bbc260e 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -294,7 +294,7 @@ int _alpm_trans_update_depends(pmtrans_t *trans, pmpkg_t *pkg)
found_provides = 1;
/* Ensure package has the right newpkg */
- _alpm_db_read(localdb, INFRQ_DEPENDS, deppkg);
+ _alpm_db_read(localdb, deppkg, INFRQ_DEPENDS);
_alpm_log(PM_LOG_DEBUG, _("updating 'requiredby' field for package '%s'"), deppkg->name);
if(trans->type == PM_TRANS_TYPE_REMOVE) {
@@ -318,7 +318,7 @@ int _alpm_trans_update_depends(pmtrans_t *trans, pmpkg_t *pkg)
}
/* Ensure package has the right newpkg */
- _alpm_db_read(localdb, INFRQ_DEPENDS, deppkg);
+ _alpm_db_read(localdb, deppkg, INFRQ_DEPENDS);
_alpm_log(PM_LOG_DEBUG, _("updating 'requiredby' field for package '%s'"), deppkg->name);
if(trans->type == PM_TRANS_TYPE_REMOVE) {