From fa090373fc83cc925f6391bdeb0b059e4e2b6e7a Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Thu, 14 Jul 2005 13:04:59 +0000 Subject: [PATCH] 2002-02-07 Havoc Pennington Author: hp Date: 2002-02-07 19:54:49 GMT 2002-02-07 Havoc Pennington * autogen.sh: patch gslist.c so that it has a stable sort function, so we don't utterly mangle the order of the libraries on the link line. --- ChangeLog | 6 ++++++ autogen.sh | 3 +++ pkg.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 62 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3632ea1..ff2842c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-02-07 Havoc Pennington + + * autogen.sh: patch gslist.c so that it has a stable sort + function, so we don't utterly mangle the order of the libraries on + the link line. + 2002-02-03 Havoc Pennington * configure.in: 0.10.0 diff --git a/autogen.sh b/autogen.sh index 77f794a..fd6286a 100755 --- a/autogen.sh +++ b/autogen.sh @@ -59,6 +59,9 @@ perl -p -i.bak -e "s/[a-zA-Z0-9]+_DATA/noinst_DATA/g" `find glib-1.2.8 -name Mak perl -p -i.bak -e "s/info_TEXINFOS/noinst_TEXINFOS/g" `find glib-1.2.8 -name Makefile.am` perl -p -i.bak -e "s/man_MANS/noinst_MANS/g" `find glib-1.2.8 -name Makefile.am` +## patch gslist.c to have stable sort +perl -p -w -i.bak -e 's/if \(compare_func\(l1->data,l2->data\) < 0\)/if \(compare_func\(l1->data,l2->data\) <= 0\)/g' glib-1.2.8/gslist.c + (cd glib-1.2.8 && libtoolize --copy --force && $ACLOCAL $ACLOCAL_FLAGS && $AUTOMAKE && autoconf) if test -z "$*"; then diff --git a/pkg.c b/pkg.c index 3c581c2..50450eb 100644 --- a/pkg.c +++ b/pkg.c @@ -331,6 +331,10 @@ string_list_strip_duplicates (GSList *list) nodups = g_slist_prepend (nodups, tmp->data); g_hash_table_insert (table, tmp->data, tmp->data); } + else + { + debug_spew (" removing duplicate \"%s\"\n", tmp->data); + } tmp = g_slist_next (tmp); } @@ -363,7 +367,11 @@ string_list_strip_duplicates_from_back (GSList *list) nodups = g_slist_prepend (nodups, tmp->data); g_hash_table_insert (table, tmp->data, tmp->data); } - + else + { + debug_spew (" removing duplicate (from back) \"%s\"\n", tmp->data); + } + tmp = g_slist_next (tmp); } @@ -433,7 +441,7 @@ pathposcmp (gconstpointer a, gconstpointer b) { const Package *pa = a; const Package *pb = b; - + if (pa->path_position < pb->path_position) return -1; else if (pa->path_position > pb->path_position) @@ -442,6 +450,41 @@ pathposcmp (gconstpointer a, gconstpointer b) return 0; } +static void +spew_package_list (const char *name, + GSList *list) +{ + GSList *tmp; + + debug_spew (" %s: ", name); + + tmp = list; + while (tmp != NULL) + { + Package *pkg = tmp->data; + debug_spew (" %s ", pkg->name); + tmp = tmp->next; + } + debug_spew ("\n"); +} + +static void +spew_string_list (const char *name, + GSList *list) +{ + GSList *tmp; + + debug_spew (" %s: ", name); + + tmp = list; + while (tmp != NULL) + { + debug_spew (" %s ", tmp->data); + tmp = tmp->next; + } + debug_spew ("\n"); +} + static GSList* packages_sort_by_path_position (GSList *list) { @@ -488,8 +531,12 @@ fill_list_in_path_order_single_package (Package *pkg, GetListFunc func, packages = g_slist_append (packages, pkg); recursive_fill_list (pkg, get_requires, &packages); + spew_package_list ("original", packages); + packages = packages_sort_by_path_position (packages); + spew_package_list ("sorted", packages); + tmp = packages; while (tmp != NULL) { @@ -518,8 +565,12 @@ fill_list_in_path_order (GSList *packages, GetListFunc func, tmp = tmp->next; } + spew_package_list ("original", expanded); + expanded = packages_sort_by_path_position (expanded); + spew_package_list ("sorted", expanded); + tmp = expanded; while (tmp != NULL) { -- 2.39.5