diff options
author | Nagy Gabor <ngaba@bibl.u-szeged.hu> | 2008-03-10 15:38:08 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-03-10 18:57:36 -0500 |
commit | d060e31be3586ce27382f80eaed7a9edf2c86aeb (patch) | |
tree | 2e7ded6300e22445e539a8ea913a9f296e0739eb | |
parent | f56f7ff39102dab754573b0bc40dbceb5a8ec301 (diff) | |
download | pacman-d060e31be3586ce27382f80eaed7a9edf2c86aeb.tar.xz |
Remove trans->targets
Its implementation was quite broken:
* add_loadtarget() might have silently filtered out some targets when
replacing an older version.
* This was used in sync.c to determine whether a target is implicit or not,
which is incorrect behavior. Before this patch we silently removed user
confirmed replacements; now we always warn on a replacement.
* remove001.py behavior was quite odd in adding same target 5 times to the
target list, we can change this behavior to be a failure.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Xav: changed remove001 pactest accordingly]
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: rewrote commit message]
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | lib/libalpm/add.c | 2 | ||||
-rw-r--r-- | lib/libalpm/alpm.h | 1 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 11 | ||||
-rw-r--r-- | lib/libalpm/trans.c | 18 | ||||
-rw-r--r-- | lib/libalpm/trans.h | 1 | ||||
-rw-r--r-- | pactest/tests/remove001.py | 5 |
6 files changed, 7 insertions, 31 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 6c0a1eae..4d8e1a03 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -848,7 +848,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db) return(0); } - pkg_count = alpm_list_count(trans->targets); + pkg_count = alpm_list_count(trans->packages); pkg_current = 1; /* loop through our package list adding/upgrading one at a time */ diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 7a16772a..8e8446a2 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -345,7 +345,6 @@ typedef void (*alpm_trans_cb_progress)(pmtransprog_t, const char *, int, int, in pmtranstype_t alpm_trans_get_type(); unsigned int alpm_trans_get_flags(); -alpm_list_t * alpm_trans_get_targets(); alpm_list_t * alpm_trans_get_pkgs(); int alpm_trans_init(pmtranstype_t type, pmtransflag_t flags, alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv, diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 2bd9c529..26d1d3ca 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -509,13 +509,10 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync goto cleanup; } - _alpm_log(PM_LOG_DEBUG, "removing '%s' from target list\n", rsync->pkg->name); - /* Only prints a warning if rsync is an explicit target. */ - if(alpm_list_find_str(trans->targets, rsync->pkg->name)) { - _alpm_log(PM_LOG_WARNING, - _("removing '%s' from target list because it conflicts with '%s'\n"), - rsync->pkg->name, sync->pkg->name); - } + /* Prints warning */ + _alpm_log(PM_LOG_WARNING, + _("removing '%s' from target list because it conflicts with '%s'\n"), + rsync->pkg->name, sync->pkg->name); void *vpkg; trans->packages = alpm_list_remove(trans->packages, rsync, syncpkg_cmp, &vpkg); diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 52dbe7a9..5836df5a 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -228,7 +228,6 @@ pmtrans_t *_alpm_trans_new() CALLOC(trans, 1, sizeof(pmtrans_t), RET_ERR(PM_ERR_MEMORY, NULL)); - trans->targets = NULL; trans->packages = NULL; trans->skip_add = NULL; trans->skip_remove = NULL; @@ -250,7 +249,6 @@ void _alpm_trans_free(pmtrans_t *trans) return; } - FREELIST(trans->targets); if(trans->type == PM_TRANS_TYPE_SYNC) { alpm_list_free_inner(trans->packages, (alpm_list_fn_free)_alpm_sync_free); } else if (trans->type == PM_TRANS_TYPE_REMOVE || @@ -308,11 +306,6 @@ int _alpm_trans_addtarget(pmtrans_t *trans, char *target) ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); ASSERT(target != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); - if(alpm_list_find_str(trans->targets, target)) { - return(0); - //RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1); - } - switch(trans->type) { case PM_TRANS_TYPE_ADD: case PM_TRANS_TYPE_UPGRADE: @@ -336,8 +329,6 @@ int _alpm_trans_addtarget(pmtrans_t *trans, char *target) break; } - trans->targets = alpm_list_add(trans->targets, strdup(target)); - return(0); } @@ -637,15 +628,6 @@ unsigned int SYMEXPORT alpm_trans_get_flags() return handle->trans->flags; } -alpm_list_t SYMEXPORT * alpm_trans_get_targets() -{ - /* Sanity checks */ - ASSERT(handle != NULL, return(NULL)); - ASSERT(handle->trans != NULL, return(NULL)); - - return handle->trans->targets; -} - alpm_list_t SYMEXPORT * alpm_trans_get_pkgs() { /* Sanity checks */ diff --git a/lib/libalpm/trans.h b/lib/libalpm/trans.h index 75608ce4..d74c3e90 100644 --- a/lib/libalpm/trans.h +++ b/lib/libalpm/trans.h @@ -39,7 +39,6 @@ struct __pmtrans_t { pmtranstype_t type; pmtransflag_t flags; pmtransstate_t state; - alpm_list_t *targets; /* list of (char *) */ alpm_list_t *packages; /* list of (pmpkg_t *) or (pmsyncpkg_t *) */ alpm_list_t *skip_add; /* list of (char *) */ alpm_list_t *skip_remove; /* list of (char *) */ diff --git a/pactest/tests/remove001.py b/pactest/tests/remove001.py index 809bfdb7..d20dd079 100644 --- a/pactest/tests/remove001.py +++ b/pactest/tests/remove001.py @@ -1,4 +1,3 @@ -# If someone else can come up with a better name, please do so self.description = "Remove a package listed 5 times" p = pmpkg("foo") @@ -6,5 +5,5 @@ self.addpkg2db("local", p) self.args = "-R " + "foo "*5 -self.addrule("PACMAN_RETCODE=0") -self.addrule("!PKG_EXISTS=foo") +self.addrule("PACMAN_RETCODE=1") +self.addrule("PKG_EXISTS=foo") |