diff options
author | Eskil Heyn Olsen <eskil@src.gnome.org> | 2001-03-11 08:20:09 +0000 |
---|---|---|
committer | Eskil Heyn Olsen <eskil@src.gnome.org> | 2001-03-11 08:20:09 +0000 |
commit | 68e5ae925e92473cc6d88258480547f4d4c32e99 (patch) | |
tree | 75485b1dd02a001ab8caebe102e4f9e0da5201d2 | |
parent | 98378c480999840aa737d648c178b2d06310644c (diff) | |
download | nautilus-68e5ae925e92473cc6d88258480547f4d4c32e99.tar.gz |
Eskil Olsen <eskil@eazel.com>
reviewed by: Robey Pointer
Fixes 7647, cases where a devel package could prevent
a package from getting upgraded.
Fixes 7652, mysterious memoryalteration caused hash
lookup to misfire and thereby causes recursive
dependencies.
Commit ok'ed by Don friday evening.
* components/services/install/lib/eazel-install-logic2.c:
(add_to_dedupe_hash),
Don't insert into hash if already there.
g_strdup key.
(post_get_softcat_info),
Changed debug message.
(dedupe_foreach_depends),
Changed debug message.
(check_if_related_package),
Two packages with different versions can never be related.
(check_tree_helper),
Allow file conflicts on related packages.
Don't insert package into extra's if already there.
Added comments.
(clean_up_dedupe_hash):
Free the key.
* components/services/install/lib/eazel-install-problem.c:
(get_detailed_messages_foreach):
Removed SoftCat references.
* components/services/install/lib/eazel-softcat.c:
(eazel_softcat_query):
Code that is ifdeffed out to dump xml from softcat.
:w
-rw-r--r-- | ChangeLog | 35 | ||||
-rw-r--r-- | components/services/install/lib/eazel-install-logic2.c | 90 | ||||
-rw-r--r-- | components/services/install/lib/eazel-install-problem.c | 4 | ||||
-rw-r--r-- | components/services/install/lib/eazel-softcat.c | 6 |
4 files changed, 111 insertions, 24 deletions
@@ -1,3 +1,38 @@ +2001-03-10 Eskil Olsen <eskil@eazel.com> + + reviewed by: Robey Pointer + + Fixes 7647, cases where a devel package could prevent + a package from getting upgraded. + Fixes 7652, mysterious memoryalteration caused hash + lookup to misfire and thereby causes recursive + dependencies. + + Commit ok'ed by Don friday evening. + + * components/services/install/lib/eazel-install-logic2.c: + (add_to_dedupe_hash), + Don't insert into hash if already there. + g_strdup key. + (post_get_softcat_info), + Changed debug message. + (dedupe_foreach_depends), + Changed debug message. + (check_if_related_package), + Two packages with different versions can never be related. + (check_tree_helper), + Allow file conflicts on related packages. + Don't insert package into extra's if already there. + Added comments. + (clean_up_dedupe_hash): + Free the key. + * components/services/install/lib/eazel-install-problem.c: + (get_detailed_messages_foreach): + Removed SoftCat references. + * components/services/install/lib/eazel-softcat.c: + (eazel_softcat_query): + Code that is ifdeffed out to dump xml from softcat. + 2001-03-09 Robin * Slomkowski <rslomkow@eazel.com> * configure.in: upped version of control-center required to 1.3 diff --git a/components/services/install/lib/eazel-install-logic2.c b/components/services/install/lib/eazel-install-logic2.c index 7e4b3759e..f27817a34 100644 --- a/components/services/install/lib/eazel-install-logic2.c +++ b/components/services/install/lib/eazel-install-logic2.c @@ -548,13 +548,17 @@ static void add_to_dedupe_hash (EazelInstall *service, PackageData *package) { + if (g_hash_table_lookup (service->private->dedupe_hash, + package->md5) != NULL) { + return; + } #if EI2_DEBUG & 0x4 trilobite_debug ("(adding %p %s %s to dedupe)", package, package->name, package->md5); #endif gtk_object_ref (GTK_OBJECT (package)); g_hash_table_insert (service->private->dedupe_hash, - package->md5, + g_strdup (package->md5), package); } @@ -591,7 +595,7 @@ post_get_softcat_info (EazelInstall *service, /* Don't dedupe yourself */ if (p1 != (*package)) { #if EI2_DEBUG & 0x4 - trilobite_debug ("\tdeduping(a) %p %s to %p", *package, (*package)->name, p1); + trilobite_debug ("\tdeduping(a) %p %s is already at %p %s", *package, (*package)->name, p1, p1->name); #endif gtk_object_ref (GTK_OBJECT (p1)); @@ -801,7 +805,9 @@ dedupe_foreach_depends (PackageDependency *d, if (p11) { if (p11 != p1) { #if EI2_DEBUG & 0x4 - trilobite_debug ("\tdeduping(b) %p %s to %p", p11, p11->name, p1); + trilobite_debug ("\tdeduping(b) %s", p1->md5); + trilobite_debug ("\tdeduping(b) %s", p11->md5); + trilobite_debug ("\tdeduping(b) %p %s is already read at %p %s", p1, p1->name, p11, p11->name); #endif gtk_object_ref (GTK_OBJECT (p11)); gtk_object_unref (GTK_OBJECT (p1)); @@ -1583,6 +1589,16 @@ check_if_related_package (EazelInstall *service, dep, dep->name, dep->version); #endif + /* If the versions do not match, its not related */ + if (eazel_package_system_compare_version (service->private->package_system, + package->version, + dep->version) != 0) { +#if EI2_DEBUG & 0x4 + trilobite_debug ("versions do not match, not related"); +#endif + return FALSE; + } + dep_name_elements = g_strsplit (dep->name, "-", 80); mod_name_elements = g_strsplit (package->name, "-", 80); @@ -1752,20 +1768,27 @@ check_tree_helper (EazelInstall *service, #endif } #if EI2_DEBUG & 0x4 - trilobite_debug ("trying to revive %s", pack->name); + trilobite_debug ("trying to revive %p %s", pack, pack->name); #else g_message ("trying to revive %s", pack->name); #endif + /* Iterate over all the breakages registered so far */ for (iterator = pack->breaks; iterator; iterator = g_list_next (iterator)) { PackageBreaks *breakage = PACKAGEBREAKS (iterator->data); PackageData *pack_broken = packagebreaks_get_package (breakage); PackageData *pack_update = NULL; gboolean update_available = FALSE; - - if (check_if_modified_related_package (service, - pack, - pack_broken)) { + gboolean related = FALSE; + + related = check_if_modified_related_package (service, + pack, + pack_broken); + + /* If the packae we're operating on modifies somehthing that is related, + get an exact (matching) version instead of just checking for an + update. This is typicall for recovering from breaking a -devel package */ + if (related) { char *a, *b; a = packagedata_get_readable_name (pack); b = packagedata_get_readable_name (pack_broken); @@ -1775,24 +1798,24 @@ check_tree_helper (EazelInstall *service, g_message (_("%s is related to %s"), a, b); - /* Create the pack_update */ + /* Create the pack_update */ pack_update = packagedata_new (); pack_update->name = g_strdup (pack_broken->name); pack_update->version = g_strdup (pack->version); pack_update->distribution = pack_broken->distribution; pack_update->archtype = g_strdup (pack_broken->archtype); - /* Try and get the info */ + /* Try and get the info */ if (eazel_softcat_get_info (service->private->softcat, pack_update, EAZEL_SOFTCAT_SENSE_EQ, MUST_HAVE) != EAZEL_SOFTCAT_SUCCESS) { update_available = FALSE; - /* if we failed, delete the package object */ + /* if we failed, delete the package object */ gtk_object_unref (GTK_OBJECT (pack_update)); } else { - update_available = TRUE; + update_available = TRUE; } g_free (a); @@ -1805,6 +1828,10 @@ check_tree_helper (EazelInstall *service, MUST_HAVE); } + /* If we got the update, do the post_softcat_get_info check, + which sets the modifies list and checks for dupes in the + dedupe hash, also checks to see if a possible upgrade/downgrade + is allowed */ if (update_available) { if (post_get_softcat_info (service, &pack_update, SOFTCAT_HIT_OK) != SOFTCAT_HIT_OK) { @@ -1812,39 +1839,58 @@ check_tree_helper (EazelInstall *service, } } + /* So far so good... */ if (update_available) { gboolean proceed = TRUE; + + /* Now we need to see if the proposed package + resolves the current problem */ if (IS_PACKAGEFILECONFLICT (breakage)) { PackageFileConflict *conflict = PACKAGEFILECONFLICT (breakage); - if (!check_update_for_no_more_file_conflicts (conflict, pack_update)) { + /* If they're not related, check that the proposed update no + longer has the offending file(s). + If they're related, it will typically be foo and foo-devel with + same version number, and the double ownership of the file + will be ok */ + if (related==FALSE && check_update_for_no_more_file_conflicts (conflict, pack_update)==FALSE) { proceed = FALSE; } } else if (IS_PACKAGEFEATUREMISSING (breakage)) { PackageFeatureMissing *missing = PACKAGEFEATUREMISSING (breakage); - if (!check_for_no_more_missing_features (missing, pack_update)) { + /* Check that the package we're proposing to update to does not + require the feature that would be lost */ + if (check_for_no_more_missing_features (missing, pack_update)==FALSE) { proceed = FALSE; } } if (proceed) { + /* The proposed package did indeed resolve this problem... */ #if EI2_DEBUG & 0x4 - trilobite_debug ("adding %s to packages to be installed", + trilobite_debug ("adding %s to packages to be installed, conflicts resolved", pack_update->name); #else g_message (_("updating %s to version %s-%s solves conflict"), pack_update->name, pack_update->version, pack_update->minor); #endif - /* ref the package and add it to the extra_packages list */ - gtk_object_ref (GTK_OBJECT (pack_update)); - (*extra_packages) = g_list_prepend (*extra_packages, - pack_update); - pack_update->status = PACKAGE_PARTLY_RESOLVED; + /* If not already in extra_packages, add it. + Since post_softcat_get_info dedupes, even multiple + resolves to the same package will at this point be + the same package */ + if (g_list_find ((*extra_packages), pack_update)==NULL) { + /* ref the package and add it to the extra_packages list */ + gtk_object_ref (GTK_OBJECT (pack_update)); + (*extra_packages) = g_list_prepend (*extra_packages, + pack_update); + pack_update->status = PACKAGE_PARTLY_RESOLVED; + } remove = g_list_prepend (remove, breakage); /* reset pack_broken to some sane values */ pack_update->toplevel = TRUE; } else { + /* Nope, proposed package did not help... */ #if EI2_DEBUG & 0x4 trilobite_debug ("%s still has conflict", pack_update->name); #else @@ -1852,6 +1898,7 @@ check_tree_helper (EazelInstall *service, pack_update->name, pack_update->version, pack_update->minor); #endif + /* and blast it away */ gtk_object_unref (GTK_OBJECT (pack_update)); } } else { @@ -2457,8 +2504,9 @@ download_packages (EazelInstall *service, /***********************************************************************************/ static gboolean -clean_up_dedupe_hash (const char *id, PackageData *pack) +clean_up_dedupe_hash (char *md5, PackageData *pack) { + g_free (md5); gtk_object_unref (GTK_OBJECT (pack)); return TRUE; } diff --git a/components/services/install/lib/eazel-install-problem.c b/components/services/install/lib/eazel-install-problem.c index 198cb3331..7206401f4 100644 --- a/components/services/install/lib/eazel-install-problem.c +++ b/components/services/install/lib/eazel-install-problem.c @@ -210,12 +210,12 @@ get_detailed_messages_foreach (GtkObject *foo, GetErrorsForEachData *data) break; case PACKAGE_CIRCULAR_DEPENDENCY: if (previous_pack == NULL) { - message = g_strdup_printf ("%s depends on itself. Possibly SoftCat is updating...", + message = g_strdup_printf ("%s depends on itself...", required); } else { if (previous_pack->status == PACKAGE_CIRCULAR_DEPENDENCY) { if (strcmp (required_by, required)==0) { - message = g_strdup_printf ("%s depends on itself. Possibly SoftCat is updating...", + message = g_strdup_printf ("%s depends on itself...", required); } else { if (g_list_length (data->path) >= 3) { diff --git a/components/services/install/lib/eazel-softcat.c b/components/services/install/lib/eazel-softcat.c index 6dfa20938..701d1a694 100644 --- a/components/services/install/lib/eazel-softcat.c +++ b/components/services/install/lib/eazel-softcat.c @@ -33,6 +33,8 @@ #include <libgnomevfs/gnome-vfs.h> #endif /* EAZEL_INSTALL_SLIM */ +#undef EAZEL_SOFTCAT_SPAM_XML + /* This is the parent class pointer */ static GtkObjectClass *eazel_softcat_parent_class; @@ -654,7 +656,8 @@ eazel_softcat_query (EazelSoftCat *softcat, PackageData *package, int sense_flag tries_left--) { got_happy = trilobite_fetch_uri (search_url, &body, &length); - + +#ifdef EAZEL_SOFTCAT_SPAM_XML { char **strs; int i; @@ -665,6 +668,7 @@ eazel_softcat_query (EazelSoftCat *softcat, PackageData *package, int sense_flag } g_strfreev (strs); } +#endif /* EAZEL_SOFTCAT_SPAM_XML */ if (got_happy) { got_happy = eazel_install_packagelist_parse (&packages, body, length, &db_revision); |