summaryrefslogtreecommitdiff
path: root/components/services
diff options
context:
space:
mode:
authorEskil Heyn Olsen <eskil@eazel.com>2001-02-01 10:49:04 +0000
committerEskil Heyn Olsen <eskil@src.gnome.org>2001-02-01 10:49:04 +0000
commitd9cc084ea1217dce048b00f5b32614b15205b7e8 (patch)
treecf8917fd809381bde50ce4e0e112b5832b78666f /components/services
parent33f219c3e08f31fb1489af13247c25d1cb9b3e91 (diff)
downloadnautilus-d9cc084ea1217dce048b00f5b32614b15205b7e8.tar.gz
This patch is temporarily going to break a few things, will sync up with
2001-02-01 Eskil Heyn Olsen <eskil@eazel.com> This patch is temporarily going to break a few things, will sync up with Robey tomorrow. Eg. eazel-install (cli tool) now sigsegvs on error. * components/rpmview/nautilus-rpm-view-install.c: s/packagedata_destroy/gtk_object_unref/ * components/rpmview/nautilus-rpm-view.c: (nautilus_rpm_view_destroy): s/packagedata_destroy/gtk_object_unref/ * components/services/install/command-line/eazel-alt-install-corba. c: (eazel_preflight_check_signal): If there were problems, abort. * components/services/install/command-line/eazel-test-softcat.c: (main): * components/services/install/lib/eazel-install-corba-callback.c: (impl_download_progress), (impl_download_failed), (impl_dep_check), (impl_install_progress), (impl_uninstall_progress), (impl_md5_check_failed): * components/services/install/lib/eazel-install-corba.c: (impl_Eazel_Install_simple_query): s/packagedata_destroy/gtk_object_unref/ * components/services/install/lib/eazel-install-logic.c: (eazel_install_download_packages), (eazel_install_check_for_file_conflicts), (ei_revert_transaction), (eazel_install_do_transaction_all_files_check), (eazel_install_prune_packages), (eazel_install_fetch_dependencies), (eazel_install_do_file_conflict_check), (eazel_uninstall_upward_traverse), (eazel_uninstall_downward_traverse), (eazel_uninstall_check_for_install): ifdeffed out a lot of old code that's no longer used, but it still compiles. logic.c will soon be entirely removed. s/packagedata_destroy/gtk_object_unref/ Uninstall stuff uses the new PackageBreaks objects. * components/services/install/lib/eazel-install-logic2.c: (dump_tree_helper), (eazel_install_check_existing_packages), (get_softcat_info), (dedupe_foreach_depends), (is_satisfied), (check_update_for_no_more_file_conflicts), (check_tree_helper), (find_break_by_package_name), (add_file_conflict), (check_no_two_packages_has_same_file), (package_is_upgrading_and_doesnt_need_file), (check_conflicts_against_already_installed_packages), (check_feature_consistency), (install_packages_helper): Nicer output. Fixes 6172 and 6173. s/packagedata_destroy/gtk_object_unref/ * components/services/install/lib/eazel-install-protocols.c: Removed unused define * components/services/install/lib/eazel-install-rpm-glue.c: (eazel_install_do_rpm_dependency_check): More code ifdeffed out, see comment for eazel-install-logic.c * components/services/install/lib/eazel-install-xml-package-list.c: (parse_package), (eazel_install_packagedata_to_xml_int), (eazel_install_packagelist_to_xml), (osd_parse_shared): Use the new PackageBreak objects. * components/services/install/lib/eazel-package-system-rpm3.c: (make_rpm_argument_list), (rpm_packagedata_new_from_file), (eazel_package_system_rpm3_query_impl), (eazel_package_system_rpm3_compare_version): s/packagedata_destroy/gtk_object_unref/ * components/services/install/lib/eazel-package-system-types.h: * components/services/install/lib/eazel-package-system-types.c: (categorydata_destroy_foreach), (packagedependency_new), (packagedependency_copy), (packagedependency_destroy), (packagedata_finalize), (packagedata_class_initialize), (packagedata_initialize), (packagedata_copy), (packagedata_remove_soft_dep), (packagedata_get_readable_name), (packagedata_add_pack_to), (packagedata_add_to_breaks), (packagedata_add_pack_to_soft_depends), (packagedata_add_pack_to_modifies), (packagedata_list_prune), (add_string_list), (dump_package_break_list), (packagedata_dump_int), (packagebreaks_finalize), (packagebreaks_class_initialize), (packagebreaks_initialize), (packagebreaks_get_type), (packagebreaks_new), (packagebreaks_set_package), (packagebreaks_get_package), (packagefileconflict_finalize), (packagefileconflict_class_initialize), (packagefileconflict_initialize), (packagefileconflict_get_type), (packagefileconflict_new), (packagefeaturemissing_finalize), (packagefeaturemissing_class_initialize), (packagefeaturemissing_initialize), (packagefeaturemissing_get_type), (packagefeaturemissing_new): s/packagedata_destroy/gtk_object_unref/ Wrote some objects representing package breakage. * components/services/install/lib/eazel-package-system.c: (eazel_package_system_is_installed): s/packagedata_destroy/gtk_object_unref/ * components/services/install/lib/eazel-softcat.c: (eazel_softcat_available_update): Fixed the function so it matches the intended semantics * components/services/install/nautilus-view/nautilus-service-instal l-view.c: (nautilus_service_install_view_update_from_uri): s/packagedata_destroy/gtk_object_unref/ Merge from PR3 branch 2001-01-26 Eskil Olsen <eskil@eazel.com> reviewed by: Ramiri Estrugo <ramiro@eazel.com> * components/services/install/command-line/eazel-test-packsys.c: (test_version_compare): Testing the Mozilla hack... * components/services/install/lib/eazel-package-system-rpm3.c: (eazel_package_system_rpm3_compare_version): Special case for Mxx versions because rpmvercmp is not obeying the laws of mathematics... * components/services/install/lib/eazel-softcat.c: (get_search_url_for_package): Fix for 6055 - no longer use hardcoded RedHat62 as distro.
Diffstat (limited to 'components/services')
-rw-r--r--components/services/install-view/nautilus-service-install-view.c2
-rw-r--r--components/services/install/command-line/eazel-alt-install-corba.c2
-rw-r--r--components/services/install/command-line/eazel-test-packsys.c9
-rw-r--r--components/services/install/command-line/eazel-test-softcat.c4
-rw-r--r--components/services/install/lib/eazel-install-corba-callback.c14
-rw-r--r--components/services/install/lib/eazel-install-corba.c2
-rw-r--r--components/services/install/lib/eazel-install-logic.c74
-rw-r--r--components/services/install/lib/eazel-install-logic2.c240
-rw-r--r--components/services/install/lib/eazel-install-object.c2
-rw-r--r--components/services/install/lib/eazel-install-protocols.c3
-rw-r--r--components/services/install/lib/eazel-install-rpm-glue.c8
-rw-r--r--components/services/install/lib/eazel-install-xml-package-list.c31
-rw-r--r--components/services/install/lib/eazel-package-system-rpm3.c15
-rw-r--r--components/services/install/lib/eazel-package-system-types.c468
-rw-r--r--components/services/install/lib/eazel-package-system-types.h87
-rw-r--r--components/services/install/lib/eazel-package-system.c2
-rw-r--r--components/services/install/lib/eazel-softcat.c38
-rw-r--r--components/services/install/nautilus-view/nautilus-service-install-view.c2
18 files changed, 740 insertions, 263 deletions
diff --git a/components/services/install-view/nautilus-service-install-view.c b/components/services/install-view/nautilus-service-install-view.c
index 2cd4db4b8..747d2ec12 100644
--- a/components/services/install-view/nautilus-service-install-view.c
+++ b/components/services/install-view/nautilus-service-install-view.c
@@ -1506,7 +1506,7 @@ nautilus_service_install_view_update_from_uri (NautilusServiceInstallView *view,
pack = (PackageData*) gtk_object_get_data (GTK_OBJECT (view), "packagedata");
if (pack != NULL) {
/* Destroy the old */
- packagedata_destroy (pack, TRUE);
+ gtk_object_unref (GTK_OBJECT (pack));
}
/* find the package data for the package we're about to install */
diff --git a/components/services/install/command-line/eazel-alt-install-corba.c b/components/services/install/command-line/eazel-alt-install-corba.c
index 6c704b7b4..dc171cd1f 100644
--- a/components/services/install/command-line/eazel-alt-install-corba.c
+++ b/components/services/install/command-line/eazel-alt-install-corba.c
@@ -526,6 +526,8 @@ eazel_preflight_check_signal (EazelInstallCallback *service,
{
const GList *iterator;
+ if (cases) return FALSE;
+
fprintf (stdout, "About to %s a total of %d packages, %dKb\n",
arg_erase ? "uninstall" : "install",
total_packages, total_bytes/1024);
diff --git a/components/services/install/command-line/eazel-test-packsys.c b/components/services/install/command-line/eazel-test-packsys.c
index cbcb3bfbc..faa1a0878 100644
--- a/components/services/install/command-line/eazel-test-packsys.c
+++ b/components/services/install/command-line/eazel-test-packsys.c
@@ -113,6 +113,15 @@ test_is_installed (EazelPackageSystem *packsys)
static void
test_version_compare (EazelPackageSystem *packsys)
{
+ g_message ("version compare M1 is %s",
+ eazel_package_system_compare_version (packsys, "M18", "M17") > 0 ? "ok" : "FAILED");
+ g_message ("version compare M2 is %s",
+ eazel_package_system_compare_version (packsys, "M17", "M18") < 0 ? "ok" : "FAILED");
+ g_message ("version compare M3 is %s",
+ eazel_package_system_compare_version (packsys, "M18", "0.7") < 0 ? "ok" : "FAILED");
+ g_message ("version compare M4 is %s",
+ eazel_package_system_compare_version (packsys, "0.7", "M18") > 0 ? "ok" : "FAILED");
+
g_message ("version compare 1 is %s",
eazel_package_system_compare_version (packsys, "1.0", "1.1") < 0 ? "ok" : "FAILED");
g_message ("version compare 2 is %s",
diff --git a/components/services/install/command-line/eazel-test-softcat.c b/components/services/install/command-line/eazel-test-softcat.c
index cc4a025de..46c8dca51 100644
--- a/components/services/install/command-line/eazel-test-softcat.c
+++ b/components/services/install/command-line/eazel-test-softcat.c
@@ -125,7 +125,7 @@ main (int argc, char **argv)
info = packagedata_dump (newpack, arg_verbose ? TRUE : FALSE);
printf ("%s\n", info);
g_free (info);
- packagedata_destroy (newpack, TRUE);
+ gtk_object_unref (GTK_OBJECT (newpack));
} else {
printf ("No new package available.\n");
}
@@ -142,7 +142,7 @@ main (int argc, char **argv)
}
package_list = g_list_remove (package_list, package);
- packagedata_destroy (package, TRUE);
+ gtk_object_unref (GTK_OBJECT (package));
}
return 0;
diff --git a/components/services/install/lib/eazel-install-corba-callback.c b/components/services/install/lib/eazel-install-corba-callback.c
index 2115a1824..e9ffaf76c 100644
--- a/components/services/install/lib/eazel-install-corba-callback.c
+++ b/components/services/install/lib/eazel-install-corba-callback.c
@@ -79,7 +79,7 @@ impl_download_progress (impl_POA_GNOME_Trilobite_Eazel_InstallCallback *servant,
pack = packagedata_from_corba_packagedatastruct (*corbapack);
gtk_signal_emit (GTK_OBJECT (servant->object), signals[DOWNLOAD_PROGRESS], pack, amount, total);
- packagedata_destroy (pack, TRUE);
+ gtk_object_unref (GTK_OBJECT (pack));
}
static CORBA_boolean
@@ -124,7 +124,7 @@ impl_download_failed (impl_POA_GNOME_Trilobite_Eazel_InstallCallback *servant,
pack = packagedata_from_corba_packagedatastruct (*corbapack);
gtk_signal_emit (GTK_OBJECT (servant->object), signals[DOWNLOAD_FAILED], pack);
- packagedata_destroy (pack, TRUE);
+ gtk_object_unref (GTK_OBJECT (pack));
}
static void
@@ -137,8 +137,8 @@ impl_dep_check (impl_POA_GNOME_Trilobite_Eazel_InstallCallback *servant,
pack = packagedata_from_corba_packagedatastruct (*corbapack);
needs = packagedata_from_corba_packagedatastruct (*corbaneeds);
gtk_signal_emit (GTK_OBJECT (servant->object), signals[DEPENDENCY_CHECK], pack, needs);
- packagedata_destroy (pack, TRUE);
- packagedata_destroy (needs, TRUE);
+ gtk_object_unref (GTK_OBJECT (pack));
+ gtk_object_unref (GTK_OBJECT (needs));
}
static void
@@ -156,7 +156,7 @@ impl_install_progress (impl_POA_GNOME_Trilobite_Eazel_InstallCallback *servant,
package_num, num_packages,
package_size_completed, package_size_total,
total_size_completed, total_size);
- packagedata_destroy (pack, TRUE);
+ gtk_object_unref (GTK_OBJECT (pack));
}
static void
@@ -169,7 +169,7 @@ impl_uninstall_progress (impl_POA_GNOME_Trilobite_Eazel_InstallCallback *servant
PackageData *pack;
pack = packagedata_from_corba_packagedatastruct (*corbapack);
gtk_signal_emit (GTK_OBJECT (servant->object), signals[UNINSTALL_PROGRESS], pack, amount, total);
- packagedata_destroy (pack, TRUE);
+ gtk_object_unref (GTK_OBJECT (pack));
}
static void
@@ -181,7 +181,7 @@ impl_md5_check_failed (impl_POA_GNOME_Trilobite_Eazel_InstallCallback *servant,
PackageData *pack;
pack = packagedata_from_corba_packagedatastruct (*corbapack);
gtk_signal_emit (GTK_OBJECT (servant->object), signals[MD5_CHECK_FAILED], pack, actual_md5);
- packagedata_destroy (pack, TRUE);
+ gtk_object_unref (GTK_OBJECT (pack));
}
static void
diff --git a/components/services/install/lib/eazel-install-corba.c b/components/services/install/lib/eazel-install-corba.c
index 2252f9976..f091d41ce 100644
--- a/components/services/install/lib/eazel-install-corba.c
+++ b/components/services/install/lib/eazel-install-corba.c
@@ -493,7 +493,7 @@ impl_Eazel_Install_simple_query (impl_POA_GNOME_Trilobite_Eazel_Install *servant
result = GNOME_Trilobite_Eazel_PackageDataStructList__alloc ();
(*result) = corba_packagedatastructlist_from_packagedata_list (tmp_result);
- g_list_foreach (tmp_result, (GFunc)packagedata_destroy, GINT_TO_POINTER (TRUE));
+ g_list_foreach (tmp_result, (GFunc)gtk_object_unref, NULL);
return result;
}
diff --git a/components/services/install/lib/eazel-install-logic.c b/components/services/install/lib/eazel-install-logic.c
index 792ddc019..38dbc9922 100644
--- a/components/services/install/lib/eazel-install-logic.c
+++ b/components/services/install/lib/eazel-install-logic.c
@@ -71,12 +71,12 @@ static gboolean eazel_install_download_packages (EazelInstall *service,
gboolean toplevel,
GList **packages,
GList **failed_packages);
-
+#if 0
static gboolean eazel_install_check_for_file_conflicts (EazelInstall *service,
PackageData *pack,
GList **breaks,
GList **requires);
-
+#endif
static void eazel_install_prune_packages (EazelInstall *service,
PackageData *pack,
...);
@@ -174,6 +174,9 @@ eazel_install_download_packages (EazelInstall *service,
GList **packages,
GList **failed_packages)
{
+ g_assert_not_reached ();
+ return TRUE;
+#if 0
GList *iterator;
gboolean result = TRUE;
GList *remove_list = NULL;
@@ -285,8 +288,9 @@ eazel_install_download_packages (EazelInstall *service,
}
return result;
+#endif
}
-
+#if 0
/*
This function checks all files in pack->provides, and
checks if another already installed package owns this file.
@@ -366,7 +370,7 @@ eazel_install_check_for_file_conflicts (EazelInstall *service,
g_list_find_custom (*requires, owner->name,
(GCompareFunc)eazel_install_package_name_compare)) {
/* trilobite_debug ("already breaking %s", owner->name); */
- packagedata_destroy (owner, TRUE);
+ gtk_object_unref (GTK_OBJECT (owner));
owner = NULL;
continue;
}
@@ -390,7 +394,7 @@ eazel_install_check_for_file_conflicts (EazelInstall *service,
} else {
/* else it's the same package and it's okay */
/* so FREE IT YOU SICK MONKEY! */
- packagedata_destroy (owner, TRUE);
+ gtk_object_unref (GTK_OBJECT (owner));
}
}
/* free the _simple_query result list */
@@ -404,6 +408,7 @@ eazel_install_check_for_file_conflicts (EazelInstall *service,
}
return result;
}
+#endif
static gboolean
eazel_install_do_install_packages (EazelInstall *service,
@@ -569,7 +574,7 @@ ei_revert_transaction (EazelInstall *service,
eazel_install_set_update (service, TRUE);
cat->packages = upgrade;
result |= ei_install_packages (service, categories);
- g_list_foreach (upgrade, (GFunc)packagedata_destroy, GINT_TO_POINTER (TRUE));
+ g_list_foreach (upgrade, (GFunc)gtk_object_unref, NULL);
}
return result;
@@ -691,6 +696,9 @@ static gboolean
eazel_install_do_transaction_all_files_check (EazelInstall *service,
GList **packages)
{
+ g_assert_not_reached ();
+ return FALSE;
+#if 0
gboolean result = TRUE;
GList *iterator;
GList *conflicts = NULL; /* PackageRequirements. ->package is the first found package
@@ -763,11 +771,12 @@ eazel_install_do_transaction_all_files_check (EazelInstall *service,
trilobite_debug ("Conflict between %s and %s", req->package->name, req->required->name);
req->package->status = PACKAGE_FILE_CONFLICT;
req->required->status = PACKAGE_FILE_CONFLICT;
- packagedata_add_pack_to_breaks (req->package, req->required);
+ Xpackagedata_add_pack_to_breaks (req->package, req->required);
eazel_install_prune_packages (service, req->package, packages, NULL);
}
return result;
+#endif
}
@@ -1018,7 +1027,7 @@ eazel_install_prune_packages (EazelInstall *service,
for (iterator = pruned; iterator; iterator = g_list_next (iterator)) {
PackageData *pack;
pack = (PackageData*)iterator->data;
- packagedata_destroy (pack, TRUE);
+ gtk_object_unref (GTK_OBJECT (pack));
};
*/
@@ -1026,7 +1035,7 @@ eazel_install_prune_packages (EazelInstall *service,
va_end (ap);
}
-
+#if 0
static void
eazel_install_add_to_extras_foreach (char *key, GList *list, GList **extrapackages)
{
@@ -1038,7 +1047,7 @@ eazel_install_add_to_extras_foreach (char *key, GList *list, GList **extrapackag
}
g_list_free (list);
}
-
+#endif
/*
This function tests wheter "package" and "dep"
@@ -1126,6 +1135,9 @@ eazel_install_fetch_dependencies (EazelInstall *service,
GList **failedpackages,
GList *requirements)
{
+ g_assert_not_reached ();
+ return FALSE;
+#if 0
GList *iterator;
/* Contains the packages downloaded when handling the list of requirements */
GList *extras_in_this_batch = NULL;
@@ -1150,7 +1162,7 @@ eazel_install_fetch_dependencies (EazelInstall *service,
tmp = packagedata_get_readable_name (pack);
trilobite_debug ("%s already failed, will not download it's requirements", tmp);
g_free (tmp);
- packagedata_destroy (dep, TRUE);
+ gtk_object_unref (GTK_OBJECT (dep));
continue;
}
@@ -1193,7 +1205,7 @@ eazel_install_fetch_dependencies (EazelInstall *service,
if (pack_entry) {
PackageData *evil_package = packagedata_copy ((PackageData*)(pack_entry->data), FALSE);
- packagedata_add_pack_to_breaks (dep, evil_package);
+ Xpackagedata_add_pack_to_breaks (dep, evil_package);
trilobite_debug ("Circular dependency caused by %s-%s-%s at 0x%p",
evil_package->name,
evil_package->version,
@@ -1241,7 +1253,7 @@ eazel_install_fetch_dependencies (EazelInstall *service,
I suspect that adding this to adding evil_package to pack's breaks
might yield a more pleasant tree */
PackageData *evil_package = (PackageData*)pack_entry->data;
- packagedata_add_pack_to_breaks (evil_package, dep);
+ Xpackagedata_add_pack_to_breaks (evil_package, dep);
evil_package->status = PACKAGE_BREAKS_DEPENDENCY;
} else {
trilobite_debug ("This is also Bad: I cannot set the funky break list");
@@ -1354,6 +1366,7 @@ eazel_install_fetch_dependencies (EazelInstall *service,
} else {
return TRUE;
}
+#endif
}
static void
@@ -1465,6 +1478,8 @@ eazel_install_do_file_conflict_check (EazelInstall *service,
GList **failedpackages,
GList **requirements)
{
+ g_assert_not_reached ();
+#if 0
GList *iterator;
GList *tmp_failed = NULL;
@@ -1491,8 +1506,8 @@ eazel_install_do_file_conflict_check (EazelInstall *service,
if (g_list_find_custom (*packages,
required_pack->name,
(GCompareFunc)eazel_install_package_name_compare)) {
- trilobite_debug ("but we're updating it (requirement)");
- /* packagedata_destroy (broken_package, FALSE); */
+ trilobite_debug ("but we'e updating it (requirement)");
+ /* gtk_object_unref (GTK_OBJECT (broken_package)); */
} else {
PackageRequirement *req;
req = packagerequirement_new (pack, required_pack);
@@ -1510,10 +1525,10 @@ eazel_install_do_file_conflict_check (EazelInstall *service,
broken_package->name,
(GCompareFunc)eazel_install_package_name_compare)) {
trilobite_debug ("but we're updating it");
- /* packagedata_destroy (broken_package, FALSE); */
+ /* gtk_object_unref (GTK_OBJECT (broken_package)); */
} else {
fail_it = TRUE;
- packagedata_add_pack_to_breaks (pack, broken_package);
+ Xpackagedata_add_pack_to_breaks (pack, broken_package);
}
}
if (fail_it) {
@@ -1532,6 +1547,7 @@ eazel_install_do_file_conflict_check (EazelInstall *service,
(*failedpackages) = g_list_prepend (*failedpackages, cpack);
(*packages) = g_list_remove (*packages, cpack);
}
+#endif
}
/*
@@ -1747,14 +1763,19 @@ eazel_uninstall_upward_traverse (EazelInstall *service,
if (g_list_find_custom (*breaks, (gpointer)requiredby->name,
(GCompareFunc)eazel_install_package_name_compare)) {
trilobite_debug ("skip %s", requiredby->name);
- packagedata_destroy (requiredby, TRUE);
+ gtk_object_unref (GTK_OBJECT (requiredby));
requiredby = NULL;
continue;
}
*/
/* Guess not, mark it as breaking (and that pack is the offender */
- packagedata_add_pack_to_breaks (pack, requiredby);
+ {
+ PackageFeatureMissing *breakage = packagefeaturemissing_new ();
+ packagebreaks_set_package (PACKAGEBREAKS (breakage), requiredby);
+ packagedata_add_to_breaks (pack, PACKAGEBREAKS (breakage));
+ gtk_object_unref (GTK_OBJECT (requiredby));
+ }
(*breaks) = g_list_prepend ((*breaks), requiredby);
/* If the package has not been failed yet (and is a toplevel),
@@ -1859,7 +1880,7 @@ eazel_uninstall_downward_traverse (EazelInstall *service,
PACKAGE_FILL_NO_DIRS_IN_PROVIDES);
packagedata_list_prune (&second_matches, *packages, TRUE, TRUE);
packagedata_list_prune (&second_matches, *requires, TRUE, TRUE);
- packagedata_destroy (tmp_pack, TRUE);
+ gtk_object_unref (GTK_OBJECT (tmp_pack));
/* Iterate over all packages that match the required package */
for (second_match_iterator = second_matches;
@@ -1873,7 +1894,7 @@ eazel_uninstall_downward_traverse (EazelInstall *service,
g_list_find_custom (*packages, isrequired->name,
(GCompareFunc)eazel_install_package_name_compare)) {
trilobite_debug ("skipped %s", isrequired->name);
- packagedata_destroy (isrequired, TRUE);\
+ gtk_object_unref (GTK_OBJECT (isrequired));\
isrequired = NULL;
continue;
}
@@ -1903,11 +1924,10 @@ eazel_uninstall_downward_traverse (EazelInstall *service,
isrequired->name);
print_package_list ("BY", third_matches, FALSE);
g_list_foreach (third_matches,
- (GFunc)packagedata_destroy,
- GINT_TO_POINTER (TRUE));
+ (GFunc)gtk_object_unref, NULL);
g_list_free (third_matches);
third_matches = NULL;
- packagedata_destroy (isrequired, TRUE);
+ gtk_object_unref (GTK_OBJECT (isrequired));
isrequired = NULL;
} else {
trilobite_debug ("Also nuking %s", isrequired->name);
@@ -1928,7 +1948,7 @@ eazel_uninstall_downward_traverse (EazelInstall *service,
headerFree (hd);
}
- g_list_foreach (matches, (GFunc)packagedata_destroy, GINT_TO_POINTER (TRUE));
+ g_list_foreach (matches, (GFunc)gtk_object_unref, NULL);
g_list_free (matches);
matches = NULL;
}
@@ -1982,7 +2002,7 @@ eazel_uninstall_check_for_install (EazelInstall *service,
any = TRUE;
result = g_list_prepend (result, matched);
} else {
- packagedata_destroy (matched, TRUE);
+ gtk_object_unref (GTK_OBJECT (matched));
}
}
@@ -2008,7 +2028,7 @@ eazel_uninstall_check_for_install (EazelInstall *service,
trilobite_debug ("g_list_length (*packages) = %d", g_list_length (*packages));
trilobite_debug ("g_list_length (result) = %d", g_list_length (result));
- g_list_foreach (*packages, (GFunc)packagedata_destroy, FALSE);
+ g_list_foreach (*packages, (GFunc)gtk_object_unref, NULL);
g_list_free (*packages);
(*packages) = result;
diff --git a/components/services/install/lib/eazel-install-logic2.c b/components/services/install/lib/eazel-install-logic2.c
index 147ee8d8d..c056967ac 100644
--- a/components/services/install/lib/eazel-install-logic2.c
+++ b/components/services/install/lib/eazel-install-logic2.c
@@ -43,7 +43,7 @@
0x4 enables random spewing
0x8 enables dumping the final tree
*/
-#define EI2_DEBUG 0xff
+#define EI2_DEBUG 0x0
#define PATCH_FOR_SOFTCAT_BUG 1
#define MUST_HAVE PACKAGE_FILL_NO_DIRS_IN_PROVIDES
@@ -74,21 +74,22 @@ dump_tree_helper (GList *packages, char *indent, GList *path)
}
name = packagedata_get_readable_name (pack);
- trilobite_debug ("%s%p (%s) %s %s%s",
+ trilobite_debug ("%s%p (%s) %s %s%s %s",
indent,
pack,
name,
pack->eazel_id,
- pack->fillflag & MUST_HAVE ? "filled" : "not filled",
- pack->status == PACKAGE_CANNOT_OPEN ? " but failed" : "");
+ (pack->fillflag & MUST_HAVE) ? "filled" : "not filled",
+ (pack->status == PACKAGE_CANNOT_OPEN) ? " but failed" : "",
+ pack->md5);
tmp = g_strdup_printf ("%s ", indent);
- if (g_list_find_custom (path, name, (GCompareFunc)strcmp)) {
- trilobite_debug ("%s... %p %s recurses .., softcat is probably in flux", indent, pack, pack->name);
+ if (g_list_find (path, pack)) {
+ trilobite_debug ("%s... %p %s recurses ..", indent, pack, pack->name);
} else {
- path = g_list_prepend (path, name);
+ path = g_list_prepend (path, pack);
dump_tree_helper (pack->depends, tmp, path);
+ path = g_list_remove (path, pack);
}
- path = g_list_remove (path, name);
g_free (name);
g_free (tmp);
}
@@ -288,7 +289,7 @@ eazel_install_check_existing_packages (EazelInstall *service,
#if EI2_DEBUG & 0x4
trilobite_debug ("%s already marked as modified", existing_package->name);
#endif
- packagedata_destroy (existing_package, TRUE);
+ gtk_object_unref (GTK_OBJECT (existing_package));
existing_package = NULL;
continue;
}
@@ -307,7 +308,7 @@ eazel_install_check_existing_packages (EazelInstall *service,
#endif
if (pack->minor && existing_package->minor) {
#if EI2_DEBUG & 0x4
- trilobite_debug ("minors are %s and %s (installed)",
+ trilobite_debug ("minors are %s for new and %s for installed)",
pack->minor, existing_package->minor);
#endif
res = eazel_package_system_compare_version (service->private->package_system,
@@ -319,7 +320,7 @@ eazel_install_check_existing_packages (EazelInstall *service,
This is a patch, it should be res=1, revert when
softcat is updated to have revisions for all packages
(post PR3) */
- res = 0;
+ res = 1;
} else {
/* Eh, do nothing just to be safe */
res = 0;
@@ -496,12 +497,8 @@ get_softcat_info (EazelInstall *service,
if (result != NO_SOFTCAT_HIT) {
PackageData *p1 = NULL;
- if ((*package)->eazel_id == NULL) {
- (*package)->eazel_id = g_strdup_printf ("%s-%s-%s",
- (*package)->name, (*package)->version, (*package)->minor);
- }
-
- p1 = g_hash_table_lookup (service->private->dedupe_hash, (*package)->eazel_id);
+ g_assert ((*package)->md5);
+ p1 = g_hash_table_lookup (service->private->dedupe_hash, (*package)->md5);
if (p1) {
#if EI2_DEBUG & 0x4
@@ -520,7 +517,7 @@ get_softcat_info (EazelInstall *service,
case EAZEL_INSTALL_STATUS_UPGRADES:
gtk_object_ref (GTK_OBJECT (*package));
g_hash_table_insert (service->private->dedupe_hash,
- (*package)->eazel_id,
+ (*package)->md5,
*package);
break;
case EAZEL_INSTALL_STATUS_DOWNGRADES:
@@ -596,22 +593,23 @@ dedupe_foreach_depends (PackageDependency *d,
p1 = d->package;
- if (p1->eazel_id == NULL) {
- /* softcat didn't have this package */
+ if (p1->md5 == NULL) {
+ /* Package info not received from SoftCat */
return;
}
if (~p1->fillflag & MUST_HAVE) {
PackageData *p11;
- p11 = g_hash_table_lookup (service->private->dedupe_hash, p1->eazel_id);
+ p11 = g_hash_table_lookup (service->private->dedupe_hash, p1->md5);
+
if (p11) {
gtk_object_ref (GTK_OBJECT (p11));
gtk_object_unref (GTK_OBJECT (p1));
d->package = p11;
} else {
gtk_object_ref (GTK_OBJECT (p1));
- g_hash_table_insert (service->private->dedupe_hash, p1->eazel_id, p1);
+ g_hash_table_insert (service->private->dedupe_hash, p1->md5, p1);
dedupe_foreach (p1, service);
}
}
@@ -673,6 +671,9 @@ is_satisfied (EazelInstall *service,
trilobite_debug ("is_satisfied? %p %s",
dep->package, dep->package->name);
trilobite_debug ("\t -> already filled, must be ok");
+#else
+ g_message ("checking dependency for %s (already checked)",
+ dep->package->name);
#endif
return FALSE;
@@ -683,6 +684,10 @@ is_satisfied (EazelInstall *service,
trilobite_debug ("is_satisfied? %p %s %s %s",
dep->package, dep->package->name, sense_str,
(dep->version != NULL ? dep->version : ""));
+#else
+ g_message ("checking dependency %s %s %s",
+ dep->package->name, sense_str,
+ (dep->version != NULL ? dep->version : ""));
#endif
key = g_strdup_printf ("%s/%s/%s", dep->package->name, sense_str,
(dep->version != NULL ? dep->version : ""));
@@ -743,6 +748,8 @@ is_satisfied (EazelInstall *service,
if (result) {
#if EI2_DEBUG & 0x4
trilobite_debug ("\t--> feature is satisfied");
+#else
+ g_message ("\tok");
#endif
g_hash_table_insert (service->private->dep_ok_hash,
key,
@@ -751,6 +758,8 @@ is_satisfied (EazelInstall *service,
} else {
#if EI2_DEBUG & 0x4
trilobite_debug ("\t--> feature not satisfied");
+#else
+ g_message ("\tnot ok");
#endif
g_hash_table_insert (service->private->dep_ok_hash,
key,
@@ -883,6 +892,27 @@ void check_feature_consistency (EazelInstall *service, GList *packages);
void check_conflicts_against_already_installed_packages (EazelInstall *service, GList *packages);
void check_tree_for_conflicts (EazelInstall *service, GList **packages, GList **extra_packages);
+static gboolean
+check_update_for_no_more_file_conflicts (PackageFileConflict *conflict,
+ PackageData *pack_update)
+{
+ GList *iterator;
+
+ g_assert (IS_PACKAGEFILECONFLICT (conflict));
+ g_assert (conflict->files);
+ g_assert (g_list_length (conflict->files));
+
+ for (iterator = conflict->files; iterator; iterator = g_list_next (iterator)) {
+ char *filename = (char*)iterator->data;
+ if (g_list_find_custom (pack_update->provides,
+ filename,
+ (GCompareFunc)strcmp)) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
static void
check_tree_helper (EazelInstall *service,
PackageData *pack,
@@ -890,6 +920,7 @@ check_tree_helper (EazelInstall *service,
GList **path)
{
GList *iterator;
+ GList *remove = NULL;
if (g_list_find (*path, pack)) {
#if EI2_DEBUG & 0x4
@@ -903,22 +934,62 @@ check_tree_helper (EazelInstall *service,
#endif
if (pack->status == PACKAGE_FILE_CONFLICT) {
#if EI2_DEBUG & 0x4
- trilobite_debug ("reviving %s", pack->name);
+ trilobite_debug ("trying to revive %s", pack->name);
#endif
- pack->status = PACKAGE_PARTLY_RESOLVED;
for (iterator = pack->breaks; iterator; iterator = g_list_next (iterator)) {
- PackageData *pack_broken = PACKAGEDATA (iterator->data);
- /* reset pack_broken to some sane values */
- pack_broken->status = PACKAGE_UNKNOWN_STATUS;
- pack_broken->fillflag = PACKAGE_FILL_INVALID;
- g_free (pack_broken->version);
- pack_broken->version = NULL;
- g_free (pack_broken->minor);
- pack_broken->minor = NULL;
- (*extra_packages) = g_list_prepend (*extra_packages, pack_broken);
+ PackageBreaks *breakage = PACKAGEBREAKS (iterator->data);
+
+ if (IS_PACKAGEFILECONFLICT (breakage)) {
+ PackageFileConflict *conflict = PACKAGEFILECONFLICT (breakage);
+ PackageData *pack_broken = packagebreaks_get_package (breakage);
+ PackageData *pack_update = NULL;
+
+ /* reset pack_broken to some sane values */
+ if (eazel_softcat_available_update (service->private->softcat,
+ pack_broken,
+ &pack_update,
+ MUST_HAVE)) {
+ if (check_update_for_no_more_file_conflicts (conflict, pack_update)) {
+#if EI2_DEBUG & 0x4
+ trilobite_debug ("adding %s to packages to be installed",
+ 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;
+ remove = g_list_prepend (remove, breakage);
+ pack->status = PACKAGE_PARTLY_RESOLVED;
+ } else {
+#if EI2_DEBUG & 0x4
+ trilobite_debug ("%s still has conflict", pack_update->name);
+#else
+ g_message ("available update to %s does not solves conflict",
+ pack_update->name);
+#endif
+ }
+ }
+ }
+ }
+
+ /* Now nuke the successfully revived PackageBreaks */
+ for (iterator = remove; iterator; iterator = g_list_next (iterator)) {
+ PackageBreaks *breakage = PACKAGEBREAKS (iterator->data);
+ gtk_object_unref (GTK_OBJECT (breakage));
+ pack->breaks = g_list_remove (pack->breaks, breakage);
+ }
+ g_list_free (remove);
+
+ /* if no breaks were unrevived, null out the list */
+ if (g_list_length (pack->breaks)==0) {
+ g_list_free (pack->breaks);
+ pack->breaks = NULL;
}
- g_list_free (pack->breaks);
- pack->breaks = NULL;
}
for (iterator = pack->depends; iterator; iterator = g_list_next (iterator)) {
@@ -956,6 +1027,40 @@ check_tree_for_conflicts (EazelInstall *service,
#endif
}
+static int
+find_break_by_package_name (PackageBreaks *breaks, PackageData *pack)
+{
+ return eazel_install_package_compare (packagebreaks_get_package (breaks),
+ pack);
+}
+
+static void
+add_file_conflict (PackageData *pack,
+ PackageData *broken,
+ char *filename)
+{
+ GList *prev;
+ prev = g_list_find_custom (pack->breaks,
+ broken,
+ (GCompareFunc)find_break_by_package_name);
+ pack->status = PACKAGE_FILE_CONFLICT;
+
+ if (prev) {
+ PackageFileConflict *conflict = PACKAGEFILECONFLICT (prev->data);
+ conflict->files = g_list_prepend (conflict->files, g_strdup (filename));
+ } else {
+ PackageFileConflict *conflict = packagefileconflict_new ();
+
+ pack->status = PACKAGE_FILE_CONFLICT;
+ broken->status = PACKAGE_FILE_CONFLICT;
+
+ packagebreaks_set_package (PACKAGEBREAKS (conflict), broken);
+ conflict->files = g_list_prepend (conflict->files, g_strdup (filename));
+ packagedata_add_to_breaks (pack, PACKAGEBREAKS (conflict));
+ //gtk_object_unref (GTK_OBJECT (conflict));
+ }
+}
+
/* make sure none of the packages we're installing will share files
add code to check that no two packages provides the same file
@@ -981,13 +1086,11 @@ check_no_two_packages_has_same_file (EazelInstall *service,
GList *packages)
{
GHashTable *file_table; /* filename(char *) -> package(PackageData *) */
- GList *broken_packages; /* (PackageData *) packages known to have conflicts already */
GList *iter, *iter_file;
PackageData *pack, *pack_other;
char *filename;
GList *flat_packages;
- broken_packages = NULL;
flat_packages = flatten_packagedata_dependency_tree (packages);
if (eazel_install_get_force (service) ||
@@ -1001,7 +1104,7 @@ check_no_two_packages_has_same_file (EazelInstall *service,
file_table = g_hash_table_new (g_str_hash, g_str_equal);
#if EI2_DEBUG & 0x4
- trilobite_debug ("-> no_two_packages conflict check begins (%d packages)", g_list_length (flat_packages));
+ trilobite_debug ("-> no-two-packages conflict check begins (%d unique packages)", g_list_length (flat_packages));
#endif
for (iter = g_list_first (flat_packages); iter != NULL; iter = g_list_next (iter)) {
@@ -1010,9 +1113,8 @@ check_no_two_packages_has_same_file (EazelInstall *service,
pack = PACKAGEDATA (iter->data);
-#if EI2_DEBUG & 0x4
- trilobite_debug ("checking %s", pack->name);
-#endif
+ g_message ("file uniqueness checking %s", pack->name);
+
for (iter_file = g_list_first (pack->provides); iter_file != NULL; iter_file = g_list_next (iter_file)) {
filename = (char *)(iter_file->data);
@@ -1030,20 +1132,14 @@ check_no_two_packages_has_same_file (EazelInstall *service,
/* Only report it once in the debug log or we'll spam to eternity on some
* large broken packages... */
if (! reported_yet) {
- trilobite_debug ("file conflict 1: %s from package %s is also in %s",
- filename, pack->name, pack_other->name);
+ g_message ("Duplicate file : %s occurs in %s and %s",
+ filename, pack->name, pack_other->name);
reported_yet = TRUE;
} else {
other_conflicts++;
}
-
- /* 'pack' broke 'pack_other', but only if 'pack_other' isn't already broken */
- if (! g_list_find (broken_packages, pack_other)) {
- broken_packages = g_list_prepend (broken_packages, pack_other);
- packagedata_add_pack_to_breaks (pack, pack_other);
- pack->status = PACKAGE_FILE_CONFLICT;
- pack_other->status = PACKAGE_FILE_CONFLICT;
- }
+ add_file_conflict (pack, pack_other, filename);
+ gtk_object_unref (GTK_OBJECT (pack_other));
} else {
/* file is okay */
g_hash_table_insert (file_table, filename, pack);
@@ -1055,8 +1151,9 @@ check_no_two_packages_has_same_file (EazelInstall *service,
}
/* let's free all this crap, unlike last time (cough cough) :) */
- g_list_free (broken_packages);
+ /* elements in flat_packages are not to be unreffed */
g_list_free (flat_packages);
+ /* the hashentries point to strings inside the packagedata objects */
g_hash_table_destroy (file_table);
#if EI2_DEBUG & 0x4
@@ -1073,6 +1170,7 @@ package_is_upgrading_and_doesnt_need_file (PackageData *pack, GList *packages, c
PackageData *pack_upgrade;
GList *item, *item2;
+ /* Hmmm, would eazel_install_package_compare be better ? */
item = g_list_find_custom (packages, pack->name,
(GCompareFunc)eazel_install_package_name_compare);
if (item != NULL) {
@@ -1132,7 +1230,7 @@ check_conflicts_against_already_installed_packages (EazelInstall *service,
flat_packages = flatten_packagedata_dependency_tree (packages);
#if EI2_DEBUG & 0x4
- trilobite_debug ("-> file conflict check begins (%d packages)", g_list_length (flat_packages));
+ trilobite_debug ("-> file conflict check begins (%d unique packages)", g_list_length (flat_packages));
#endif
for (iter = g_list_first (flat_packages); iter != NULL; iter = g_list_next (iter)) {
@@ -1142,9 +1240,7 @@ check_conflicts_against_already_installed_packages (EazelInstall *service,
continue;
}
-#if EI2_DEBUG & 0x4
- trilobite_debug ("checking %s", pack->name);
-#endif
+ g_message ("file conflict checking %s", pack->name);
pack->conflicts_checked = TRUE;
for (iter_file = g_list_first (pack->provides); iter_file != NULL; iter_file = g_list_next (iter_file)) {
@@ -1178,23 +1274,16 @@ check_conflicts_against_already_installed_packages (EazelInstall *service,
continue;
}
- trilobite_debug ("file conflict 2: %s from %s conflicts with %p %s",
- filename, pack->name, pack_owner, pack_owner->name);
+ g_message ("file conflict : package %s already provides %s also provided by %s",
+ pack_owner->name, filename, pack->name);
if (package_is_upgrading_and_doesnt_need_file (pack_owner,
flat_packages, filename)) {
/* the owner of this file is a package that we're upgrading, and the
* new version no longer has this file, so everything's okay. */
- trilobite_debug ("...but it's okay, we're upgrading %s and it ditched that file",
+ g_message ("...but it's okay, we're upgrading %s and it ditched that file",
pack_owner->name);
} else {
- /* boo */
- pack->status = PACKAGE_FILE_CONFLICT;
- /* did we already mark this in ->breaks ? */
- if (g_list_find_custom (pack->breaks, pack_owner->name,
- (GCompareFunc)eazel_install_package_name_compare)==NULL) {
- pack_owner->status = PACKAGE_FILE_CONFLICT;
- packagedata_add_pack_to_breaks (pack, pack_owner);
- }
+ add_file_conflict (pack, pack_owner, filename);
}
gtk_object_unref (GTK_OBJECT (pack_owner));
}
@@ -1208,9 +1297,7 @@ check_conflicts_against_already_installed_packages (EazelInstall *service,
g_list_free (flat_packages);
}
-/* FIXME: bugzilla.eazel.com 5277 (still need to test this)
- add code to check that no features are lost, and if, that they're not required
-
+/*
hash<char*, PackageData> Hfeat;
for each p in packages {
@@ -1303,6 +1390,7 @@ check_feature_consistency (EazelInstall *service,
EAZEL_PACKAGE_SYSTEM_QUERY_REQUIRES,
PACKAGE_FILL_NO_DIRS_IN_PROVIDES);
for (break_it = required_by; break_it; break_it = g_list_next (break_it)) {
+ PackageFeatureMissing *feature_missing = packagefeaturemissing_new ();
PackageData *pack_broken = PACKAGEDATA (break_it->data);
#if EI2_DEBUG & 0x4
@@ -1311,13 +1399,11 @@ check_feature_consistency (EazelInstall *service,
pack, pack->name,
pack_modified, pack_modified->name);
#endif
- /* FIXME 5277 and 5721 more here
- For me to finish this, I need softcat to emit
- features in the xml
- */
pack_broken->status = PACKAGE_DEPENDENCY_FAIL;
pack->status = PACKAGE_BREAKS_DEPENDENCY;
- packagedata_add_pack_to_breaks (pack, pack_broken);
+ packagebreaks_set_package (PACKAGEBREAKS (feature_missing), pack_broken);
+ feature_missing->features = g_list_prepend (feature_missing->features, g_strdup (feature));
+ packagedata_add_to_breaks (pack, PACKAGEBREAKS (feature_missing));
gtk_object_unref (GTK_OBJECT (pack_broken));
}
g_list_free (required_by);
@@ -1541,6 +1627,10 @@ install_packages_helper (EazelInstall *service,
#if EI2_DEBUG & 0x8
trilobite_debug ("FINAL TREE BEGIN");
dump_tree (*packages);
+ if (*extra_packages) {
+ trilobite_debug ("EXTRA PACKAGES BEGIN");
+ dump_tree (*extra_packages);
+ }
trilobite_debug ("FINAL TREE END");
#endif
diff --git a/components/services/install/lib/eazel-install-object.c b/components/services/install/lib/eazel-install-object.c
index 691365a69..a9a7ff61c 100644
--- a/components/services/install/lib/eazel-install-object.c
+++ b/components/services/install/lib/eazel-install-object.c
@@ -1447,7 +1447,7 @@ eazel_install_emit_preflight_check (EazelInstall *service,
if (eazel_install_get_ei2 (service) || pack->toplevel) {
packages_in_signal = g_list_prepend (packages_in_signal, pack);
- }
+ }
}
gtk_signal_emit (GTK_OBJECT (service),
diff --git a/components/services/install/lib/eazel-install-protocols.c b/components/services/install/lib/eazel-install-protocols.c
index 34c3776e6..59656f382 100644
--- a/components/services/install/lib/eazel-install-protocols.c
+++ b/components/services/install/lib/eazel-install-protocols.c
@@ -50,9 +50,6 @@
#include <libgnomevfs/gnome-vfs.h>
#endif /* EAZEL_INSTALL_SLIM */
-/* evil evil hack because RPM doesn't understand that a package for i386 is still okay to run on i686! */
-#define ASSUME_ix86_IS_i386
-
typedef struct {
EazelInstall *service;
const PackageData *package;
diff --git a/components/services/install/lib/eazel-install-rpm-glue.c b/components/services/install/lib/eazel-install-rpm-glue.c
index 29074866c..8816308a3 100644
--- a/components/services/install/lib/eazel-install-rpm-glue.c
+++ b/components/services/install/lib/eazel-install-rpm-glue.c
@@ -79,6 +79,7 @@ packagedata_new_from_rpm_conflict_reversed (struct rpmDependencyConflict conflic
return result;
}
+#if 0
/*
Adds the headers to the package system set
*/
@@ -204,7 +205,7 @@ eazel_install_rpm_create_requirement (EazelInstall *service,
}
}
}
-
+#endif
/* This is the function to do the RPM system dependency check */
void
@@ -213,6 +214,8 @@ eazel_install_do_rpm_dependency_check (EazelInstall *service,
GList **failedpackages,
GList **requirements)
{
+ g_assert_not_reached ();
+#if 0
int iterator;
rpmTransactionSet set;
int num_conflicts;
@@ -239,7 +242,7 @@ eazel_install_do_rpm_dependency_check (EazelInstall *service,
rpmdepCheck (set, &conflicts, &num_conflicts);
eazel_package_system_rpm3_close_dbs (EAZEL_PACKAGE_SYSTEM_RPM3 (service->private->package_system));
- /* FIXME bugzilla.eazel.com 1512:
+ /* FIXME bugzilla.eazel.com 1512 (BUG OBSOLETED, DON'T REOPEN <eskil, 20010129>)
This piece of code is rpm specific. It has some generic algorithm
for doing the dep stuff, but it's rpm entangled */
@@ -463,4 +466,5 @@ eazel_install_do_rpm_dependency_check (EazelInstall *service,
trilobite_debug ("eazel_install_do_rpm_dependency_check ended with %d fails and %d requirements",
g_list_length (*failedpackages),
g_list_length (*requirements));
+#endif
}
diff --git a/components/services/install/lib/eazel-install-xml-package-list.c b/components/services/install/lib/eazel-install-xml-package-list.c
index f86aa5f69..1af479bcb 100644
--- a/components/services/install/lib/eazel-install-xml-package-list.c
+++ b/components/services/install/lib/eazel-install-xml-package-list.c
@@ -125,10 +125,17 @@ parse_package (xmlNode* package, gboolean set_toplevel) {
depend = parse_package (dep, FALSE);
packagedata_add_pack_to_soft_depends (rv, depend);
} else if (g_strcasecmp (dep->name, "BREAKS") == 0) {
+ /* FIXME: bugzilla.eazel.com 1542
+ This needs to parse all of the stuff, letting robey handle
+ this as part of bug 1542. Right now I just get the borked
+ package, the files/feature info is lost
+ */
PackageData* depend;
-
+ PackageBreaks *breakage = packagebreaks_new ();
+
depend = parse_package (dep, FALSE);
- packagedata_add_pack_to_breaks (rv, depend);
+ packagebreaks_set_package (breakage, depend);
+ packagedata_add_to_breaks (rv, breakage);
} else if (g_strcasecmp (dep->name, "MODIFIES") == 0) {
PackageData* depend;
@@ -552,6 +559,7 @@ eazel_install_packagedata_to_xml_int (const PackageData *pack,
} else {
root = xmlNewNode (NULL, "PACKAGE");
}
+
node = xmlNewChild (root, NULL, "NAME", pack->name);
node = xmlNewChild (root, NULL, "VERSION", pack->version);
node = xmlNewChild (root, NULL, "MINOR", pack->minor);
@@ -594,32 +602,32 @@ eazel_install_packagedata_to_xml_int (const PackageData *pack,
}
node = xmlNewChild (root, NULL, "PROVIDES", tmp);
}
-
+
for (iterator = pack->depends; iterator; iterator = iterator->next) {
- if (g_list_find (*path, ((PackageDependency*)iterator->data)->package) == NULL) {
- (*path) = g_list_prepend (*path, ((PackageDependency*)iterator->data)->package);
- eazel_install_packagedata_to_xml_int (((PackageDependency*)iterator->data)->package,
+ if (g_list_find (*path, PACKAGEDEPENDENCY (iterator->data)->package) == NULL) {
+ (*path) = g_list_prepend (*path, PACKAGEDEPENDENCY (iterator->data)->package);
+ eazel_install_packagedata_to_xml_int (PACKAGEDEPENDENCY (iterator->data)->package,
"SOFT_DEPEND",
root,
include_provides,
path);
- (*path) = g_list_remove (*path, ((PackageDependency*)iterator->data)->package);
+ (*path) = g_list_remove (*path, PACKAGEDEPENDENCY (iterator->data)->package);
}
}
for (iterator = pack->soft_depends; iterator; iterator = iterator->next) {
- eazel_install_packagedata_to_xml ((PackageData*)iterator->data,
+ eazel_install_packagedata_to_xml (PACKAGEDATA (iterator->data),
"SOFT_DEPEND",
root,
include_provides);
}
for (iterator = pack->breaks; iterator; iterator = iterator->next) {
- eazel_install_packagedata_to_xml ((PackageData*)iterator->data,
+ eazel_install_packagedata_to_xml (packagebreaks_get_package (PACKAGEBREAKS (iterator->data)),
"BREAKS",
root,
include_provides);
}
for (iterator = pack->modifies; iterator; iterator = iterator->next) {
- eazel_install_packagedata_to_xml ((PackageData*)iterator->data,
+ eazel_install_packagedata_to_xml (PACKAGEDATA (iterator->data),
"MODIFIES",
root,
include_provides);
@@ -648,7 +656,7 @@ eazel_install_packagelist_to_xml (GList *packages, gboolean include_provides) {
node = xmlNewNode (NULL, "PACKAGES");
for (iterator = packages; iterator; iterator = iterator->next) {
xmlAddChild (node,
- eazel_install_packagedata_to_xml ((PackageData*)iterator->data,
+ eazel_install_packagedata_to_xml (PACKAGEDATA (iterator->data),
NULL, NULL, include_provides)
);
}
@@ -900,7 +908,6 @@ osd_parse_shared (xmlDocPtr doc)
if (g_strcasecmp (child->name, "SOFTPKG") == 0) {
PackageData *pack;
pack = osd_parse_softpkg (child);
- g_message (packagedata_dump (pack, FALSE));
if (pack) {
result = g_list_prepend (result, pack);
} else {
diff --git a/components/services/install/lib/eazel-package-system-rpm3.c b/components/services/install/lib/eazel-package-system-rpm3.c
index 450d530c6..b5dc87db8 100644
--- a/components/services/install/lib/eazel-package-system-rpm3.c
+++ b/components/services/install/lib/eazel-package-system-rpm3.c
@@ -207,6 +207,9 @@ make_rpm_argument_list (EazelPackageSystemRpm3 *system,
if (op == EAZEL_PACKAGE_SYSTEM_OPERATION_UNINSTALL) {
(*args) = g_list_prepend (*args, g_strdup ("-e"));
} else {
+#ifdef USE_PERCENT
+ (*args) = g_list_prepend (*args, g_strdup ("--percent"));
+#endif
if (flags & EAZEL_PACKAGE_SYSTEM_OPERATION_DOWNGRADE) {
(*args) = g_list_prepend (*args, g_strdup ("--oldpackage"));
}
@@ -943,11 +946,13 @@ rpm_packagedata_new_from_file (EazelPackageSystemRpm3 *system,
PackageData *pack;
pack = packagedata_new ();
+
if (rpm_packagedata_fill_from_file (system, pack, file, detail_level)==FALSE) {
trilobite_debug ("RPM3 unable to fill from file '%s'", file);
gtk_object_unref (GTK_OBJECT (pack));
pack = NULL;
}
+
return pack;
}
@@ -1051,7 +1056,7 @@ eazel_package_system_rpm3_query_impl (EazelPackageSystemRpm3 *system,
pack,
(GCompareFunc)eazel_install_package_compare)!=NULL) {
info (system, "%s already in set", pack->name);
- packagedata_destroy (pack, TRUE);
+ gtk_object_unref (GTK_OBJECT (pack));
} else {
(*result) = g_list_prepend (*result, pack);
}
@@ -1536,7 +1541,13 @@ eazel_package_system_rpm3_compare_version (EazelPackageSystem *system,
const char *a,
const char *b)
{
- return rpmvercmp (a, b);
+ int result;
+ result = rpmvercmp (a, b);
+ /* Special bandaid for M18 <> 0.7 mozilla versions */
+ if (isdigit (*a) && *b=='M') {
+ if (result < 0) { result = abs (result); }
+ }
+ return result;
}
/*****************************************
diff --git a/components/services/install/lib/eazel-package-system-types.c b/components/services/install/lib/eazel-package-system-types.c
index b20ccd340..cc02173f3 100644
--- a/components/services/install/lib/eazel-package-system-types.c
+++ b/components/services/install/lib/eazel-package-system-types.c
@@ -144,7 +144,7 @@ categorydata_destroy_foreach (CategoryData *cd, gpointer ununsed)
g_return_if_fail (cd != NULL);
if (g_list_length (cd->packages)) {
- g_list_foreach (cd->packages, (GFunc)packagedata_destroy, GINT_TO_POINTER (TRUE));
+ g_list_foreach (cd->packages, (GFunc)gtk_object_unref, NULL);
}
g_list_free (cd->packages);
cd->packages = NULL;
@@ -194,61 +194,50 @@ categorylist_flatten_to_packagelist (GList *categories)
}
/*************************************************************************************************/
-static void
-packagedata_class_initialize (PackageDataClass *klass)
+
+PackageDependency *
+packagedependency_new (void)
{
- GtkObjectClass *object_class;
+ PackageDependency *dep;
- object_class = (GtkObjectClass*)klass;
- object_class->finalize = packagedata_finalize;
+ dep = g_new0 (PackageDependency, 1);
+ dep->package = NULL;
+ dep->version = NULL;
+ return dep;
}
-static void
-packagedata_initialize (PackageData *package) {
- g_assert (package!=NULL);
- g_assert (IS_PACKAGEDATA (package));
-
+PackageDependency *
+packagedependency_copy (const PackageDependency *dep, gboolean deep)
+{
+ PackageDependency *newdep;
-#ifdef DEBUG_PACKAGE_ALLOCS
- package_allocs ++;
- if (report_all) trilobite_debug ("package_allocs inced to %d (0x%p)", package_allocs, package);
- if (!at_exit_registered) {
- atexit (&at_exit_package_data_info);
- at_exit_registered = TRUE;
+ newdep = g_new0 (PackageDependency, 1);
+ newdep->sense = dep->sense;
+ newdep->version = g_strdup (dep->version);
+ if (dep->package != NULL) {
+ newdep->package = packagedata_copy (dep->package, deep);
}
- packages_allocated = g_list_prepend (packages_allocated, package);
-#endif /* DEBUG_PACKAGE_ALLOCS */
-
- package->name = NULL;
- package->version = NULL;
- package->minor = NULL;
- package->archtype = NULL;
- package->source_package = FALSE;
- package->summary = NULL;
- package->description = NULL;
- package->bytesize = 0;
- package->filesize = 0;
- package->distribution = trilobite_get_distribution ();
- package->filename = NULL;
- package->eazel_id = NULL;
- package->suite_id = NULL;
- package->remote_url = NULL;
- package->conflicts_checked = FALSE;
- package->install_root = NULL;
- package->provides = NULL;
- package->soft_depends = NULL;
- package->breaks = NULL;
- package->modifies = NULL;
- package->depends = NULL;
- package->status = PACKAGE_UNKNOWN_STATUS;
- package->modify_status = PACKAGE_MOD_UNTOUCHED;
- package->md5 = NULL;
- package->packsys_struc = NULL;
- package->features = NULL;
- package->fillflag = PACKAGE_FILL_INVALID;
+ return newdep;
}
void
+packagedependency_destroy (PackageDependency *dep)
+{
+ if (dep->package) {
+ gtk_object_unref (GTK_OBJECT (dep->package));
+ }
+ dep->package = NULL;
+ g_free (dep->version);
+ dep->version = NULL;
+ dep->sense = 0;
+ g_free (dep);
+}
+
+/**********************************************************************************
+ GTK+ crap for PackageData objects
+ **********************************************************************************/
+
+static void
packagedata_finalize (GtkObject *obj)
{
PackageData *pack = PACKAGEDATA (obj);
@@ -310,19 +299,18 @@ packagedata_finalize (GtkObject *obj)
g_list_foreach (pack->depends, (GFunc)packagedependency_destroy, GINT_TO_POINTER (FALSE));
g_list_free (pack->depends);
+ pack->depends = NULL;
g_list_foreach (pack->soft_depends, (GFunc)gtk_object_unref, NULL);
g_list_free (pack->soft_depends);
+ pack->soft_depends = NULL;
g_list_foreach (pack->breaks, (GFunc)gtk_object_unref, NULL);
g_list_free (pack->breaks);
+ pack->breaks = NULL;
g_list_foreach (pack->modifies, (GFunc)gtk_object_unref, NULL);
g_list_free (pack->modifies);
-
- pack->soft_depends = NULL;
- pack->depends = NULL;
- pack->breaks = NULL;
pack->modifies = NULL;
if (pack->packsys_struc) {
@@ -335,42 +323,58 @@ packagedata_finalize (GtkObject *obj)
}
}
-PackageDependency *
-packagedependency_new (void)
+static void
+packagedata_class_initialize (PackageDataClass *klass)
{
- PackageDependency *dep;
+ GtkObjectClass *object_class;
- dep = g_new0 (PackageDependency, 1);
- dep->package = NULL;
- dep->version = NULL;
- return dep;
+ object_class = (GtkObjectClass*)klass;
+ object_class->finalize = packagedata_finalize;
}
-PackageDependency *
-packagedependency_copy (const PackageDependency *dep, gboolean deep)
-{
- PackageDependency *newdep;
+static void
+packagedata_initialize (PackageData *package) {
+ g_assert (package!=NULL);
+ g_assert (IS_PACKAGEDATA (package));
- newdep = g_new0 (PackageDependency, 1);
- newdep->sense = dep->sense;
- newdep->version = g_strdup (dep->version);
- if (dep->package != NULL) {
- newdep->package = packagedata_copy (dep->package, deep);
- }
- return newdep;
-}
-void
-packagedependency_destroy (PackageDependency *dep)
-{
- if (dep->package) {
- gtk_object_unref (GTK_OBJECT (dep->package));
+#ifdef DEBUG_PACKAGE_ALLOCS
+ package_allocs ++;
+ if (report_all) trilobite_debug ("package_allocs inced to %d (0x%p)", package_allocs, package);
+ if (!at_exit_registered) {
+ atexit (&at_exit_package_data_info);
+ at_exit_registered = TRUE;
}
- dep->package = NULL;
- g_free (dep->version);
- dep->version = NULL;
- dep->sense = 0;
- g_free (dep);
+ packages_allocated = g_list_prepend (packages_allocated, package);
+#endif /* DEBUG_PACKAGE_ALLOCS */
+
+ package->name = NULL;
+ package->version = NULL;
+ package->minor = NULL;
+ package->archtype = NULL;
+ package->source_package = FALSE;
+ package->summary = NULL;
+ package->description = NULL;
+ package->bytesize = 0;
+ package->filesize = 0;
+ package->distribution = trilobite_get_distribution ();
+ package->filename = NULL;
+ package->eazel_id = NULL;
+ package->suite_id = NULL;
+ package->remote_url = NULL;
+ package->conflicts_checked = FALSE;
+ package->install_root = NULL;
+ package->provides = NULL;
+ package->soft_depends = NULL;
+ package->breaks = NULL;
+ package->modifies = NULL;
+ package->depends = NULL;
+ package->status = PACKAGE_UNKNOWN_STATUS;
+ package->modify_status = PACKAGE_MOD_UNTOUCHED;
+ package->md5 = NULL;
+ package->packsys_struc = NULL;
+ package->features = NULL;
+ package->fillflag = PACKAGE_FILL_INVALID;
}
GtkType
@@ -411,6 +415,8 @@ packagedata_new ()
return package;
}
+/**********************************************************************************/
+
GList *
packagedata_list_copy (const GList *list, gboolean deep)
{
@@ -461,6 +467,7 @@ packagedata_copy (const PackageData *pack, gboolean deep)
result->install_root = g_strdup (pack->install_root);
result->eazel_id = g_strdup (pack->eazel_id);
result->suite_id = g_strdup (pack->suite_id);
+ result->md5 = g_strdup (pack->md5);
result->toplevel = pack->toplevel;
result->status = pack->status;
@@ -476,7 +483,11 @@ packagedata_copy (const PackageData *pack, gboolean deep)
result->soft_depends = packagedata_list_copy (pack->soft_depends, TRUE);
result->depends = packagedata_deplist_copy (pack->depends, TRUE);
result->modifies = packagedata_list_copy (pack->modifies, TRUE);
- result->breaks = packagedata_list_copy (pack->breaks, TRUE);
+
+ /* Sloppy, just ref and copy the pointer rather then copying the
+ object */
+ g_list_foreach (pack->breaks, (GFunc)gtk_object_ref, NULL);
+ result->breaks = g_list_copy (pack->breaks);
for (ptr = pack->provides; ptr; ptr = g_list_next (ptr)) {
result->provides = g_list_prepend (result->provides, g_strdup (ptr->data));
@@ -560,18 +571,6 @@ packagedata_fill_in_missing (PackageData *package, const PackageData *full_packa
}
void
-packagedata_destroy (PackageData *pack, gboolean deep)
-{
- if (deep) {
- g_list_foreach (pack->soft_depends, (GFunc)packagedata_destroy, GINT_TO_POINTER (deep));
- g_list_foreach (pack->breaks, (GFunc)packagedata_destroy, GINT_TO_POINTER (deep));
- g_list_foreach (pack->modifies, (GFunc)packagedata_destroy, GINT_TO_POINTER (deep));
- }
-
- gtk_object_unref (GTK_OBJECT (pack));
-}
-
-void
packagedata_remove_soft_dep (PackageData *remove,
PackageData *from)
{
@@ -580,7 +579,7 @@ packagedata_remove_soft_dep (PackageData *remove,
trilobite_debug ("removing %s from %s's deps", remove->name, from->name);
from->soft_depends = g_list_remove (from->soft_depends, remove);
- packagedata_destroy (remove, TRUE);
+ gtk_object_unref (GTK_OBJECT (remove));
}
const char*
@@ -647,13 +646,13 @@ packagedata_get_readable_name (const PackageData *pack)
} else if ((pack->name != NULL) && (pack->version != NULL)) {
/* This is a hack to shorten EazelSourceSnapshot names
into the build date/time */
- if (strstr (pack->version, "Eazel")!=NULL && strstr (pack->version, ".200") != NULL) {
+ if (strstr (pack->version, "Eazel")!=NULL && strstr (pack->minor, ".200") != NULL) {
char *month[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"};
char *temp, *temp2;
int mo, da, ho, mi;
/* this crap is too long to display ! */
- temp = g_strdup (pack->version);
+ temp = g_strdup (pack->minor);
temp2 = strstr (temp, ".200");
strcpy (temp2, "ESS");
temp2 += strlen (".200x");
@@ -824,18 +823,17 @@ packagedata_modstatus_str_to_enum (const char *st)
}
static void
-packagedata_add_pack_to (GList **list, PackageData *pack) {
- (*list) = g_list_prepend (*list, pack);
- gtk_object_ref (GTK_OBJECT (pack));
+packagedata_add_pack_to (GList **list, GtkObject *b) {
+ gtk_object_ref (b);
+ (*list) = g_list_prepend (*list, b);
}
void
-packagedata_add_pack_to_breaks (PackageData *pack, PackageData *b)
+packagedata_add_to_breaks (PackageData *pack, PackageBreaks *b)
{
g_assert (pack);
g_assert (b);
- g_assert(pack != b);
- packagedata_add_pack_to (&pack->breaks, b);
+ packagedata_add_pack_to (&pack->breaks, GTK_OBJECT (b));
}
void
@@ -844,7 +842,7 @@ packagedata_add_pack_to_soft_depends (PackageData *pack, PackageData *b)
g_assert (pack);
g_assert (b);
g_assert (pack != b);
- packagedata_add_pack_to (&pack->soft_depends, b);
+ packagedata_add_pack_to (&pack->soft_depends, GTK_OBJECT (b));
}
void
@@ -853,7 +851,7 @@ packagedata_add_pack_to_modifies (PackageData *pack, PackageData *b)
g_assert (pack);
g_assert (b);
g_assert (pack != b);
- packagedata_add_pack_to (&pack->modifies, b);
+ packagedata_add_pack_to (&pack->modifies, GTK_OBJECT (b));
}
static void
@@ -916,7 +914,7 @@ packagedata_list_prune (GList **input,
if (in_it && in) {
(*input) = g_list_remove (*input, in);
if (destroy) {
- packagedata_destroy (in, deep);
+ gtk_object_unref (GTK_OBJECT (in));
}
}
}
@@ -1295,6 +1293,44 @@ dump_package_deplist (GString *out, const GList *list, gboolean deep, int indent
}
/* useful debugging tool: dump a packagedata struct into a string */
+
+static void
+add_string_list (GString *out, GList *list, int indent, char *title)
+{
+ GList *fit;
+ for (fit = list; fit; fit = g_list_next (fit)) {
+ gstr_indent (out, indent);
+ g_string_sprintfa (out, "\t%s : %s\n", title, (char*)fit->data);
+ }
+}
+
+static void
+dump_package_break_list (GString *out, GList *breaks, gboolean deep, int indent)
+{
+ GList *iterator;
+
+ for (iterator = breaks; iterator; iterator = g_list_next (iterator)) {
+ PackageBreaks *breakage = PACKAGEBREAKS (iterator->data);
+ char *readable_name = packagedata_get_readable_name (packagebreaks_get_package (breakage));
+
+ gstr_indent (out, indent);
+
+ g_string_sprintfa (out, "Breaks : %s\n", readable_name);
+ if (IS_PACKAGEFEATUREMISSING (breakage)) {
+ add_string_list (out,
+ PACKAGEFILECONFLICT (breakage)->files,
+ indent,
+ "FeautureMissing");
+ } else if (IS_PACKAGEFILECONFLICT (breakage)) {
+ add_string_list (out,
+ PACKAGEFEATUREMISSING (breakage)->features,
+ indent,
+ "FeautureMissing");
+ }
+
+ }
+}
+
static char *
packagedata_dump_int (const PackageData *package, gboolean deep, int indent)
{
@@ -1408,7 +1444,7 @@ packagedata_dump_int (const PackageData *package, gboolean deep, int indent)
if (package->breaks != NULL) {
gstr_indent (out, indent);
g_string_sprintfa (out, "Breaks: ");
- dump_package_list (out, package->breaks, deep, indent);
+ dump_package_break_list (out, package->breaks, deep, indent);
g_string_sprintfa (out, "\n");
}
@@ -1424,3 +1460,223 @@ packagedata_dump (const PackageData *package, gboolean deep)
{
return packagedata_dump_int (package, deep, 0);
}
+
+
+/**********************************************************************************
+ GTK+ crap for PackageBreaks objects
+ **********************************************************************************/
+
+static void
+packagebreaks_finalize (GtkObject *obj)
+{
+ PackageBreaks *breaks = PACKAGEBREAKS (obj);
+ gtk_object_unref (GTK_OBJECT (breaks->__package));
+ trilobite_debug ("I'm DYING! %p", obj);
+}
+
+static void
+packagebreaks_class_initialize (PackageBreaksClass *klass)
+{
+ GtkObjectClass *object_class;
+
+ object_class = (GtkObjectClass*)klass;
+ object_class->finalize = packagebreaks_finalize;
+}
+
+static void
+packagebreaks_initialize (PackageBreaks *breaks)
+{
+ g_assert (breaks);
+ g_assert (IS_PACKAGEBREAKS (breaks));
+ breaks->__package = NULL;
+}
+
+GtkType
+packagebreaks_get_type (void)
+{
+ static GtkType object_type = 0;
+
+ /* First time it's called ? */
+ if (!object_type)
+ {
+ static const GtkTypeInfo object_info =
+ {
+ "PackageBreaks",
+ sizeof (PackageBreaks),
+ sizeof (PackageBreaksClass),
+ (GtkClassInitFunc) packagebreaks_class_initialize,
+ (GtkObjectInitFunc) packagebreaks_initialize,
+ /* reserved_1 */ NULL,
+ /* reserved_2 */ NULL,
+ (GtkClassInitFunc) NULL,
+ };
+
+ object_type = gtk_type_unique (gtk_object_get_type (), &object_info);
+ }
+
+ return object_type;
+}
+
+PackageBreaks*
+packagebreaks_new (void)
+{
+ PackageBreaks *result;
+
+ result = PACKAGEBREAKS (gtk_object_new (TYPE_PACKAGEBREAKS, NULL));
+ gtk_object_ref (GTK_OBJECT (result));
+ gtk_object_sink (GTK_OBJECT (result));
+
+ return result;
+}
+void
+packagebreaks_set_package (PackageBreaks *breaks,
+ PackageData *pack)
+{
+ if (breaks->__package) {
+ gtk_object_unref (GTK_OBJECT (pack));
+ }
+ gtk_object_ref (GTK_OBJECT (pack));
+ breaks->__package = pack;
+}
+
+PackageData *
+packagebreaks_get_package (PackageBreaks *breaks)
+{
+ return breaks->__package;
+}
+
+/**********************************************************************************/
+
+/**********************************************************************************
+ GTK+ crap for PackageFileConflict objects
+ **********************************************************************************/
+
+static void
+packagefileconflict_finalize (GtkObject *obj)
+{
+ PackageFileConflict *conflict = PACKAGEFILECONFLICT (obj);
+ g_list_foreach (conflict->files, (GFunc)g_free, NULL);
+}
+
+static void
+packagefileconflict_class_initialize (PackageFileConflictClass *klass)
+{
+ GtkObjectClass *object_class;
+
+ object_class = (GtkObjectClass*)klass;
+ object_class->finalize = packagefileconflict_finalize;
+}
+
+static void
+packagefileconflict_initialize (PackageFileConflict *fileconflict)
+{
+ g_assert (fileconflict);
+ g_assert (IS_PACKAGEFILECONFLICT (fileconflict));
+}
+
+GtkType
+packagefileconflict_get_type (void)
+{
+ static GtkType object_type = 0;
+
+ /* First time it's called ? */
+ if (!object_type)
+ {
+ static const GtkTypeInfo object_info =
+ {
+ "PackageFileConflict",
+ sizeof (PackageFileConflict),
+ sizeof (PackageFileConflictClass),
+ (GtkClassInitFunc) packagefileconflict_class_initialize,
+ (GtkObjectInitFunc) packagefileconflict_initialize,
+ /* reserved_1 */ NULL,
+ /* reserved_2 */ NULL,
+ (GtkClassInitFunc) NULL,
+ };
+
+ object_type = gtk_type_unique (packagebreaks_get_type (), &object_info);
+ }
+
+ return object_type;
+}
+
+PackageFileConflict*
+packagefileconflict_new (void)
+{
+ PackageFileConflict *result;
+
+ result = PACKAGEFILECONFLICT (gtk_object_new (TYPE_PACKAGEFILECONFLICT, NULL));
+ gtk_object_ref (GTK_OBJECT (result));
+ gtk_object_sink (GTK_OBJECT (result));
+
+ return result;
+}
+
+/**********************************************************************************/
+
+/**********************************************************************************
+ GTK+ crap for PackageFeatureMissing objects
+ **********************************************************************************/
+
+static void
+packagefeaturemissing_finalize (GtkObject *obj)
+{
+ PackageFeatureMissing *conflict = PACKAGEFEATUREMISSING (obj);
+ g_list_foreach (conflict->features, (GFunc)g_free, NULL);
+}
+
+static void
+packagefeaturemissing_class_initialize (PackageFeatureMissingClass *klass)
+{
+ GtkObjectClass *object_class;
+
+ object_class = (GtkObjectClass*)klass;
+ object_class->finalize = packagefeaturemissing_finalize;
+}
+
+static void
+packagefeaturemissing_initialize (PackageFeatureMissing *breaks)
+{
+ g_assert (breaks);
+ g_assert (IS_PACKAGEFEATUREMISSING (breaks));
+}
+
+GtkType
+packagefeaturemissing_get_type (void)
+{
+ static GtkType object_type = 0;
+
+ /* First time it's called ? */
+ if (!object_type)
+ {
+ static const GtkTypeInfo object_info =
+ {
+ "PackageFeatureMissing",
+ sizeof (PackageFeatureMissing),
+ sizeof (PackageFeatureMissingClass),
+ (GtkClassInitFunc) packagefeaturemissing_class_initialize,
+ (GtkObjectInitFunc) packagefeaturemissing_initialize,
+ /* reserved_1 */ NULL,
+ /* reserved_2 */ NULL,
+ (GtkClassInitFunc) NULL,
+ };
+
+ object_type = gtk_type_unique (packagebreaks_get_type (), &object_info);
+ }
+
+ return object_type;
+}
+
+PackageFeatureMissing*
+packagefeaturemissing_new (void)
+{
+ PackageFeatureMissing *result;
+
+ result = PACKAGEFEATUREMISSING (gtk_object_new (TYPE_PACKAGEFEATUREMISSING, NULL));
+ gtk_object_ref (GTK_OBJECT (result));
+ gtk_object_sink (GTK_OBJECT (result));
+
+ return result;
+}
+
+/**********************************************************************************/
diff --git a/components/services/install/lib/eazel-package-system-types.h b/components/services/install/lib/eazel-package-system-types.h
index 4c2733355..4428f0cb7 100644
--- a/components/services/install/lib/eazel-package-system-types.h
+++ b/components/services/install/lib/eazel-package-system-types.h
@@ -186,7 +186,7 @@ struct _PackageData {
char* description;
GList* soft_depends;
GList* depends; /* GList<PackageDependency *> */
- GList* breaks;
+ GList* breaks; /* GList<PackageBreaks*> */
char *filename;
char *remote_url; /* url where we can get this rpm */
@@ -246,7 +246,6 @@ struct _PackageData {
PackageData* packagedata_new (void);
GtkType packagedata_get_type (void);
-void packagedata_finalize (GtkObject *obj);
PackageData* packagedata_new_from_file (const char *file);
PackageData* packagedata_copy (const PackageData *pack, gboolean deep);
@@ -267,14 +266,8 @@ char *packagedata_get_readable_name (const PackageData *pack);
from a given package, real meanign name[-version-[release]] string */
char *packagedata_get_name (const PackageData *pack);
-void packagedata_destroy (PackageData *pd, gboolean deep);
-
int packagedata_hash_equal (PackageData *a, PackageData *b);
-void packagedata_add_pack_to_breaks (PackageData *pack, PackageData *b);
-void packagedata_add_pack_to_soft_depends (PackageData *pack, PackageData *b);
-void packagedata_add_pack_to_modifies (PackageData *pack, PackageData *b);
-
GList *flatten_packagedata_dependency_tree (GList *packages);
/* all elements in "remove_list" that matches elements in "input" list
@@ -309,9 +302,85 @@ void packagedependency_destroy (PackageDependency *dep);
#define PACKAGEDEPENDENCY(obj) ((PackageDependency*)(obj))
#define IS_PACKAGEDEPENDENCY(obj) (1)
+
+/*************************************************************************************************/
+
+#define TYPE_PACKAGEBREAKS (packagebreaks_get_type ())
+#define PACKAGEBREAKS(obj) (GTK_CHECK_CAST ((obj), TYPE_PACKAGEBREAKS, PackageBreaks))
+#define PACKAGEBREAKS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_PACKAGEBREAKS, PackageBreaksClass))
+#define IS_PACKAGEBREAKS(obj) (GTK_CHECK_TYPE ((obj), TYPE_PACKAGEBREAKS))
+#define IS_PACKAGEBREAKS_CLASS(klass)(GTK_CHECK_CLASS_TYPE ((klass), TYPE_PACKAGEBREAKS))
+
+typedef struct _PackageBreaks PackageBreaks;
+typedef struct _PackageBreaksClass PackageBreaksClass;
+
+struct _PackageBreaksClass {
+ GtkObjectClass parent_class;
+};
+
+struct _PackageBreaks {
+ GtkObject parent;
+ PackageData *__package;
+};
+
+PackageBreaks* packagebreaks_new (void);
+GtkType packagebreaks_get_type (void);
+void packagebreaks_set_package (PackageBreaks *breaks, PackageData *pack);
+PackageData *packagebreaks_get_package (PackageBreaks *breaks);
+
+#define TYPE_PACKAGEFILECONFLICT (packagefileconflict_get_type ())
+#define PACKAGEFILECONFLICT(obj) (GTK_CHECK_CAST ((obj), TYPE_PACKAGEFILECONFLICT, PackageFileConflict))
+#define PACKAGEFILECONFLICT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_PACKAGEFILECONFLICT, PackageFileConflictClass))
+#define IS_PACKAGEFILECONFLICT(obj) (GTK_CHECK_TYPE ((obj), TYPE_PACKAGEFILECONFLICT))
+#define IS_PACKAGEFILECONFLICT_CLASS(klass)(GTK_CHECK_CLASS_TYPE ((klass), TYPE_PACKAGEFILECONFLICT))
+
+typedef struct _PackageFileConflict PackageFileConflict;
+typedef struct _PackageFileConflictClass PackageFileConflictClass;
+
+struct _PackageFileConflictClass {
+ PackageBreaksClass parent_class;
+};
+
+struct _PackageFileConflict {
+ PackageBreaks parent;
+ GList *files;
+};
+
+PackageFileConflict* packagefileconflict_new (void);
+GtkType packagefileconflict_get_type (void);
+
+#define TYPE_PACKAGEFEATUREMISSING (packagefeaturemissing_get_type ())
+#define PACKAGEFEATUREMISSING(obj) (GTK_CHECK_CAST ((obj), TYPE_PACKAGEFEATUREMISSING, PackageFeatureMissing))
+#define PACKAGEFEATUREMISSING_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_PACKAGEFEATUREMISSING, PackageFeatureMissingClass))
+#define IS_PACKAGEFEATUREMISSING(obj) (GTK_CHECK_TYPE ((obj), TYPE_PACKAGEFEATUREMISSING))
+#define IS_PACKAGEFEATUREMISSING_CLASS(klass)(GTK_CHECK_CLASS_TYPE ((klass), TYPE_PACKAGEFEATUREMISSING))
+
+typedef struct _PackageFeatureMissing PackageFeatureMissing;
+typedef struct _PackageFeatureMissingClass PackageFeatureMissingClass;
+
+struct _PackageFeatureMissingClass {
+ PackageBreaksClass parent_class;
+};
+
+struct _PackageFeatureMissing {
+ PackageBreaks parent;
+ GList *features;
+};
+
+PackageFeatureMissing* packagefeaturemissing_new (void);
+GtkType packagefeaturemissing_get_type (void);
+
+
+/*************************************************************************************************/
+
+void packagedata_add_to_breaks (PackageData *pack, PackageBreaks *b);
+void packagedata_add_pack_to_breaks (PackageData *pack, PackageData *b);
+void packagedata_add_pack_to_soft_depends (PackageData *pack, PackageData *b);
+void packagedata_add_pack_to_modifies (PackageData *pack, PackageData *b);
+
/*************************************************************************************************/
+/* FIXME: deprecating eazel-install-logic.c will also deprecate this structure */
- /* OBSOLETE */
typedef struct {
PackageData *package;
PackageData *required;
diff --git a/components/services/install/lib/eazel-package-system.c b/components/services/install/lib/eazel-package-system.c
index d77d3c89a..baf5d7d0a 100644
--- a/components/services/install/lib/eazel-package-system.c
+++ b/components/services/install/lib/eazel-package-system.c
@@ -212,7 +212,7 @@ eazel_package_system_is_installed (EazelPackageSystem *package_system,
} else {
result = TRUE;
}
- g_list_foreach (matches, (GFunc)packagedata_destroy, GINT_TO_POINTER (TRUE));
+ g_list_foreach (matches, (GFunc)gtk_object_unref, NULL);
}
g_list_free (matches);
diff --git a/components/services/install/lib/eazel-softcat.c b/components/services/install/lib/eazel-softcat.c
index 1766613e2..293183072 100644
--- a/components/services/install/lib/eazel-softcat.c
+++ b/components/services/install/lib/eazel-softcat.c
@@ -502,7 +502,7 @@ get_search_url_for_package (EazelSoftCat *softcat, const PackageData *package, i
if (dist.name != DISTRO_UNKNOWN) {
dist_name = trilobite_get_distribution_name (dist, TRUE, TRUE);
- add_to_url (url, "&distro=", "RedHat62");
+ add_to_url (url, "&distro=", dist_name);
g_free (dist_name);
}
/* FIXME: should let them specify a protocol other than http, someday */
@@ -657,16 +657,28 @@ out:
gboolean
eazel_softcat_available_update (EazelSoftCat *softcat, PackageData *oldpack, PackageData **newpack, int fill_flags)
{
- *newpack = packagedata_new ();
- (*newpack)->name = g_strdup (oldpack->name);
- (*newpack)->version = g_strdup (oldpack->version);
- (*newpack)->distribution = oldpack->distribution;
- (*newpack)->archtype = g_strdup (oldpack->archtype);
-
- if (eazel_softcat_get_info (softcat, *newpack, EAZEL_SOFTCAT_SENSE_GT, fill_flags) != EAZEL_SOFTCAT_SUCCESS) {
- packagedata_destroy (*newpack, TRUE);
- *newpack = NULL;
- return FALSE;
- }
- return TRUE;
+ PackageData *tmp_pack;
+ gboolean result = TRUE;
+
+ tmp_pack = packagedata_new ();
+ tmp_pack->name = g_strdup (oldpack->name);
+ tmp_pack->version = g_strdup (oldpack->version);
+ tmp_pack->distribution = oldpack->distribution;
+ tmp_pack->archtype = g_strdup (oldpack->archtype);
+
+ if (eazel_softcat_get_info (softcat, tmp_pack, EAZEL_SOFTCAT_SENSE_GT, fill_flags) != EAZEL_SOFTCAT_SUCCESS) {
+ result = FALSE;
+ }
+
+ if (newpack!=NULL && result==TRUE) {
+ (*newpack) = tmp_pack;
+ } else {
+ gtk_object_unref (GTK_OBJECT (tmp_pack));
+ /* Null in case it's givin */
+ if (newpack!=NULL) {
+ (*newpack) = NULL;
+ }
+ }
+
+ return result;
}
diff --git a/components/services/install/nautilus-view/nautilus-service-install-view.c b/components/services/install/nautilus-view/nautilus-service-install-view.c
index 2cd4db4b8..747d2ec12 100644
--- a/components/services/install/nautilus-view/nautilus-service-install-view.c
+++ b/components/services/install/nautilus-view/nautilus-service-install-view.c
@@ -1506,7 +1506,7 @@ nautilus_service_install_view_update_from_uri (NautilusServiceInstallView *view,
pack = (PackageData*) gtk_object_get_data (GTK_OBJECT (view), "packagedata");
if (pack != NULL) {
/* Destroy the old */
- packagedata_destroy (pack, TRUE);
+ gtk_object_unref (GTK_OBJECT (pack));
}
/* find the package data for the package we're about to install */