Commit 57c6a44a authored by Eskil Heyn Olsen's avatar Eskil Heyn Olsen
Browse files

Added eazel_install_uninstall call to the gtk+ object. This opened a can


	* components/services/install/lib/eazel-install-object.c:
	(eazel_install_uninstall):
	* components/services/install/lib/eazel-install-public.h:
	Added eazel_install_uninstall call to the gtk+ object. This
	opened a can of worms reg. error during uninstall, which is
	also relevant to install. See bug#1024.

	* components/services/install/lib/eazel-install-rpm-glue.c:
	(install_new_packages), (download_a_package),
	(download_all_packages), (install_all_packages),
	(uninstall_packages), (uninstall_a_package), (do_rpm_uninstall),
	(rpm_uninstall):
	More passing around of a EazelService object. And more sane
	errorhandling to avoid the lib causing an exit.

	* nautilus-installer/src/installer.c: (installer):
	Partial uninstall support.
parent 0e92e4c0
2000-05-27 Eskil Heyn Olsen <eskil@eazel.com>
* components/services/install/lib/eazel-install-object.c:
(eazel_install_uninstall):
* components/services/install/lib/eazel-install-public.h:
Added eazel_install_uninstall call to the gtk+ object. This
opened a can of worms reg. error during uninstall, which is
also relevant to install. See bug#1024.
* components/services/install/lib/eazel-install-rpm-glue.c:
(install_new_packages), (download_a_package),
(download_all_packages), (install_all_packages),
(uninstall_packages), (uninstall_a_package), (do_rpm_uninstall),
(rpm_uninstall):
More passing around of a EazelService object. And more sane
errorhandling to avoid the lib causing an exit.
* nautilus-installer/src/installer.c: (installer):
Partial uninstall support.
2000-05-27 Eskil Heyn Olsen <eskil@eazel.com> 2000-05-27 Eskil Heyn Olsen <eskil@eazel.com>
* components/services/time/command-line/Makefile.am: * components/services/time/command-line/Makefile.am:
......
...@@ -515,6 +515,21 @@ eazel_install_new_packages (EazelInstall *service) ...@@ -515,6 +515,21 @@ eazel_install_new_packages (EazelInstall *service)
} }
} }
void
eazel_install_uninstall (EazelInstall *service)
{
SANITY (service);
g_message ("eazel_install_new_packages");
if (service->private->iopts->protocol == PROTOCOL_HTTP) {
fetch_remote_package_list (service);
}
if (uninstall_packages (service)==FALSE) {
g_warning ("*** Uninstall failed");
}
}
/* Welcome to define madness. These are all the get/set methods. There is nothing of /* Welcome to define madness. These are all the get/set methods. There is nothing of
interest beyond this point, except for a fucking big dragon*/ interest beyond this point, except for a fucking big dragon*/
......
...@@ -100,6 +100,7 @@ void eazel_install_emit_download_progress (EazelInstall *service, ...@@ -100,6 +100,7 @@ void eazel_install_emit_download_progress (EazelInstall *service,
void eazel_install_fetch_pockage_list (EazelInstall *service); void eazel_install_fetch_pockage_list (EazelInstall *service);
void eazel_install_new_packages (EazelInstall *service); void eazel_install_new_packages (EazelInstall *service);
void eazel_install_uninstall (EazelInstall *service);
/******************************************************************************/ /******************************************************************************/
/* Beware, from hereonafter, it's #def madness, to make the get/set functions */ /* Beware, from hereonafter, it's #def madness, to make the get/set functions */
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
typedef void (*rpm_install_cb)(char* name, char* group, void* user_data); typedef void (*rpm_install_cb)(char* name, char* group, void* user_data);
static void download_a_package (EazelInstall *service, static gboolean download_a_package (EazelInstall *service,
PackageData* package); PackageData* package);
static gboolean download_all_packages (EazelInstall *service, static gboolean download_all_packages (EazelInstall *service,
...@@ -54,7 +54,8 @@ static gboolean install_all_packages (EazelInstall *service, ...@@ -54,7 +54,8 @@ static gboolean install_all_packages (EazelInstall *service,
GList* categories); GList* categories);
static gboolean uninstall_a_package (PackageData* package, static gboolean uninstall_a_package (EazelInstall *service,
PackageData* package,
int uninstall_flags, int uninstall_flags,
int problem_filters, int problem_filters,
int interface_flags); int interface_flags);
...@@ -76,7 +77,8 @@ static int rpm_install (EazelInstall *service, ...@@ -76,7 +77,8 @@ static int rpm_install (EazelInstall *service,
rpm_install_cb callback, rpm_install_cb callback,
void* user_data); void* user_data);
static int rpm_uninstall (char* root_dir, static int rpm_uninstall (EazelInstall *service,
char* root_dir,
char* file, char* file,
int install_flags, int install_flags,
int problem_filters, int problem_filters,
...@@ -92,7 +94,8 @@ static int do_rpm_install (EazelInstall *service, ...@@ -92,7 +94,8 @@ static int do_rpm_install (EazelInstall *service,
rpm_install_cb callback, rpm_install_cb callback,
void* user_data); void* user_data);
static int do_rpm_uninstall (char* root_dir, static int do_rpm_uninstall (EazelInstall *service,
char* root_dir,
GList* packages, GList* packages,
int install_flags, int install_flags,
int problem_filters, int problem_filters,
...@@ -143,20 +146,28 @@ install_new_packages (EazelInstall *service) { ...@@ -143,20 +146,28 @@ install_new_packages (EazelInstall *service) {
rv = FALSE; rv = FALSE;
} else { } else {
rv = download_all_packages (service, categories); rv = download_all_packages (service, categories);
if (rv == TRUE) {
rv = install_all_packages (service, rv = install_all_packages (service,
install_flags, install_flags,
problem_filters, problem_filters,
interface_flags, interface_flags,
categories); categories);
} else {
g_warning ("Install not called, since some files were not downloaded");
}
} }
return rv; return rv;
} /* end install_new_packages */ } /* end install_new_packages */
static void /* Returns FALSE is file was not fetched */
download_a_package (EazelInstall *service, PackageData* package) { static gboolean
download_a_package (EazelInstall *service,
PackageData* package)
{
gboolean result;
result = TRUE;
if (eazel_install_get_protocol (service) == PROTOCOL_HTTP) { if (eazel_install_get_protocol (service) == PROTOCOL_HTTP) {
char* rpmname; char* rpmname;
char* targetname; char* targetname;
...@@ -180,7 +191,7 @@ download_a_package (EazelInstall *service, PackageData* package) { ...@@ -180,7 +191,7 @@ download_a_package (EazelInstall *service, PackageData* package) {
g_print ("Downloading %s...\n", rpmname); g_print ("Downloading %s...\n", rpmname);
rv = http_fetch_remote_file (service, url, targetname); rv = http_fetch_remote_file (service, url, targetname);
if (rv != TRUE) { if (rv != TRUE) {
g_error ("*** Failed to retreive %s! ***\n", url); result = FALSE;
} }
g_free (rpmname); g_free (rpmname);
...@@ -188,12 +199,19 @@ download_a_package (EazelInstall *service, PackageData* package) { ...@@ -188,12 +199,19 @@ download_a_package (EazelInstall *service, PackageData* package) {
g_free (url); g_free (url);
} }
return result;
} /* end download_a_package */ } /* end download_a_package */
/*
Returns FALSE if some packages failed;
*/
static gboolean static gboolean
download_all_packages (EazelInstall *service, download_all_packages (EazelInstall *service,
GList* categories) { GList* categories)
{
gboolean result;
result = TRUE;
while (categories) { while (categories) {
CategoryData* cat; CategoryData* cat;
GList* pkgs; GList* pkgs;
...@@ -207,7 +225,10 @@ download_all_packages (EazelInstall *service, ...@@ -207,7 +225,10 @@ download_all_packages (EazelInstall *service,
package = pkgs->data; package = pkgs->data;
download_a_package (service, package); if (download_a_package (service, package) == FALSE) {
g_warning ("*** Failed to retreive %s! ***\n", package->name);
result = FALSE;
}
pkgs = pkgs->next; pkgs = pkgs->next;
} }
...@@ -216,7 +237,7 @@ download_all_packages (EazelInstall *service, ...@@ -216,7 +237,7 @@ download_all_packages (EazelInstall *service,
free_categories (categories); free_categories (categories);
return TRUE; return result;
} /* end download_all_packages */ } /* end download_all_packages */
static gboolean static gboolean
...@@ -227,6 +248,7 @@ install_all_packages (EazelInstall *service, ...@@ -227,6 +248,7 @@ install_all_packages (EazelInstall *service,
GList* categories) { GList* categories) {
gboolean rv; gboolean rv;
rv = TRUE;
while (categories) { while (categories) {
CategoryData* cat = categories->data; CategoryData* cat = categories->data;
...@@ -257,9 +279,7 @@ install_all_packages (EazelInstall *service, ...@@ -257,9 +279,7 @@ install_all_packages (EazelInstall *service,
if (retval == 0) { if (retval == 0) {
g_print (_("Package install successful !\n")); g_print (_("Package install successful !\n"));
rv = TRUE; } else {
}
else {
g_print (_("Package install failed !\n")); g_print (_("Package install failed !\n"));
rv = FALSE; rv = FALSE;
} }
...@@ -309,10 +329,15 @@ uninstall_packages (EazelInstall *service) { ...@@ -309,10 +329,15 @@ uninstall_packages (EazelInstall *service) {
while (pkgs) { while (pkgs) {
PackageData* package = pkgs->data; PackageData* package = pkgs->data;
rv = uninstall_a_package (package, if (uninstall_a_package (service,
uninstall_flags, package,
problem_filters, uninstall_flags,
interface_flags); problem_filters,
interface_flags) == FALSE) {
g_warning ("Uninstall failed for %s",package->name);
} else {
rv = FALSE;
}
pkgs = pkgs->next; pkgs = pkgs->next;
} }
categories = categories->next; categories = categories->next;
...@@ -325,7 +350,8 @@ uninstall_packages (EazelInstall *service) { ...@@ -325,7 +350,8 @@ uninstall_packages (EazelInstall *service) {
} /* end install_new_packages */ } /* end install_new_packages */
static gboolean static gboolean
uninstall_a_package (PackageData* package, uninstall_a_package (EazelInstall *service,
PackageData* package,
int uninstall_flags, int uninstall_flags,
int problem_filters, int problem_filters,
int interface_flags) { int interface_flags) {
...@@ -340,10 +366,12 @@ uninstall_a_package (PackageData* package, ...@@ -340,10 +366,12 @@ uninstall_a_package (PackageData* package,
package->version, package->version,
package->minor); package->minor);
rv = TRUE;
if (g_strcasecmp (package->archtype, "src") != 0) { if (g_strcasecmp (package->archtype, "src") != 0) {
g_print ("Uninstalling %s\n", pkg); g_print ("Uninstalling %s\n", pkg);
retval = rpm_uninstall ("/", retval = rpm_uninstall (service,
"/",
pkg, pkg,
uninstall_flags, uninstall_flags,
problem_filters, problem_filters,
...@@ -351,16 +379,14 @@ uninstall_a_package (PackageData* package, ...@@ -351,16 +379,14 @@ uninstall_a_package (PackageData* package,
g_free (pkg); g_free (pkg);
if (retval == 0) { if (retval == 0) {
g_print ("Package uninstall successful!\n"); g_print ("Package uninstall successful!\n");
rv = TRUE; } else {
}
else {
g_print (_("Package uninstall failed !\n")); g_print (_("Package uninstall failed !\n"));
rv = FALSE; rv = FALSE;
} }
} } else {
else {
g_print ("%s seems to be a source package. Skipping ...\n", pkg); g_print ("%s seems to be a source package. Skipping ...\n", pkg);
g_free (pkg); g_free (pkg);
rv = FALSE;
} }
return rv; return rv;
...@@ -604,8 +630,13 @@ do_rpm_install (EazelInstall *service, ...@@ -604,8 +630,13 @@ do_rpm_install (EazelInstall *service,
} /* end do_rpm_install */ } /* end do_rpm_install */
static int static int
do_rpm_uninstall (char* root_dir, GList* packages, int install_flags, do_rpm_uninstall (EazelInstall *service,
int problem_filters, int interface_flags) { char* root_dir,
GList* packages,
int install_flags,
int problem_filters,
int interface_flags)
{
rpmdb db; rpmdb db;
int count, i; int count, i;
int rc; int rc;
...@@ -634,7 +665,7 @@ do_rpm_uninstall (char* root_dir, GList* packages, int install_flags, ...@@ -634,7 +665,7 @@ do_rpm_uninstall (char* root_dir, GList* packages, int install_flags,
const char* dn; const char* dn;
dn = rpmGetPath ((root_dir ? root_dir : ""), "%{_dbpath}", NULL); dn = rpmGetPath ((root_dir ? root_dir : ""), "%{_dbpath}", NULL);
if (!dn) { if (!dn) {
g_error (_("Packages database query failed !\n")); g_warning (_("Packages database query failed !\n"));
} }
return g_list_length (packages); return g_list_length (packages);
} }
...@@ -665,9 +696,9 @@ do_rpm_uninstall (char* root_dir, GList* packages, int install_flags, ...@@ -665,9 +696,9 @@ do_rpm_uninstall (char* root_dir, GList* packages, int install_flags,
num_packages++; num_packages++;
} }
} }
dbiFreeIndexRecord (matches);
break; break;
} }
dbiFreeIndexRecord (matches);
} }
if (!(interface_flags & UNINSTALL_NODEPS)) { if (!(interface_flags & UNINSTALL_NODEPS)) {
...@@ -689,8 +720,8 @@ do_rpm_uninstall (char* root_dir, GList* packages, int install_flags, ...@@ -689,8 +720,8 @@ do_rpm_uninstall (char* root_dir, GList* packages, int install_flags,
} }
if (!stop_uninstall && rpmdep != NULL) { if (!stop_uninstall && rpmdep != NULL) {
num_failed += rpmRunTransactions (rpmdep, num_failed += rpmRunTransactions (rpmdep,
NULL, rpm_show_progress,
NULL, service,
NULL, NULL,
&probs, &probs,
install_flags, install_flags,
...@@ -734,7 +765,8 @@ rpm_install (EazelInstall *service, ...@@ -734,7 +765,8 @@ rpm_install (EazelInstall *service,
} /* end rpm_install */ } /* end rpm_install */
static int static int
rpm_uninstall (char* root_dir, rpm_uninstall (EazelInstall *service,
char* root_dir,
char* file, char* file,
int install_flags, int install_flags,
int problem_filters, int problem_filters,
...@@ -744,7 +776,8 @@ rpm_uninstall (char* root_dir, ...@@ -744,7 +776,8 @@ rpm_uninstall (char* root_dir,
list = g_list_append (NULL, file); list = g_list_append (NULL, file);
result = do_rpm_uninstall (root_dir, result = do_rpm_uninstall (service,
root_dir,
list, list,
install_flags, install_flags,
problem_filters, problem_filters,
......
...@@ -20,7 +20,7 @@ static char *package_list[LAST] = { ...@@ -20,7 +20,7 @@ static char *package_list[LAST] = {
"/nautilus-only-list.xml", "/nautilus-only-list.xml",
"/services-only-list.xml", "/services-only-list.xml",
"/package-list.xml", "/package-list.xml",
"/package-list.xml", "/package-uninstall-list.xml",
}; };
static void static void
...@@ -98,15 +98,11 @@ void installer (GtkWidget *window, ...@@ -98,15 +98,11 @@ void installer (GtkWidget *window,
return; return;
} }
if (method==UNINSTALL) {
gnome_warning_dialog ("We don't do UNINSTALL yet");
return;
}
if (method==UPGRADE) { if (method==UPGRADE) {
gnome_warning_dialog ("We don't do UPGRADE yet"); gnome_warning_dialog ("We don't do UPGRADE yet");
return; return;
} }
/*
service = EAZEL_INSTALL (gtk_object_new (TYPE_EAZEL_INSTALL, service = EAZEL_INSTALL (gtk_object_new (TYPE_EAZEL_INSTALL,
"verbose", TRUE, "verbose", TRUE,
"silent", FALSE, "silent", FALSE,
...@@ -126,7 +122,6 @@ void installer (GtkWidget *window, ...@@ -126,7 +122,6 @@ void installer (GtkWidget *window,
"package_list", PACKAGE_LIST, "package_list", PACKAGE_LIST,
"port_number", PORT_NUMBER, "port_number", PORT_NUMBER,
NULL)); NULL));
*/
service = eazel_install_new_with_config ("/var/eazel/services/eazel-services-config.xml"); service = eazel_install_new_with_config ("/var/eazel/services/eazel-services-config.xml");
g_assert (service != NULL); g_assert (service != NULL);
...@@ -144,7 +139,17 @@ void installer (GtkWidget *window, ...@@ -144,7 +139,17 @@ void installer (GtkWidget *window,
gtk_signal_connect (GTK_OBJECT (service), "download_progress", eazel_download_progress, window); gtk_signal_connect (GTK_OBJECT (service), "download_progress", eazel_download_progress, window);
gtk_signal_connect (GTK_OBJECT (service), "install_progress", eazel_install_progress, window); gtk_signal_connect (GTK_OBJECT (service), "install_progress", eazel_install_progress, window);
eazel_install_new_packages (service); switch (method) {
case FULL_INST:
case NAUTILUS_ONLY:
case SERVICES_ONLY:
case UPGRADE:
eazel_install_new_packages (service);
break;
case UNINSTALL:
eazel_install_uninstall (service);
break;
};
eazel_install_destroy (GTK_OBJECT (service)); eazel_install_destroy (GTK_OBJECT (service));
package_label = gtk_object_get_data (GTK_OBJECT (window), "package_label"); package_label = gtk_object_get_data (GTK_OBJECT (window), "package_label");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment