summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-04-03 10:19:10 +0200
committerAurelien Foret <aurelien@archlinux.org>2005-04-03 10:19:10 +0200
commita98c5c25b5373e1e05b972d2db891e8c6a85b1c8 (patch)
tree45e0ef1e7b83440a89f9c39efc71ba5ee5d3088f
parentd9a96064ab6a8d7279984d662a4ed478401aefe8 (diff)
downloadpacman-a98c5c25b5373e1e05b972d2db891e8c6a85b1c8.tar.gz
pacman-a98c5c25b5373e1e05b972d2db891e8c6a85b1c8.tar.xz
- added transaction flags for the removal of a package to be upgrade
- reworked some comments
-rw-r--r--lib/libalpm/add.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 1cb73e73..07b16dec 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -252,8 +252,8 @@ int add_commit(pmdb_t *db, pmtrans_t *trans)
/* we'll need the full record for backup checks later */
/* ORE
- in fact, there's only a need for "backup" and "md5sum" fields, so
- we should only copy these 2 ones from info, and thus save a call
+ in fact, there's only a need for "version", "backup" and "reason" fields,
+ so we should only copy them from the cache, and thus save a call
to db_scan(ALL) */
oldpkg = db_scan(db, info->name, INFRQ_ALL);
@@ -266,13 +266,11 @@ int add_commit(pmdb_t *db, pmtrans_t *trans)
pmtrans_t *tr;
_alpm_log(PM_LOG_FLOW1, "removing old package first");
- /* ORE
- set flags to something, but what (nodeps?) ??? */
tr = trans_new();
if(tr == NULL) {
RET_ERR(PM_ERR_TRANS_ABORT, -1);
}
- if(trans_init(tr, PM_TRANS_TYPE_UPGRADE, 0, NULL) == -1) {
+ if(trans_init(tr, PM_TRANS_TYPE_UPGRADE, trans->flags, NULL) == -1) {
FREETRANS(tr);
RET_ERR(PM_ERR_TRANS_ABORT, -1);
}
@@ -347,16 +345,16 @@ int add_commit(pmdb_t *db, pmtrans_t *trans)
alpm_logaction(NULL, "error updating database for %s-%s!", info->name, info->version);
RET_ERR(PM_ERR_DB_WRITE, -1);
}
-
/* ORE
in case of an installation, then add info in the pkgcache
in case of an upgrade, then replace the existing one (or just add because
- trans_remove should already has removed it? */
+ trans_remove should already has removed it?
+ something like db_cache_addpkg(db, pkgdup(info)); (should also free db->grpcache) */
/* update dependency packages' REQUIREDBY fields */
_alpm_log(PM_LOG_FLOW2, "updating dependency packages 'requiredby' fields");
for(lp = info->depends; lp; lp = lp->next) {
- pmpkg_t *depinfo = NULL;
+ pmpkg_t *depinfo;
pmdepend_t depend;
if(splitdep(lp->data, &depend)) {
@@ -373,6 +371,9 @@ int add_commit(pmdb_t *db, pmtrans_t *trans)
cache, thus eliminating the need for db_scan(DEPENDS) */
PMList *provides = _alpm_db_whatprovides(db, depend.name);
if(provides) {
+ /* TODO: should check _all_ packages listed in provides, not just
+ * the first one.
+ */
/* use the first one */
depinfo = db_scan(db, ((pmpkg_t *)provides->data)->name, INFRQ_DESC|INFRQ_DEPENDS);
FREELISTPTR(provides);