[pacman-dev] CVS update of pacman-lib (6 files)
Date: Tuesday, January 30, 2007 @ 00:41:13 Author: dan Path: /home/cvs-pacman/pacman-lib Modified: lib/libalpm/Makefile.am (1.15 -> 1.16) lib/libalpm/add.c (1.104 -> 1.105) lib/libalpm/deps.c (1.60 -> 1.61) lib/libalpm/util.c (1.41 -> 1.42) scripts/makeworld (1.6 -> 1.7) src/pacman/sync.c (1.100 -> 1.101) * 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. -------------------------+ lib/libalpm/Makefile.am | 4 +--- lib/libalpm/add.c | 32 +++++++++++++++++++++++++------- lib/libalpm/deps.c | 13 ++++++------- lib/libalpm/util.c | 4 ++-- scripts/makeworld | 2 +- src/pacman/sync.c | 1 - 6 files changed, 35 insertions(+), 21 deletions(-) Index: pacman-lib/lib/libalpm/Makefile.am diff -u pacman-lib/lib/libalpm/Makefile.am:1.15 pacman-lib/lib/libalpm/Makefile.am:1.16 --- pacman-lib/lib/libalpm/Makefile.am:1.15 Mon Jan 29 17:18:31 2007 +++ pacman-lib/lib/libalpm/Makefile.am Tue Jan 30 00:41:13 2007 @@ -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 Index: pacman-lib/lib/libalpm/add.c diff -u pacman-lib/lib/libalpm/add.c:1.104 pacman-lib/lib/libalpm/add.c:1.105 --- pacman-lib/lib/libalpm/add.c:1.104 Mon Jan 29 22:46:33 2007 +++ pacman-lib/lib/libalpm/add.c Tue Jan 30 00:41:13 2007 @@ -211,9 +211,12 @@ } -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 @@ /* 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; Index: pacman-lib/lib/libalpm/deps.c diff -u pacman-lib/lib/libalpm/deps.c:1.60 pacman-lib/lib/libalpm/deps.c:1.61 --- pacman-lib/lib/libalpm/deps.c:1.60 Mon Jan 29 22:46:33 2007 +++ pacman-lib/lib/libalpm/deps.c Tue Jan 30 00:41:13 2007 @@ -106,6 +106,7 @@ int change = 1; int numscans = 0; int numtargs = 0; + int maxscans; if(targets == NULL) { return(NULL); @@ -116,15 +117,13 @@ 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 @@ /* 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 { Index: pacman-lib/lib/libalpm/util.c diff -u pacman-lib/lib/libalpm/util.c:1.41 pacman-lib/lib/libalpm/util.c:1.42 --- pacman-lib/lib/libalpm/util.c:1.41 Thu Jan 25 20:33:03 2007 +++ pacman-lib/lib/libalpm/util.c Tue Jan 30 00:41:13 2007 @@ -359,8 +359,8 @@ /* 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); } Index: pacman-lib/scripts/makeworld diff -u pacman-lib/scripts/makeworld:1.6 pacman-lib/scripts/makeworld:1.7 --- pacman-lib/scripts/makeworld:1.6 Thu Jan 25 21:13:16 2007 +++ pacman-lib/scripts/makeworld Tue Jan 30 00:41:13 2007 @@ -148,7 +148,7 @@ 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 Index: pacman-lib/src/pacman/sync.c diff -u pacman-lib/src/pacman/sync.c:1.100 pacman-lib/src/pacman/sync.c:1.101 --- pacman-lib/src/pacman/sync.c:1.100 Mon Jan 29 22:46:34 2007 +++ pacman-lib/src/pacman/sync.c Tue Jan 30 00:41:13 2007 @@ -526,7 +526,6 @@ 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] "))) {
participants (1)
-
dan@archlinux.org