summaryrefslogtreecommitdiff
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
parente668b471426d7c8c406ace6ad05d0c5aefc56dea (diff)
* 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.
-rw-r--r--lib/libalpm/Makefile.am4
-rw-r--r--lib/libalpm/add.c32
-rw-r--r--lib/libalpm/deps.c13
-rw-r--r--lib/libalpm/util.c4
-rwxr-xr-xscripts/makeworld2
-rw-r--r--src/pacman/sync.c1
6 files changed, 35 insertions, 21 deletions
diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am
index 037bcff4..eb8d788f 100644
--- a/lib/libalpm/Makefile.am
+++ b/lib/libalpm/Makefile.am
@@ -1,8 +1,6 @@
AUTOMAKE_OPTIONS = gnu
DEFINES = -pedantic -D_GNU_SOURCE
-#libalpm isn't fully C99 safe with the strict aliasing rules
-# to be fixed in the future
-AM_CFLAGS = $(DEFINES) -fno-strict-aliasing
+AM_CFLAGS = $(DEFINES)
SUBDIRS = po
localedir = $(datadir)/locale
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;
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 0b4af443..0de9b930 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -106,6 +106,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int mode)
int change = 1;
int numscans = 0;
int numtargs = 0;
+ int maxscans;
if(targets == NULL) {
return(NULL);
@@ -116,15 +117,13 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int mode)
numtargs++;
}
+ maxscans = (int)sqrt(numtargs);
+
_alpm_log(PM_LOG_DEBUG, _("started sorting dependencies"));
while(change) {
alpm_list_t *tmptargs = NULL;
change = 0;
- /* TODO only use of a math.h function in entire libalpm,
- * can we get rid of it? Former code line:
- *if(numscans > numtargs) {
- */
- if(numscans > sqrt(numtargs)) {
+ if(numscans > maxscans) {
_alpm_log(PM_LOG_DEBUG, _("possible dependency cycle detected"));
continue;
}
@@ -321,9 +320,9 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op,
/* else if still not found... */
if(!found) {
_alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as a dependency for %s"),
- depend.name, tp->name);
+ depend.name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_DEPEND, depend.mod,
- depend.name, depend.version);
+ depend.name, depend.version);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = alpm_list_add(baddeps, miss);
} else {
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index ce3bc85b..29d3ad56 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -359,8 +359,8 @@ int _alpm_logaction(unsigned short usesyslog, FILE *f, const char *str)
/* Use ISO-8601 date format */
fprintf(f, "[%04d-%02d-%02d %02d:%02d] %s\n",
- tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
- tm->tm_hour, tm->tm_min, str);
+ tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
+ tm->tm_hour, tm->tm_min, str);
fflush(f);
}
diff --git a/scripts/makeworld b/scripts/makeworld
index 597e0b7a..99dfff0b 100755
--- a/scripts/makeworld
+++ b/scripts/makeworld
@@ -148,7 +148,7 @@ for category in $*; do
fi
done
done
-ed=`date +"[%b %d %H:%M]"`
+ed=$(date +"[%b %d %H:%M]")
echo "makeworld complete." >>$toplevel/build.log
echo " started: $sd" >>$toplevel/build.log
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 9054d5ee..36bc22f5 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -526,7 +526,6 @@ int pacman_sync(alpm_list_t *targets)
found++;
MSG(NL, _(":: group %s:\n"), targ);
/* remove dupe entries in case a package exists in multiple repos */
- /* (the dupe function takes a pmlist_t* and returns a list_t*) */
alpm_list_t *pkgs = alpm_list_remove_dupes(alpm_grp_get_packages(grp));
list_display(" ", pkgs);
if(yesno(_(":: Install whole content? [Y/n] "))) {