Commit fb3b916c authored by Eskil Heyn Olsen's avatar Eskil Heyn Olsen
Browse files

nautilus now build rpm's again.

libeazelinstall work :	Muy work. Worked around orbit-idl's shortcommings,
by packing the
dependency trees for the (un)install_failed callbacks into
xml. Uninstall now does the upwards traversel to detect packages
that will break. Still not the downwards though. Installing a
packge using the filename no longer results in a query for the
file to the server, although we still download all missing deps.

Most of the corbafication stuff is done.

The installer also works again.
parent 8aa27fb4
2000-07-05 Eskil Heyn Olsen <eskil@eazel.com>
* po/POTFILES.in:
Removed ntl-web-search.c since it's no longer in the codebase.
* components/rpmview/nautilus-rpm-view-install.c:
(nautilus_rpm_view_install_package_callback):
Fixed bug... eh, some number.
* components/services/install/command-line/Makefile.am:
*
components/services/install/command-line/eazel-alt-install-corba.c:
(set_parameters_from_command_line), (main):
* components/services/install/command-line/eazel-gen-xml.c: (main):
* components/services/install/command-line/eazel-uninstall.c:
(uninstall_failed):
* components/services/install/idl/trilobite-eazel-install.idl:
* components/services/install/lib/eazel-install-corba-callback.c:
(impl_dep_check), (impl_install_progress),
(impl_uninstall_progress), (impl_install_failed),
(impl_uninstall_failed), (eazel_install_callback_query):
* components/services/install/lib/eazel-install-corba-types.c:
(corba_packagedatastruct_from_packagedata),
(packagedata_from_corba_packagedatastruct),
(corba_category_list_from_categorydata_list),
(categorydata_list_from_corba_categorystructlist),
(xmlnode_from_packageData), (xml_from_packagedata):
* components/services/install/lib/eazel-install-corba-types.h:
* components/services/install/lib/eazel-install-corba.c:
(impl_Eazel_Install_uninstall_packages),
(impl_Eazel_Install_query), (eazel_install_get_epv):
* components/services/install/lib/eazel-install-object.c:
(eazel_install_class_initialize),
(eazel_install_emit_install_progress_default),
(eazel_install_emit_install_failed_default),
(eazel_install_emit_uninstall_failed_default),
(eazel_install_emit_dependency_check_default):
* components/services/install/lib/eazel-install-protocols.c:
(eazel_install_fetch_package):
* components/services/install/lib/eazel-install-query.c:
(eazel_install_simple_query):
* components/services/install/lib/eazel-install-query.h:
* components/services/install/lib/eazel-install-rpm-glue.c:
(install_new_packages), (download_all_packages),
(uninstall_packages), (do_rpm_install),
(eazel_install_load_rpm_headers), (eazel_install_free_rpm_system),
(eazel_install_prepare_rpm_system),
(eazel_install_fetch_rpm_dependencies), (print_package_list),
(eazel_install_do_dependency_check), (eazel_install_ensure_deps),
(eazel_uninstall_upward_traverse),
(eazel_uninstall_downward_traverse), (eazel_uninstall_globber):
* components/services/install/lib/eazel-install-types.c:
(packagedata_destroy_foreach), (rpmname_from_packagedata),
(packagedata_equal), (packagedata_status_enum_to_str),
(packagedata_status_str_to_enum):
* components/services/install/lib/eazel-install-types.h:
* components/services/install/lib/eazel-install-xml-package-list.c:
(parse_package), (parse_category), (parse_shared),
(parse_memory_xml_package_list), (parse_local_xml_package_list):
* components/services/install/lib/eazel-install-xml-package-list.h:
Muy work. Worked around orbit-idl's shortcommings, by packing the
dependency trees for the (un)install_failed callbacks into
xml. Uninstall now does the upwards traversel to detect packages
that will break. Still not the downwards though. Installing a
packge using the filename no longer results in a query for the
file to the server, although we still download all missing deps.
Most of the corbafication stuff is done.
* nautilus-installer/src/Makefile:
* nautilus-installer/src/installer.c: (installer):
Compiles again.
2000-07-05 Darin Adler <darin@eazel.com>
* components/services/trilobite/sample/service/.cvsignore:
......
......@@ -164,11 +164,12 @@ nautilus_rpm_view_install_package_callback (GtkWidget *widget,
char *ptr;
CategoryData *category;
PackageData *pack;
/* FIXME: bugzilla.eazel.com 1492
I need a clean way to get the filename... */
ptr = rpm_view->details->current_uri + strlen (rpm_view->details->current_uri) - 1;
while (ptr != rpm_view->details->current_uri && *ptr!='/') { ptr--; };
ptr++;
/* Find the :// of the url and skip to after it */
ptr = strstr (rpm_view->details->current_uri, "file://");
ptr += strlen ("file://");
/* make a package and add to it to a categorylist */
pack = packagedata_new ();
pack->filename = g_strdup (ptr);
......
......@@ -27,7 +27,7 @@ LDADD = \
$(RPM_LIBS) \
$(NULL)
bin_PROGRAMS = eazel-install eazel-uninstall
bin_PROGRAMS = eazel-install eazel-uninstall eazel-gen-xml
eazel_install_SOURCES = \
eazel-alt-install-corba.c \
......@@ -37,3 +37,7 @@ eazel_uninstall_SOURCES = \
eazel-uninstall.c \
$(NULL)
eazel_gen_xml_SOURCES = \
eazel-gen-xml.c \
$(NULL)
......@@ -62,9 +62,7 @@ int arg_dry_run,
arg_delay;
char *arg_server,
*arg_config_file,
*arg_local_list,
*arg_tmp_dir,
*arg_input_list;
*arg_tmp_dir;
CORBA_ORB orb;
CORBA_Environment ev;
......@@ -79,9 +77,7 @@ static const struct poptOption options[] = {
{"http", 'h', POPT_ARG_NONE, &arg_http, 0, N_("Use http"), NULL},
{"ftp", 'f', POPT_ARG_NONE, &arg_ftp, 0, N_("Use ftp"), NULL},
{"local", 'l', POPT_ARG_NONE, &arg_local, 0, N_("Use local"), NULL},
{"packagelist", '\0', POPT_ARG_STRING, &arg_local_list, 0, N_("Specify package list to use (/var/eazel/service/package-list.xml)"), NULL},
{"config", '\0', POPT_ARG_STRING, &arg_config_file, 0, N_("Specify config file (/var/eazel/services/eazel-services-config.xml)"), NULL},
{"genpkglist", '\0', POPT_ARG_STRING, &arg_input_list, 0, N_("Use specified file to generate a package list, requires --packagelist"), NULL},
{NULL, '\0', 0, NULL, 0}
};
......@@ -125,18 +121,7 @@ set_parameters_from_command_line (Trilobite_Eazel_Install service)
if (arg_dry_run) {
Trilobite_Eazel_Install__set_test_mode (service, TRUE, &ev);
}
/*
if (arg_local_list) {
Trilobite_Eazel_Install__set_package_list (service, arg_local_list, &ev);
}
if (arg_input_list) {
if (arg_local_list == NULL) {
fprintf (stderr, "Use of --genpkglist requires --packagelist\n");
exit (1);
}
generate_xml_package_list (arg_input_list, arg_local_list);
}
*/
/*
Trilobite_Eazel_Install__set_rpmrc_file (service, DEFAULT_RPMRC, &ev);
......@@ -333,13 +318,13 @@ int main(int argc, char *argv[]) {
g_error ("Could not init bonobo");
}
bonobo_activate ();
cb = eazel_install_callback_new ();
if (arg_delay) {
sleep (10);
}
cb = eazel_install_callback_new ();
set_parameters_from_command_line (eazel_install_callback_corba_objref (cb));
gtk_signal_connect (GTK_OBJECT (cb), "download_progress", eazel_download_progress_signal, "Download progress");
......
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
* Copyright (C) 2000 Eazel, Inc
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors: Eskil Heyn Olsen <eskil@eazel.com>
*
*/
#include <config.h>
#include <gnome.h>
#include <liboaf/liboaf.h>
#include <bonobo.h>
#include <eazel-install-xml-package-list.h>
#define PACKAGE_FILE_NAME "package-list.xml"
int arg_debug;
char *arg_local_list,
*arg_input_list;
CORBA_ORB orb;
CORBA_Environment ev;
static const struct poptOption options[] = {
{"in", '\0', POPT_ARG_STRING, &arg_input_list, 0, N_("Specify package list to use (/var/eazel/service/package-list.xml)"), NULL},
{"out", '\0', POPT_ARG_STRING, &arg_local_list, 0, N_("Use specified file to generate a package list, requires --packagelist"), NULL},
{"debug", '\0', POPT_ARG_NONE, &arg_debug, 0 , N_("Show debug output"), NULL},
{NULL, '\0', 0, NULL, 0}
};
int main(int argc, char *argv[]) {
gtk_type_init ();
gnomelib_init ("Eazel Gen Xml", "1.0");
gnomelib_register_popt_table (options, "Eazel Gen Xml");
gnomelib_parse_args (argc, argv, 0);
if (arg_input_list==NULL) {
g_error ("Please specify an input file");
}
if (arg_local_list==NULL) {
arg_local_list = g_strdup (PACKAGE_FILE_NAME);
}
generate_xml_package_list (arg_input_list, arg_local_list);
return 0;
};
......@@ -125,19 +125,21 @@ uninstall_failed (EazelInstallCallback *service,
}
switch (pd->status) {
case PACKAGE_DEPENDENCY_FAIL:
fprintf (stdout, "%s-%s FAILED\n", indent, rpmfilename_from_packagedata (pd));
fprintf (stdout, "%s- %s FAILED\n", indent, rpmfilename_from_packagedata (pd));
break;
case PACKAGE_CANNOT_OPEN:
fprintf (stdout, "%s-%s NOT FOUND\n", indent, rpmfilename_from_packagedata (pd));
fprintf (stdout, "%s- %s NOT FOUND\n", indent, rpmfilename_from_packagedata (pd));
break;
case PACKAGE_SOURCE_NOT_SUPPORTED:
fprintf (stdout, "%s-%s is a source package\n", indent, rpmfilename_from_packagedata (pd));
fprintf (stdout, "%s- %s is a source package\n", indent, rpmfilename_from_packagedata (pd));
break;
case PACKAGE_BREAKS_DEPENDENCY:
fprintf (stdout, "%s-%s breaks\n", indent, rpmfilename_from_packagedata (pd));
fprintf (stdout, "%s- %s breaks (%dd %db)\n", indent, rpmfilename_from_packagedata (pd),
g_list_length (pd->soft_depends), g_list_length (pd->breaks));
break;
default:
fprintf (stdout, "%s-%s\n", indent, rpmfilename_from_packagedata (pd));
fprintf (stdout, "%s- %s (%d deps and %d breaks)\n", indent, rpmfilename_from_packagedata (pd),
g_list_length (pd->soft_depends), g_list_length (pd->breaks));
break;
}
for (iterator = pd->soft_depends; iterator; iterator = iterator->next) {
......
......@@ -66,20 +66,22 @@ module Trilobite {
bad: deps.
*/
PackageStatusEnum status;
/* FIXME: bugzilla.eazel.com 1542
This is legal IDL, but not supported by wannabe idl compiler
orbit-idl. Therefore I have to encode these
trees as xml...
When orbit-idl parses IDL, we can loose the xml
sequence <PackageDataStruct> soft_depends;
sequence <PackageDataStruct> hard_depends;
sequence <PackageDataStruct> breaks;
*/
};
typedef sequence <PackageDataStruct> PackageDataStructList;
struct PackageStruct {
PackageDataStruct data;
PackageDataStructList soft_depends;
PackageDataStructList hard_depends;
PackageDataStructList breaks;
};
typedef sequence <PackageStruct> PackageStructList;
struct CategoryStruct {
string name;
PackageStructList packages;
PackageDataStructList packages;
};
typedef sequence <CategoryStruct> CategoryStructList;
......@@ -88,18 +90,24 @@ module Trilobite {
oneway void download_progress (in string file, in long amount, in long total);
/* Called when dependency check is being handled */
oneway void dependency_check (in PackageStruct package, in PackageDataStruct needs);
oneway void dependency_check (in PackageDataStruct package, in PackageDataStruct needs);
/* Called during (un)installation of a package */
oneway void install_progress (in PackageStruct package, in long amount, in long total);
oneway void uninstall_progress (in PackageStruct package, in long amount, in long total);
oneway void install_progress (in PackageDataStruct package, in long amount, in long total);
oneway void uninstall_progress (in PackageDataStruct package, in long amount, in long total);
/* Called whenever a package (un)install fails
*/
oneway void download_failed (in string file);
oneway void install_failed (in PackageStruct package);
oneway void uninstall_failed (in PackageStruct package);
/* FIXME: bugzilla.eazel.com 1542
This is what they should be, but orbit-idl's lack of
recursive structures, forces us to encode the structures
as xml and transfer these instead.
oneway void install_failed (in PackageDataStruct package);
oneway void uninstall_failed (in PackageDataStruct package);
*/
oneway void install_failed (in string xml_package);
oneway void uninstall_failed (in string xml_package);
/* Called when the operation is finished */
void done ();
};
......@@ -117,8 +125,8 @@ module Trilobite {
attribute string log_file; /* where to put the logfile (otherwise it blurps to stdout */
attribute string tmp_dir; /* directory to store tmp files in (/tmp/eazel-install) */
attribute ProtocolEnum protocol; /*
attribute ProtocolEnum protocol; /* */
/* Install/uninstall using the packagelist from the server */
oneway void install (in string packagelist, in InstallCallback cb);
oneway void uninstall (in string packagelist, in InstallCallback cb);
......@@ -128,7 +136,7 @@ module Trilobite {
oneway void uninstall_packages (in CategoryStructList categories, in InstallCallback cb);
/* Run a query to the package sys */
PackageStructList query (in string query);
PackageDataStructList query (in string query);
};
};
};
......@@ -24,6 +24,7 @@
#include <config.h>
#include "eazel-install-corba-callback.h"
#include "eazel-install-corba-types.h"
#include "eazel-install-xml-package-list.h"
/*
#include <gnome.h>
#include <liboaf/liboaf.h>
......@@ -83,57 +84,67 @@ impl_download_failed (impl_POA_Trilobite_Eazel_InstallCallback *servant,
static void
impl_dep_check (impl_POA_Trilobite_Eazel_InstallCallback *servant,
const Trilobite_Eazel_PackageStruct *corbapack,
const Trilobite_Eazel_PackageDataStruct *corbapack,
const Trilobite_Eazel_PackageDataStruct *corbaneeds,
CORBA_Environment * ev)
{
PackageData *pack, *needs;
pack = packagedata_from_corba_packagestruct (corbapack);
pack = packagedata_from_corba_packagedatastruct (*corbapack);
needs = packagedata_from_corba_packagedatastruct (*corbaneeds);
gtk_signal_emit (GTK_OBJECT (servant->object), signals[DEPENDENCY_CHECK], pack, needs);
}
static void
impl_install_progress (impl_POA_Trilobite_Eazel_InstallCallback *servant,
const Trilobite_Eazel_PackageStruct *corbapack,
const Trilobite_Eazel_PackageDataStruct *corbapack,
const CORBA_long amount,
const CORBA_long total,
CORBA_Environment * ev)
{
PackageData *pack;
pack = packagedata_from_corba_packagestruct (corbapack);
pack = packagedata_from_corba_packagedatastruct (*corbapack);
gtk_signal_emit (GTK_OBJECT (servant->object), signals[INSTALL_PROGRESS], pack, amount, total);
}
static void
impl_uninstall_progress (impl_POA_Trilobite_Eazel_InstallCallback *servant,
const Trilobite_Eazel_PackageStruct *corbapack,
const Trilobite_Eazel_PackageDataStruct *corbapack,
const CORBA_long amount,
const CORBA_long total,
CORBA_Environment * ev)
{
PackageData *pack;
pack = packagedata_from_corba_packagestruct (corbapack);
pack = packagedata_from_corba_packagedatastruct (*corbapack);
gtk_signal_emit (GTK_OBJECT (servant->object), signals[UNINSTALL_PROGRESS], pack, amount, total);
}
static void
impl_install_failed (impl_POA_Trilobite_Eazel_InstallCallback *servant,
const Trilobite_Eazel_PackageStruct *corbapack,
const CORBA_char *xmlcorbapack,
CORBA_Environment * ev)
{
GList *categories;
PackageData *pack;
pack = packagedata_from_corba_packagestruct (corbapack);
categories = parse_memory_xml_package_list ((char*)xmlcorbapack, strlen (xmlcorbapack));
/* FIXME: bugzilla.eazel.com 1557
semi ugly, but assuming that the xml parse was ok, this gets the package
in for the signal */
pack = (PackageData*)((CategoryData*)categories->data)->packages->data;
gtk_signal_emit (GTK_OBJECT (servant->object), signals[INSTALL_FAILED], pack);
}
static void
impl_uninstall_failed (impl_POA_Trilobite_Eazel_InstallCallback *servant,
const Trilobite_Eazel_PackageStruct *corbapack,
const CORBA_char *xmlcorbapack,
CORBA_Environment * ev)
{
GList *categories;
PackageData *pack;
pack = packagedata_from_corba_packagestruct (corbapack);
categories = parse_memory_xml_package_list ((char*)xmlcorbapack, strlen (xmlcorbapack));
/* FIXME: bugzilla.eazel.com 1557
semi ugly, but assuming that the xml parse was ok, this gets the package
in for the signal */
pack = (PackageData*)((CategoryData*)categories->data)->packages->data;
gtk_signal_emit (GTK_OBJECT (servant->object), signals[UNINSTALL_FAILED], pack);
}
......@@ -397,7 +408,7 @@ eazel_install_callback_query (EazelInstallCallback *service,
CORBA_Environment *ev)
{
GList *result;
Trilobite_Eazel_PackageStructList *corbares;
Trilobite_Eazel_PackageDataStructList *corbares;
/* FIXME: bugzilla.eazel.com 1446 */
......
......@@ -23,25 +23,7 @@
#include "eazel-install-corba-types.h"
#include <libtrilobite/trilobite-core-distribution.h>
Trilobite_Eazel_PackageStructList*
corba_packagestructlist_from_packagedata_list (GList *packages)
{
Trilobite_Eazel_PackageStructList *packagelist;
int i;
packagelist = Trilobite_Eazel_PackageStructList__alloc ();
packagelist->_length = g_list_length (packages);
packagelist->_buffer = CORBA_sequence_Trilobite_Eazel_PackageStruct_allocbuf (packagelist->_length);
for (i = 0; i < packagelist->_length; i++) {
PackageData *pack;
pack = (PackageData*)(g_list_nth (packages,i)->data);
packagelist->_buffer[i] = corba_packagestruct_from_packagedata (pack);
}
return packagelist;
}
#include <gnome-xml/tree.h>
Trilobite_Eazel_PackageDataStructList
corba_packagedatastructlist_from_packagedata_list (GList *packages)
......@@ -60,7 +42,7 @@ corba_packagedatastructlist_from_packagedata_list (GList *packages)
return packagelist;
}
Trilobite_Eazel_PackageDataStruct
Trilobite_Eazel_PackageDataStruct
corba_packagedatastruct_from_packagedata (const PackageData *pack)
{
Trilobite_Eazel_PackageDataStruct corbapack;
......@@ -110,17 +92,8 @@ corba_packagedatastruct_from_packagedata (const PackageData *pack)
corbapack.status = Trilobite_Eazel_RESOLVED;
break;
}
return corbapack;
}
Trilobite_Eazel_PackageStruct
corba_packagestruct_from_packagedata (const PackageData *pack)
{
Trilobite_Eazel_PackageStruct corbapack;
corbapack.data = corba_packagedatastruct_from_packagedata (pack);
/*
FIXME: bugzilla.eazel.com 1542
if (pack->soft_depends) {
corbapack.soft_depends = corba_packagedatastructlist_from_packagedata_list (pack->soft_depends);
} else {
......@@ -136,28 +109,10 @@ corba_packagestruct_from_packagedata (const PackageData *pack)
} else {
corbapack.breaks._length = 0;
}
*/
return corbapack;
}
GList*
packagedata_list_from_corba_packagestructlist (const Trilobite_Eazel_PackageStructList corbapack)
{
GList *result;
int i;
result = NULL;
for (i = 0; i < corbapack._length; i++) {
PackageData *pack;
pack = packagedata_from_corba_packagestruct (&(corbapack._buffer[i]));
result = g_list_prepend (result, pack);
}
return result;
}
GList*
packagedata_list_from_corba_packagedatastructlist (const Trilobite_Eazel_PackageDataStructList corbapack)
{
......@@ -220,20 +175,12 @@ packagedata_from_corba_packagedatastruct (const Trilobite_Eazel_PackageDataStruc
pack->status = PACKAGE_RESOLVED;
break;
}
return pack;
}
PackageData*
packagedata_from_corba_packagestruct (const Trilobite_Eazel_PackageStruct *corbapack)
{
PackageData *pack;
pack = packagedata_from_corba_packagedatastruct (corbapack->data);
pack->soft_depends = packagedata_list_from_corba_packagedatastructlist (corbapack->soft_depends);
pack->hard_depends = packagedata_list_from_corba_packagedatastructlist (corbapack->hard_depends);
pack->breaks = packagedata_list_from_corba_packagedatastructlist (corbapack->breaks);
/*
FIXME: bugzilla.eazel.com 1542
pack->soft_depends = packagedata_list_from_corba_packagedatastructlist (corbapack.soft_depends);
pack->hard_depends = packagedata_list_from_corba_packagedatastructlist (corbapack.hard_depends);
pack->breaks = packagedata_list_from_corba_packagedatastructlist (corbapack.breaks);
*/
return pack;
}
......@@ -254,13 +201,12 @@ corba_category_list_from_categorydata_list (GList *categories)
for (iterator = categories; iterator; iterator = iterator->next) {
CategoryData *cat;
Trilobite_Eazel_CategoryStruct corbacat;
Trilobite_Eazel_PackageStructList *packstructlist;
Trilobite_Eazel_PackageDataStructList corbapacklist;
cat = (CategoryData*)iterator->data;
corbacat.name = cat->name ? CORBA_string_dup (cat->name) : CORBA_string_dup ("");
packstructlist = corba_packagestructlist_from_packagedata_list (cat->packages);
corbacat.packages = *packstructlist;
CORBA_free (packstructlist);
corbapacklist = corba_packagedatastructlist_from_packagedata_list (cat->packages);
corbacat.packages = corbapacklist;
corbacats->_buffer[i] = corbacat;
i++;
......@@ -280,7 +226,7 @@ categorydata_list_from_corba_categorystructlist (const Trilobite_Eazel_CategoryS
CategoryData *category;
GList *packages;
Trilobite_Eazel_CategoryStruct corbacategory;
Trilobite_Eazel_PackageStructList packagelist;
Trilobite_Eazel_PackageDataStructList packagelist;
packages = NULL;
corbacategory = corbacategories._buffer [i];
......@@ -288,10 +234,10 @@ categorydata_list_from_corba_categorystructlist (const Trilobite_Eazel_CategoryS
for (j = 0; j < packagelist._length; j++) {
PackageData *pack;
Trilobite_Eazel_PackageStruct corbapack;
Trilobite_Eazel_PackageDataStruct corbapack;
corbapack = packagelist._buffer [j];
pack = packagedata_from_corba_packagestruct (&corbapack);
pack = packagedata_from_corba_packagedatastruct (corbapack);
packages = g_list_prepend (packages, pack);
}
......@@ -303,3 +249,78 @@ categorydata_list_from_corba_categorystructlist (const Trilobite_Eazel_CategoryS
return categories;
}
static xmlNodePtr
xmlnode_from_packageData (const PackageData *pack, char *title, xmlNodePtr droot)