Commit 6896aa7c authored by Eskil Heyn Olsen's avatar Eskil Heyn Olsen

Default to services.eazel.com instead of ham.eazel.com Nicer print for

	* components/services/install/command-line/eazel-alt-install-corba.
	c: (install_failed), (main):
	Default to services.eazel.com instead of ham.eazel.com
	Nicer print for install failed in the case the package is already
	installed.
	Free the category & package date structures.

	* components/services/install/lib/eazel-install-corba-callback.c:
	(impl_install_failed), (impl_uninstall_failed):
	Free some category & package date structures (leak fixing project)

	* components/services/install/lib/eazel-install-corba-types.c:
	(categorydata_list_from_corba_categorystructlist):
	Fixed a g_new(categorydata) to categorydata_new

	* components/services/install/lib/eazel-install-corba.c:
	(impl_Eazel_Install_install_packages),
	(impl_Eazel_Install_simple_query):
	Inserted some newlines (exiting eh ?)

	* components/services/install/lib/eazel-install-md5.h:
	* components/services/install/lib/eazel-install-md5.c:
	(md5_get_digest_from_md5_string):
	Added a call that converts a md5 string into a 16 byte digest
	string.

	* components/services/install/lib/eazel-install-object.c:
	(eazel_install_finalize):
	Some newlines!!

	* components/services/install/lib/eazel-install-protocols.h:
	* components/services/install/lib/eazel-install-protocols.c:
	(http_fetch_remote_file), (eazel_install_fetch_package),
	(eazel_install_fetch_package_which_provides),
	(get_url_for_package):
	Added comments to what get_url_for_package and
	get_search_url_for_package does.
	Removed excess code from http_fetch_remote_file (creation of temp
	dir).
	Changed get_url_for_package to take a packagedata object as last
	argument. This is used for setting the serverside md5. Also uses
	trilobite_fetch_uri now.

	* components/services/install/lib/eazel-install-query.c:
	(eazel_install_simple_rpm_query):
	Inserted newlines (okay, I do that a lot, it makes the code
	readable...)

	* components/services/install/lib/eazel-install-rpm-glue.c:
	(eazel_install_flatten_categories),
	Changed to initally copy the category->packages. That way I don't
	end up having a list in the category where the first element is
	NULL (leak).
	(eazel_install_download_packages),
	(eazel_install_pre_install_packages),
	Nuke the modifies list after called check_existing. No reason to
	send those to the client, since the status flags is updated to
	show that the package is already installed.
	(eazel_install_do_transaction_md5_check),
	Finished the md5 checking (thus my required milestone bugs are
	done now, woohoo)
	(eazel_install_prune_packages),
	Commented out the block that destroys packagedata objects.
	(eazel_install_check_existing_packages),
	Set the stats to "already installed".
	(eazel_install_fetch_rpm_dependencies),
	(eazel_uninstall_check_for_install):
	Removed silly g_messages in danish that I used for debugging.

	* components/services/install/lib/eazel-install-types.h:
	Removed some weird old structure defines.

	* components/services/install/lib/eazel-install-types.c:
	(categorydata_new), (categorydata_destroy_foreach),
	(packagedata_destroy):
	Added some more messages in the category/packagedata alloc/dealloc
	debugging.

	* components/services/install/lib/eazel-install-xml-package-list.c:
	(generate_xml_package_list), (osd_parse_implementation),
	(osd_parse_softpkg), (osd_parse_shared),
	(parse_osd_xml_from_memory):
	Added D: to some stdout stuff.
	Decodes the MD5 tag
	Had to add a hack to compensate for lack of useragent in gnome-vfs
	http (bug 2862)

	* components/services/trilobite/libtrilobite/trilobite-core-utils.h
	* components/services/trilobite/libtrilobite/trilobite-core-utils.c
	: (trilobite_fetch_uri), (trilobite_fetch_uri_to_file),
	(trilobite_fetch_uri), (trilobite_fetch_uri_to_file):
	Wrote "slim" versions that use libghttp, for the bootstrap
	installer.

	* nautilus-installer/src/.cvsignore:
	Ignore the prezip binary
	* nautilus-installer/src/Makefile:
	* nautilus-installer/src/link.sh:
	Makefile cosmetics

	* nautilus-installer/src/rpmsearch.cgi:
	The makeshift rpmsearch cgi script.

	* libnautilus-adapter/.cvsignore
	stuff to ignore stuff.
parent 85fa78da
2000-09-07 Eskil Heyn Olsen <eskil@eazel.com>
* components/services/install/command-line/eazel-alt-install-corba.
c: (install_failed), (main):
Default to services.eazel.com instead of ham.eazel.com
Nicer print for install failed in the case the package is already
installed.
Free the category & package date structures.
* components/services/install/lib/eazel-install-corba-callback.c:
(impl_install_failed), (impl_uninstall_failed):
Free some category & package date structures (leak fixing project)
* components/services/install/lib/eazel-install-corba-types.c:
(categorydata_list_from_corba_categorystructlist):
Fixed a g_new(categorydata) to categorydata_new
* components/services/install/lib/eazel-install-corba.c:
(impl_Eazel_Install_install_packages),
(impl_Eazel_Install_simple_query):
Inserted some newlines (exiting eh ?)
* components/services/install/lib/eazel-install-md5.h:
* components/services/install/lib/eazel-install-md5.c:
(md5_get_digest_from_md5_string):
Added a call that converts a md5 string into a 16 byte digest
string.
* components/services/install/lib/eazel-install-object.c:
(eazel_install_finalize):
Some newlines!!
* components/services/install/lib/eazel-install-protocols.h:
* components/services/install/lib/eazel-install-protocols.c:
(http_fetch_remote_file), (eazel_install_fetch_package),
(eazel_install_fetch_package_which_provides),
(get_url_for_package):
Added comments to what get_url_for_package and
get_search_url_for_package does.
Removed excess code from http_fetch_remote_file (creation of temp
dir).
Changed get_url_for_package to take a packagedata object as last
argument. This is used for setting the serverside md5. Also uses
trilobite_fetch_uri now.
* components/services/install/lib/eazel-install-query.c:
(eazel_install_simple_rpm_query):
Inserted newlines (okay, I do that a lot, it makes the code
readable...)
* components/services/install/lib/eazel-install-rpm-glue.c:
(eazel_install_flatten_categories),
Changed to initally copy the category->packages. That way I don't
end up having a list in the category where the first element is
NULL (leak).
(eazel_install_download_packages),
(eazel_install_pre_install_packages),
Nuke the modifies list after called check_existing. No reason to
send those to the client, since the status flags is updated to
show that the package is already installed.
(eazel_install_do_transaction_md5_check),
Finished the md5 checking (thus my required milestone bugs are
done now, woohoo)
(eazel_install_prune_packages),
Commented out the block that destroys packagedata objects.
(eazel_install_check_existing_packages),
Set the stats to "already installed".
(eazel_install_fetch_rpm_dependencies),
(eazel_uninstall_check_for_install):
Removed silly g_messages in danish that I used for debugging.
* components/services/install/lib/eazel-install-types.h:
Removed some weird old structure defines.
* components/services/install/lib/eazel-install-types.c:
(categorydata_new), (categorydata_destroy_foreach),
(packagedata_destroy):
Added some more messages in the category/packagedata alloc/dealloc
debugging.
* components/services/install/lib/eazel-install-xml-package-list.c:
(generate_xml_package_list), (osd_parse_implementation),
(osd_parse_softpkg), (osd_parse_shared),
(parse_osd_xml_from_memory):
Added D: to some stdout stuff.
Decodes the MD5 tag
Had to add a hack to compensate for lack of useragent in gnome-vfs
http (bug 2862)
* components/services/trilobite/libtrilobite/trilobite-core-utils.h
* components/services/trilobite/libtrilobite/trilobite-core-utils.c
: (trilobite_fetch_uri), (trilobite_fetch_uri_to_file),
(trilobite_fetch_uri), (trilobite_fetch_uri_to_file):
Wrote "slim" versions that use libghttp, for the bootstrap
installer.
* nautilus-installer/src/.cvsignore:
Ignore the prezip binary
* nautilus-installer/src/Makefile:
* nautilus-installer/src/link.sh:
Makefile cosmetics
* nautilus-installer/src/rpmsearch.cgi:
The makeshift rpmsearch cgi script.
* libnautilus-adapter/.cvsignore
stuff to ignore stuff.
2000-09-06 Raph Levien <raph@acm.org>
* librsvg/test-ft-gtk.c: Added "-a" option for attaching AFM
......
......@@ -38,7 +38,7 @@
#define PACKAGE_FILE_NAME "package-list.xml"
#define DEFAULT_HOSTNAME "ham.eazel.com"
#define DEFAULT_HOSTNAME "services.eazel.com"
#define DEFAULT_PORT_NUMBER 8888
#define DEFAULT_PROTOCOL PROTOCOL_HTTP
#define DEFAULT_TMP_DIR "/tmp/eazel-install"
......@@ -288,7 +288,8 @@ install_failed (EazelInstallCallback *service,
fprintf (stdout, "%s%s, which breaks deps\n", indent, rpmfilename_from_packagedata (pd));
break;
default:
fprintf (stdout, "%s%s\n", indent, pd->name);
fprintf (stdout, "%s%s %s\n", indent, pd->name,
pd->status==PACKAGE_ALREADY_INSTALLED ? "already installed" : "");
break;
}
for (iterator = pd->soft_depends; iterator; iterator = iterator->next) {
......@@ -543,6 +544,8 @@ int main(int argc, char *argv[]) {
} else {
eazel_install_callback_install_packages (cb, categories, arg_root, &ev);
}
g_list_foreach (categories, (GFunc)categorydata_destroy_foreach, NULL);
if (!arg_query) {
fprintf (stdout, "\nEntering main loop...\n");
......
......@@ -144,7 +144,7 @@ impl_install_failed (impl_POA_Trilobite_Eazel_InstallCallback *servant,
CORBA_Environment * ev)
{
GList *categories;
PackageData *pack;
categories = parse_memory_xml_package_list ((char*)xmlcorbapack, strlen (xmlcorbapack));
if (categories==NULL) {
g_warning ("install_failed called with error in xml.");
......@@ -161,6 +161,7 @@ impl_install_failed (impl_POA_Trilobite_Eazel_InstallCallback *servant,
gtk_signal_emit (GTK_OBJECT (servant->object), signals[INSTALL_FAILED], pack);
}
}
g_list_foreach (categories, (GFunc)categorydata_destroy_foreach, NULL);
}
static void
......@@ -186,6 +187,7 @@ impl_uninstall_failed (impl_POA_Trilobite_Eazel_InstallCallback *servant,
gtk_signal_emit (GTK_OBJECT (servant->object), signals[INSTALL_FAILED], pack);
}
}
g_list_foreach (categories, (GFunc)categorydata_destroy_foreach, NULL);
}
static CORBA_boolean
......
......@@ -240,7 +240,7 @@ categorydata_list_from_corba_categorystructlist (const Trilobite_Eazel_CategoryS
packages = g_list_prepend (packages, pack);
}
category = g_new0 (CategoryData, 1);
category = categorydata_new ();
category->name = strlen (corbacategory.name)>0 ? g_strdup (corbacategory.name) : NULL;
category->packages = packages;
categories = g_list_prepend (categories, category);
......
......@@ -89,7 +89,7 @@ impl_Eazel_Install_install_packages(impl_POA_Trilobite_Eazel_Install *servant,
eazel_install_install_packages (servant->object,
categories,
!root || strcmp (root, "")==0 ? NULL : root);
g_list_foreach (categories, (GFunc)categorydata_destroy_foreach, NULL);
g_list_free (categories);
......@@ -372,6 +372,7 @@ impl_Eazel_Install_simple_query (impl_POA_Trilobite_Eazel_Install *servant,
servant->object->private->cur_root);
result = Trilobite_Eazel_PackageDataStructList__alloc ();
(*result) = corba_packagedatastructlist_from_packagedata_list (tmp_result);
g_list_foreach (tmp_result, (GFunc)packagedata_destroy, GINT_TO_POINTER (TRUE));
return result;
......
......@@ -355,6 +355,29 @@ md5_get_digest_from_file (const char *filename, unsigned char digest[16])
md5_final (&ctx, digest);
}
void
md5_get_digest_from_md5_string (const char *md5string,
guchar pmd5[16])
{
char snippet[3];
const char *iterator;
int cnt = 0;
iterator = md5string;
while (cnt<16) {
unsigned long int tmp_val;
strncpy (snippet, iterator, 2);
snippet[2] = 0;
tmp_val = strtoul (snippet, NULL, 16);
g_assert (tmp_val < 256);
pmd5[cnt] = tmp_val;
iterator += 2;
cnt++;
}
}
#ifdef _MD5_STANDALONE
int
......
......@@ -28,6 +28,12 @@
#include <glib.h>
/* FIXME: bugzilla.eazel.com 2851
darins styleguide says not to use
evil glib types. Check if guchar is
"blacklisted"
http://cvs.gnome.org/lxr/source/nautilus/docs/style-guide.html
*/
typedef struct {
guint32 buf[4];
guint32 bits[2];
......@@ -38,5 +44,7 @@ typedef struct {
void md5_get_digest (const char *buffer, int buffer_size, unsigned char digest[16]);
void md5_get_digest_from_file (const char *filename, unsigned char digest[16]);
void md5_get_digest_from_md5_string (const char *md5string, unsigned char pmd5[16]);
#endif /* MD5_UTILS_H */
......@@ -166,8 +166,6 @@ eazel_install_finalize (GtkObject *object)
{
EazelInstall *service;
g_message ("in eazel_install_finalize");
g_return_if_fail (object != NULL);
g_return_if_fail (EAZEL_INSTALL (object));
......@@ -193,8 +191,6 @@ eazel_install_finalize (GtkObject *object)
if (GTK_OBJECT_CLASS (eazel_install_parent_class)->finalize) {
GTK_OBJECT_CLASS (eazel_install_parent_class)->finalize (object);
}
g_message ("out eazel_install_finalize");
}
void eazel_install_unref (GtkObject *object)
......
......@@ -33,11 +33,11 @@
#include <config.h>
#include <sys/utsname.h>
#include <errno.h>
#include <libtrilobite/trilobite-core-utils.h>
#ifndef EAZEL_INSTALL_SLIM
#include <trilobite-core-utils.h>
#include <libgnomevfs/gnome-vfs.h>
#else /* EAZEL_INSTALL_SLIM */
#define USER_AGENT_STRING "Trilobite"
#endif /* EAZEL_INSTALL_SLIM */
typedef struct {
......@@ -45,6 +45,10 @@ typedef struct {
const char *file_to_report;
} gnome_vfs_callback_struct;
typedef gboolean (*eazel_install_file_fetch_function) (gpointer *obj,
char *url,
const char *file_to_report,
const char *target_file);
/* This string defines the url for the rpmsearch cgi script.
It should contain a %s for the server name, and later
......@@ -80,8 +84,27 @@ gboolean local_fetch_remote_file (EazelInstall *service,
typedef enum { RPMSEARCH_ENTRY_NAME, RPMSEARCH_ENTRY_PROVIDES } RpmSearchEntry;
char* get_search_url_for_package (EazelInstall *service, RpmSearchEntry, const gpointer data);
char* get_url_for_package (EazelInstall *service, RpmSearchEntry, const gpointer data);
/* This method takes a RpmSearch, which describes the thing to search for
(ie. a package name or a package that provides file foo).
If RPMSEARCH_ENTRY_NAME, data must be a PackageData pointer,
if PROVIDES, it must be a string containing the file which is needed.
It creates a search url when can be used to get info about the package */
char* get_search_url_for_package (EazelInstall *service,
RpmSearchEntry,
const gpointer data);
/* This method takes a RpmSearch, which describes the thing to search for
(ie. a package name or a package that provides file foo).
If RPMSEARCH_ENTRY_NAME, data must be a PackageData pointer,
if PROVIDES, it must be a string containing the file which is needed.
The last argument is a PackageData structure to insert info into,
eg. the url (->filename), the server md5 (->md5).
It uses get_search_url_for_package, downloads the contents of the url and
parses it and returns a url for the package itself */
char* get_url_for_package (EazelInstall *service,
RpmSearchEntry,
const gpointer data,
PackageData *pack);
#ifdef EAZEL_INSTALL_SLIM
gboolean
......@@ -100,19 +123,7 @@ http_fetch_remote_file (EazelInstall *service,
const char *report;
report = file_to_report ? file_to_report : g_basename (target_file);
g_message (_("Downloading %s..."), url);
if (! g_file_test (eazel_install_get_tmp_dir (service), G_FILE_TEST_ISDIR)) {
int retval;
retval = mkdir (eazel_install_get_tmp_dir (service), 0755);
if (retval < 0) {
if (errno != EEXIST) {
g_error (_("*** Could not create tmp directory (%s)! ***\n"),
eazel_install_get_tmp_dir (service));
}
}
}
g_message (_("Downloading %s..."), url);
file = fopen (target_file, "wb");
get_failed = 0;
......@@ -140,7 +151,7 @@ http_fetch_remote_file (EazelInstall *service,
}
ghttp_set_header (request, http_hdr_Connection, "close");
ghttp_set_header (request, http_hdr_User_Agent, USER_AGENT_STRING);
ghttp_set_header (request, http_hdr_User_Agent, trilobite_get_useragent_string (FALSE, NULL));
if (ghttp_prepare (request) != 0) {
g_warning (_("Could not prepare http request !"));
get_failed = 1;
......@@ -495,6 +506,7 @@ eazel_install_fetch_package (EazelInstall *service,
{
gboolean result;
char* url;
char *md5 = NULL;
char* targetname;
result = FALSE;
......@@ -504,7 +516,7 @@ eazel_install_fetch_package (EazelInstall *service,
case PROTOCOL_FTP:
case PROTOCOL_HTTP:
{
url = get_url_for_package (service, RPMSEARCH_ENTRY_NAME, package);
url = get_url_for_package (service, RPMSEARCH_ENTRY_NAME, package, package);
}
break;
case PROTOCOL_LOCAL:
......@@ -543,14 +555,13 @@ eazel_install_fetch_package (EazelInstall *service,
gboolean eazel_install_fetch_package_which_provides (EazelInstall *service,
const char *file,
PackageData **package)
PackageData *package)
{
gboolean result;
char *url;
char *targetname;
g_assert (package != NULL);
g_assert (*package != NULL);
result = FALSE;
......@@ -558,7 +569,7 @@ gboolean eazel_install_fetch_package_which_provides (EazelInstall *service,
case PROTOCOL_FTP:
case PROTOCOL_HTTP:
{
url = get_url_for_package (service, RPMSEARCH_ENTRY_PROVIDES, (const gpointer)file);
url = get_url_for_package (service, RPMSEARCH_ENTRY_PROVIDES, (const gpointer)file, package);
}
break;
case PROTOCOL_LOCAL:
......@@ -578,9 +589,9 @@ gboolean eazel_install_fetch_package_which_provides (EazelInstall *service,
filename_from_url (url));
result = eazel_install_fetch_file (service, url, NULL, targetname);
if (result) {
packagedata_fill_from_file (*package, targetname);
packagedata_fill_from_file (package, targetname);
} else {
(*package)->status = PACKAGE_DEPENDENCY_FAIL;
package->status = PACKAGE_DEPENDENCY_FAIL;
g_warning (_("File download failed"));
}
g_free (targetname);
......@@ -613,92 +624,61 @@ add_to_url (char **url,
char*
get_url_for_package (EazelInstall *service,
RpmSearchEntry entry,
gpointer data)
gpointer data,
PackageData *out_package)
{
char *search_url;
char *url;
ghttp_status status;
ghttp_request* request;
char *search_url = NULL;
char *url = NULL;
char *body = NULL;
int length;
url = NULL;
search_url = get_search_url_for_package (service, entry, data);
g_message (_("Search URL: %s"), search_url);
request = ghttp_request_new();
if (request == NULL) {
g_warning (_("Could not create an http request !"));
} else {
#ifdef EAZEL_INSTALL_SLIM
ghttp_set_header (request, http_hdr_User_Agent, USER_AGENT_STRING);
#else /* EAZEL_INSTALL_SLIM */
ghttp_set_header (request, http_hdr_User_Agent, trilobite_get_useragent_string (FALSE, NULL));
#endif /* EAZEL_INSTALL_SLIM */
if (ghttp_set_uri (request, search_url) != 0) {
g_warning (_("Invalid uri"));
} else {
if (ghttp_prepare (request) != 0) {
g_warning (_("Could not prepare http request !"));
} else {
status = ghttp_process (request);
switch (status) {
case ghttp_error:
case ghttp_not_done:
/* Eugh, no luck */
switch (entry) {
case RPMSEARCH_ENTRY_NAME:
g_warning (_("Could not retrieve a URL for %s"),
rpmfilename_from_packagedata ((PackageData*)data));
break;
case RPMSEARCH_ENTRY_PROVIDES:
g_warning (_("Could not retrieve a URL for %s"),
(char*)data);
break;
}
case ghttp_done:
if (ghttp_status_code (request) != 404) {
if (trilobite_fetch_uri (search_url, &body, &length)) {
#ifndef EAZEL_INSTALL_PROTOCOL_USE_OLD_CGI
/* Parse the returned xml */
GList *packages;
packages = parse_osd_xml_from_memory (ghttp_get_body (request),
ghttp_get_body_len (request));
if (g_list_length (packages) == 0) {
g_warning ("D: No url for file");
} else if (g_list_length (packages) > 1) {
g_warning ("D: Ugh, more then one match, using first");
}
if (g_list_length (packages) > 0) {
/* Get the first package returned */
PackageData *pack;
g_assert (packages->data != NULL);
pack = (PackageData*)packages->data;
url = g_strdup (pack->filename);
g_list_foreach (packages,
(GFunc)packagedata_destroy,
GINT_TO_POINTER (TRUE));
}
/* Parse the returned xml */
GList *packages;
packages = parse_osd_xml_from_memory (body, length);
if (g_list_length (packages) == 0) {
g_warning ("D: No url for file");
} else if (g_list_length (packages) > 1) {
g_warning ("D: Ugh, more then one match, using first");
}
if (g_list_length (packages) > 0) {
/* Get the first package returned */
PackageData *pack;
g_assert (packages->data != NULL);
pack = (PackageData*)packages->data;
out_package->filename = g_strdup (pack->filename);
url = g_strdup (pack->filename);
out_package->md5 = g_strdup (pack->md5);
g_list_foreach (packages,
(GFunc)packagedata_destroy,
GINT_TO_POINTER (TRUE));
}
#else /* EAZEL_INSTALL_PROTOCOL_USE_OLD_CGI */
url = g_strdup (ghttp_get_body (request));
if (url) {
url [ ghttp_get_body_len (request)] = 0;
}
url = g_strdup (ghttp_get_body (request));
if (url) {
url [ ghttp_get_body_len (request)] = 0;
}
#endif /* EAZEL_INSTALL_PROTOCOL_USE_OLD_CGI */
} else {
url = NULL;
}
break;
}
}
} else {
switch (entry) {
case RPMSEARCH_ENTRY_NAME:
g_warning (_("Could not retrieve a URL for %s"),
rpmfilename_from_packagedata ((PackageData*)data));
break;
case RPMSEARCH_ENTRY_PROVIDES:
g_warning (_("Could not retrieve a URL for %s"),
(char*)data);
break;
}
ghttp_request_destroy (request);
}
}
g_free (search_url);
return url;
......
......@@ -41,6 +41,6 @@ gboolean eazel_install_fetch_package (EazelInstall *service,
gboolean eazel_install_fetch_package_which_provides (EazelInstall *service,
const char *file,
PackageData **package);
PackageData *package);
#endif /* EAZEL_INSTALL_PROTOCOLS_H */
......@@ -122,7 +122,9 @@ eazel_install_simple_rpm_query (EazelInstall *service,
(*hd) = rpmdbGetRecord (db, offset);
pack = packagedata_new_from_rpm_header (hd);
pack->install_root = g_strdup (root);
if (g_list_find_custom (*result, pack->name, (GCompareFunc)eazel_install_package_name_compare)!=NULL) {
if (g_list_find_custom (*result,
pack->name,
(GCompareFunc)eazel_install_package_name_compare)!=NULL) {
packagedata_destroy (pack, TRUE);
} else {
(*result) = g_list_prepend (*result, pack);
......
......@@ -104,7 +104,11 @@ eazel_install_flatten_categories (EazelInstall *service,
for (category_iterator = categories; category_iterator; category_iterator = g_list_next (category_iterator)) {
CategoryData *cat = (CategoryData*)category_iterator->data;
packages = g_list_concat (cat->packages, packages);
if (packages) {
packages = g_list_concat (packages, cat->packages);
} else {
packages = g_list_copy (cat->packages);
}
}
......@@ -231,7 +235,15 @@ eazel_install_download_packages (EazelInstall *service,
*/
int inst_status = eazel_install_check_existing_packages (service, package);
if (inst_status <= 0) {
/* Nuke the modifies list again, since we don't want to see them */
g_list_foreach (package->modifies,
(GFunc)packagedata_destroy,
GINT_TO_POINTER (TRUE));
package->modifies = NULL;
/* don't fecth the package */
fetch_package = FALSE;
/* Add it to the list of packages to nuke at the end
of this function */
remove_list = g_list_prepend (remove_list, package);
g_message (_("%s already installed"), package->name);
}
......@@ -294,12 +306,19 @@ eazel_install_pre_install_packages (EazelInstall *service,
g_message (_("%s..."), pack->name);
} else {
g_message (_("Skipping %s..."), pack->name);
pack->status = PACKAGE_ALREADY_INSTALLED;
/* Nuke the modifies list again, since we don't want to see them */
g_list_foreach (pack->modifies,
(GFunc)packagedata_destroy,
GINT_TO_POINTER (TRUE));
pack->modifies = NULL;
/* Add it to the list of packages to nuke at the end
of this function */
failed_packages = g_list_prepend (failed_packages, pack);
}
}
for (iterator = failed_packages; iterator; iterator=iterator->next) {
for (iterator = failed_packages; iterator; iterator=g_list_next (iterator)) {
eazel_install_prune_packages (service,
(PackageData*)iterator->data,
packages, NULL);
......@@ -863,16 +882,19 @@ eazel_install_do_transaction_md5_check (EazelInstall *service,
PackageData *pack = (PackageData*)iterator->data;
if (pack->md5) {
char pmd5[16];
char md5[16];
md5_get_digest_from_file (pack->filename, md5);
md5_get_digest_from_md5_string (pack->md5, pmd5);
/*
FIXME bugzilla.eazel.com 2241: until we get the md5 set in the xml parse, don't md5 check it
*/
if (memcmp (pack->md5, md5, 16)!=0) {
if (memcmp (pmd5, md5, 16)!=0) {
g_warning (_("MD5 mismatch, package %s may be compromised"), pack->name);
result = FALSE;
} else {
g_message ("D: md5 match");
g_message ("D: md5 match on %s", pack->name);
}
} else {
g_warning ("D: No md5 for %s", pack->name);
......@@ -1083,13 +1105,14 @@ eazel_install_prune_packages (EazelInstall *service,
};
}
/* Note, don't destroy, all packages are destroyed when the
categories are destroyed
for (iterator = pruned; iterator; iterator = g_list_next (iterator)) {
PackageData *pack;
pack = (PackageData*)iterator->data;
/* Note, don't destroy, all packages are destroyed when the
categories are destroyed */
/* packagedata_destroy (pack); */
packagedata_destroy (pack, TRUE);
};
*/
g_list_free (pruned);
......@@ -1476,6 +1499,7 @@ eazel_install_check_existing_packages (EazelInstall *service,
pack->version);
}
} else {
pack->status = PACKAGE_ALREADY_INSTALLED;
g_message (_("%s version %s already installed"),
pack->name,
existing_package->version);
......@@ -1626,7 +1650,7 @@ eazel_install_fetch_rpm_dependencies (EazelInstall *service,
if (fetch_from_file_dependency) {
fetch_result = eazel_install_fetch_package_which_provides (service,
conflict.needsName,
&dep);
dep);
} else {
fetch_result = eazel_install_fetch_package (service, dep);
}
......@@ -2203,13 +2227,11 @@ eazel_uninstall_check_for_install (EazelInstall *service,
if (matches) {
if (g_list_length (matches)==1) {
PackageData *matched = (PackageData*)matches->data;
g_message ("hest");
/* This is mucho important. If not marked
as toplevel, upwards traverse will not fail the package
is it has dependents */
matched->toplevel = TRUE;
g_message ("bver %s", matched->name);
result = g_list_prepend (result, matched);
} else {
g_assert_not_reached ();
......@@ -2221,21 +2243,16 @@ eazel_uninstall_check_for_install (EazelInstall *service,
}
}
g_message ("fisk");
for (iterator = remove; iterator; iterator=iterator->next) {
for (iterator = remove; iterator; iterator=g_list_next (iterator)) {
(*packages) = g_list_remove (*packages, iterator->data);
(*failed) = g_list_prepend (*failed, iterator->data);
}
g_message ("torsk");
g_message ("g_list_length (*packages) = %d", g_list_length (*packages));
g_message ("g_list_length (result) = %d", g_list_length (result));
g_list_foreach (*packages, (GFunc)packagedata_destroy, FALSE);
g_list_free (remove);
g_message ("odder");
g_list_free (*packages);
g_message ("sild");
(*packages) = g_list_copy (result);
g_message ("hund");
g_list_free (result);
g_message ("D: out eazel_uninstall_check_for_install");
......
......@@ -65,10 +65,14 @@ protocol_as_string (URLType protocol)
CategoryData*
categorydata_new ()
{
CategoryData *result;