summaryrefslogtreecommitdiff
path: root/lib/libalpm/add.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-01-30 05:41:13 +0000
committerDan McGee <dan@archlinux.org>2007-01-30 05:41:13 +0000
commit0bc06918e4b93cae874c09f4b1d487865ca44fbd (patch)
treea10a1a774d49fb06b42b60eaa072a85889b8e88a /lib/libalpm/add.c
parente668b471426d7c8c406ace6ad05d0c5aefc56dea (diff)
downloadpacman-0bc06918e4b93cae874c09f4b1d487865ca44fbd.tar.xz
* Remove -fno-strict-aliasing as it is now unnecessary to compile.
* Fix up add.c a bit better than it was in regards to FS #3492. * Optimized the sqrt call in dependency cycle checking to a single call. * Removal of an outdated comment.
Diffstat (limited to 'lib/libalpm/add.c')
-rw-r--r--lib/libalpm/add.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 678da620..f034131b 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -211,9 +211,12 @@ error:
}
-static int name_cmp(const void *p1, const void *p2)
+/* This is still messy. We have a lot of compare functions, and we should
+ * try to consolidate them as much as we can (between add and sync) */
+static int pkg_cmp(const void *p1, const void *p2)
{
- return(strcmp(((pmpkg_t *)p1)->name, (const char *)p2));
+ return(strcmp(((pmdepmissing_t *)p1)->target,
+ ((pmdepmissing_t *)p2)->target));
}
int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
@@ -253,11 +256,26 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
/* Attempt to resolve conflicts */
QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, miss->target, miss->depend.name, NULL, &skip_this);
if(skip_this) {
- pmpkg_t **pkg = NULL;
- lp = alpm_list_remove(lp, (void *)miss->depend.name, name_cmp, (void **)pkg);
- FREEPKG(*pkg);
- }
- }
+ pmdepmissing_t *pkg = NULL;
+ lp = alpm_list_remove(lp, (void *)miss, pkg_cmp, (void*)&pkg);
+ /* TODO: We remove the conflict from the list but never actually remove
+ * the package. Need to do this to fix FS #3492. The sync code should
+ * provide an example of how to do this, as it handles replaces and
+ * removes. We run into problems because we do a file conflict check
+ * below and it fails there. A force flag will skip that part, but
+ * still not remove the original package designated here for removal.
+ * Better yet, dump all this shitty duplicate code and somehow combine
+ * it with the sync code. */
+ FREE(pkg);
+ if(lp == NULL) {
+ break;
+ }
+ }
+ }
+ /* Removal code should go here, as described above. Instead of simply
+ * removing items, perhaps throw them in another list to be removed, then
+ * proceed as sync.c would? I'm not sure because I'm not familiar enough
+ * with the codebase. */
if(lp != NULL) {
if(data) {
*data = lp;