Added check for PackageBreaks iterators.

* components/services/install/command-line/eazel-alt-install-corba.
	c: (tree_helper_helper), (tree_helper):
	Added check for PackageBreaks iterators.

	* components/services/install/lib/eazel-install-corba-callback.c:
	(impl_install_failed):
	Leakfix, freeing the list given to the signal handler after
	handling.

	* components/services/install/lib/eazel-install-corba-types.c:
	(empty_hash_table),
	(packagedata_tree_from_corba_packagedatastructlist):
	Leakfix, now correctly frees the contents of the md5_hashtable and
	unrefs the proper objects.

	* components/services/install/lib/eazel-install-logic2.c:
	(eazel_install_check_existing_packages), (get_softcat_info),
	(is_satisfied), (is_satisfied_features),
	(check_dependencies_foreach), (check_tree_helper),
	(add_file_conflict),
	(check_conflicts_against_already_installed_packages),
	(check_feature_consistency):
	Proper fillflags for some EazelPackageSystem calls.
	Nicer log-output when debug is off.
	Leak fix, the PackageBreaks "objects".

	* components/services/install/lib/eazel-install-problem.c:
	(get_detailed_messages_breaks_foreach),
	(get_detailed_messages_foreach),
	(get_detailed_cases_breaks_foreach), (get_detailed_cases_foreach):
	Updated for the new PackageBreaks "objects".

	* components/services/install/lib/eazel-package-system-rpm4.c:
	(eazel_package_system_rpm4_query_impl):
	s/packagedata_destroy/gtk_object_unref/

	* components/services/install/lib/eazel-package-system-types.c:
	(at_exit_package_data_info), (categorydata_new),
	(categorydata_destroy_foreach), (packagedata_finalize),
	(packagedata_class_initialize), (packagedata_initialize),
	(packagedata_get_readable_name), (packagebreaks_finalize),
	(packagebreaks_class_initialize), (packagebreaks_initialize),
	(packagefileconflict_finalize),
	(packagefileconflict_class_initialize),
	(packagefeaturemissing_finalize),
	(packagefeaturemissing_class_initialize):
	Finally got the destroy crap working for the PackageBreak
	"objects".
	More leakcheck stuff for various structures.
	Again, fixed get_reabable_name.

	* components/services/install/lib/eazel-package-system-types.h:
	Added finalizes to the "objects".
	Removed packagedata_destroy prototype.

	* components/services/trilobite/libtrilobite/Makefile.am:
	Cleanup and possible tinderbox fix.
This commit is contained in:
Eskil Heyn Olsen 2001-02-03 05:48:10 +00:00
parent 7d67d53e02
commit 97caed032e
10 changed files with 259 additions and 60 deletions

View file

@ -1,3 +1,63 @@
2001-02-02 Eskil Heyn Olsen <eskil@eazel.com>
* components/services/install/command-line/eazel-alt-install-corba.
c: (tree_helper_helper), (tree_helper):
Added check for PackageBreaks iterators.
* components/services/install/lib/eazel-install-corba-callback.c:
(impl_install_failed):
Leakfix, freeing the list given to the signal handler after
handling.
* components/services/install/lib/eazel-install-corba-types.c:
(empty_hash_table),
(packagedata_tree_from_corba_packagedatastructlist):
Leakfix, now correctly frees the contents of the md5_hashtable and
unrefs the proper objects.
* components/services/install/lib/eazel-install-logic2.c:
(eazel_install_check_existing_packages), (get_softcat_info),
(is_satisfied), (is_satisfied_features),
(check_dependencies_foreach), (check_tree_helper),
(add_file_conflict),
(check_conflicts_against_already_installed_packages),
(check_feature_consistency):
Proper fillflags for some EazelPackageSystem calls.
Nicer log-output when debug is off.
Leak fix, the PackageBreaks "objects".
* components/services/install/lib/eazel-install-problem.c:
(get_detailed_messages_breaks_foreach),
(get_detailed_messages_foreach),
(get_detailed_cases_breaks_foreach), (get_detailed_cases_foreach):
Updated for the new PackageBreaks "objects".
* components/services/install/lib/eazel-package-system-rpm4.c:
(eazel_package_system_rpm4_query_impl):
s/packagedata_destroy/gtk_object_unref/
* components/services/install/lib/eazel-package-system-types.c:
(at_exit_package_data_info), (categorydata_new),
(categorydata_destroy_foreach), (packagedata_finalize),
(packagedata_class_initialize), (packagedata_initialize),
(packagedata_get_readable_name), (packagebreaks_finalize),
(packagebreaks_class_initialize), (packagebreaks_initialize),
(packagefileconflict_finalize),
(packagefileconflict_class_initialize),
(packagefeaturemissing_finalize),
(packagefeaturemissing_class_initialize):
Finally got the destroy crap working for the PackageBreak
"objects".
More leakcheck stuff for various structures.
Again, fixed get_reabable_name.
* components/services/install/lib/eazel-package-system-types.h:
Added finalizes to the "objects".
Removed packagedata_destroy prototype.
* components/services/trilobite/libtrilobite/Makefile.am:
Cleanup and possible tinderbox fix.
2001-02-02 Robey Pointer <robey@eazel.com>
* components/services/install/lib/eazel-install-corba-types.c:

View file

@ -378,6 +378,9 @@ tree_helper_helper(EazelInstallCallback *service,
if (IS_PACKAGEDATA (iterator->data)) {
pack = PACKAGEDATA (iterator->data);
} else if (IS_PACKAGEBREAKS (iterator->data)) {
PackageBreaks *breakage = PACKAGEBREAKS (iterator->data);
pack = packagebreaks_get_package (breakage);
} else {
PackageDependency *dep = PACKAGEDEPENDENCY (iterator->data);
pack = dep->package;
@ -427,7 +430,7 @@ tree_helper (EazelInstallCallback *service,
packagedata_modstatus_enum_to_str (pd->modify_status));
g_free (readable_name);
for (iterator = pd->soft_depends; iterator; iterator = iterator->next) {
for (iterator = pd->depends; iterator; iterator = iterator->next) {
char *tmp;
tmp = g_strdup ("-d-");
tree_helper_helper (service, indent, tmp, indent_level, iterator,

View file

@ -191,6 +191,7 @@ impl_install_failed (impl_POA_GNOME_Trilobite_Eazel_InstallCallback *servant,
gtk_signal_emit (GTK_OBJECT (servant->object), signals[INSTALL_FAILED], (PackageData *)(packages->data));
}
g_list_foreach (packages, (GFunc)gtk_object_unref, NULL);
g_list_free (packages);
}
static void

View file

@ -23,6 +23,7 @@
#include "eazel-install-corba-types.h"
#include "eazel-softcat.h"
#include <libtrilobite/trilobite-core-utils.h>
#include <libtrilobite/trilobite-core-distribution.h>
static GList*
@ -421,6 +422,15 @@ packagedata_list_from_corba_packagedatastructlist (const GNOME_Trilobite_Eazel_P
return result;
}
static gboolean
empty_hash_table (char *key,
PackageData *pack,
gpointer unused)
{
gtk_object_unref (GTK_OBJECT (pack));
return TRUE;
}
/* inflate a corba package list into a full-blown package tree (really a
* directed graph), by converting the soft MD5 pointers into physical ones.
*/
@ -519,11 +529,15 @@ packagedata_tree_from_corba_packagedatastructlist (const GNOME_Trilobite_Eazel_P
for (iter = g_list_first (packlist); iter != NULL; iter = g_list_next (iter)) {
pack = PACKAGEDATA (iter->data);
if (pack->toplevel) {
gtk_object_ref (GTK_OBJECT (pack));
outlist = g_list_prepend (outlist, pack);
}
}
g_list_free (packlist);
g_hash_table_foreach_remove (md5_table, (GHRFunc)empty_hash_table, NULL);
g_hash_table_destroy (md5_table);
return outlist;
}

View file

@ -46,6 +46,9 @@
#define EI2_DEBUG 0xff
#define PATCH_FOR_SOFTCAT_BUG 1
#define MUST_HAVE PACKAGE_FILL_NO_DIRS_IN_PROVIDES
#define UPDATE_MUST_HAVE PACKAGE_FILL_NO_DEPENDENCIES|PACKAGE_FILL_NO_TEXT|PACKAGE_FILL_NO_DIRS_IN_PROVIDES
#define OWNS_MUST_HAVE PACKAGE_FILL_NO_DEPENDENCIES|PACKAGE_FILL_NO_TEXT|PACKAGE_FILL_NO_DIRS_IN_PROVIDES
#define MODIFY_MUST_HAVE PACKAGE_FILL_NO_DEPENDENCIES|PACKAGE_FILL_NO_TEXT|PACKAGE_FILL_NO_DIRS_IN_PROVIDES
enum {
DEPENDENCY_OK = 1,
@ -261,7 +264,7 @@ eazel_install_check_existing_packages (EazelInstall *service,
service->private->cur_root,
pack->name,
EAZEL_PACKAGE_SYSTEM_QUERY_MATCHES,
PACKAGE_FILL_NO_DIRS_IN_PROVIDES);
MODIFY_MUST_HAVE);
if (existing_packages) {
/* Get the existing package, set it's modify flag and add it */
GList *iterator;
@ -453,7 +456,7 @@ get_softcat_info (EazelInstall *service,
g_assert (service);
g_assert (EAZEL_IS_INSTALL (service));
if ((*package)->fillflag & MUST_HAVE) {
if ((*package)->fillflag == MUST_HAVE) {
/* Package is already filled */
result = SOFTCAT_HIT_OK;
} else {
@ -463,6 +466,8 @@ get_softcat_info (EazelInstall *service,
PackageData *loaded_package;
#if EI2_DEBUG & 0x4
trilobite_debug ("%p %s load from disk", *package, (*package)->name);
#else
g_message ("Loading package info from %s", (*package)->filename);
#endif
loaded_package = eazel_package_system_load_package (service->private->package_system,
*package,
@ -656,6 +661,7 @@ is_satisfied (EazelInstall *service,
char *key;
int previous_check_state = 0;
char *sense_str;
gboolean result = FALSE;
g_assert (dep);
g_assert (IS_PACKAGEDEPENDENCY (dep));
@ -672,7 +678,7 @@ is_satisfied (EazelInstall *service,
dep->package, dep->package->name);
trilobite_debug ("\t -> already filled, must be ok");
#else
g_message ("checking dependency for %s (already checked)",
g_message ("\t(cached) : %s",
dep->package->name);
#endif
@ -684,14 +690,9 @@ 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 : ""));
g_free (sense_str);
if (key != NULL) {
previous_check_state = GPOINTER_TO_INT (g_hash_table_lookup (service->private->dep_ok_hash, key));
@ -701,19 +702,17 @@ is_satisfied (EazelInstall *service,
#if EI2_DEBUG & 0x4
trilobite_debug ("\t--> dep hash ok");
#endif
return TRUE;
result = TRUE;
break;
}
case DEPENDENCY_NOT_OK: {
#if EI2_DEBUG & 0x4
trilobite_debug ("\t--> dep hash failed");
#endif
return FALSE;
result = FALSE;
break;
}
default: {
gboolean result = FALSE;
default: {
if (dep->version) {
if (eazel_package_system_is_installed (service->private->package_system,
service->private->cur_root,
@ -748,26 +747,29 @@ 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,
GINT_TO_POINTER (DEPENDENCY_OK));
return TRUE;
} 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,
GINT_TO_POINTER (DEPENDENCY_NOT_OK));
return FALSE;
}
}
}
#if ~EI2_DEBUG & 0x4
g_message ("\t%8.8s : %s %s %s",
result ? "ok" : "NOT ok",
dep->package->name, sense_str,
(dep->version != NULL ? dep->version : ""));
#endif
g_free (sense_str);
return result;
}
gboolean
@ -785,7 +787,9 @@ is_satisfied_features (EazelInstall *service,
features = package->features;
#if EI2_DEBUG & 0x4
trilobite_debug ("\t -> is_satisfied_features %d features", g_list_length (features));
#endif
for (iterator = features; iterator && result; iterator = g_list_next (iterator)) {
GList *query_result;
@ -846,6 +850,8 @@ check_dependencies_foreach (PackageData *package,
#if EI2_DEBUG & 0x4
trilobite_debug ("check deps for %p %s", package, package->name);
#else
g_message ("Checking dependencies for %s", package->name);
#endif
for (iterator = package->depends; iterator; iterator = g_list_next (iterator)) {
@ -860,7 +866,11 @@ check_dependencies_foreach (PackageData *package,
for (iterator = remove; iterator; iterator = g_list_next (iterator)) {
PackageDependency *dep = PACKAGEDEPENDENCY (iterator->data);
package->depends = g_list_remove (package->depends, dep);
trilobite_debug ("removing %p %s from %p %s", dep->package, dep->package->name, package, package->name);
#if EI2_DEBUG & 0x4
trilobite_debug ("removing %p %s from %p %s",
dep->package, dep->package->name,
package, package->name);
#endif
packagedependency_destroy (dep);
}
g_list_free (remove);
@ -948,7 +958,7 @@ check_tree_helper (EazelInstall *service,
if (eazel_softcat_available_update (service->private->softcat,
pack_broken,
&pack_update,
MUST_HAVE)) {
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",
@ -969,9 +979,11 @@ check_tree_helper (EazelInstall *service,
#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);
g_message ("available update to %s (%s-%s) does not solves conflict",
pack_update->name,
pack_update->version, pack_update->minor);
#endif
gtk_object_unref (GTK_OBJECT (pack_update));
}
}
}
@ -1057,7 +1069,7 @@ add_file_conflict (PackageData *pack,
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));
gtk_object_unref (GTK_OBJECT (conflict));
}
}
@ -1261,7 +1273,7 @@ check_conflicts_against_already_installed_packages (EazelInstall *service,
service->private->cur_root,
filename,
EAZEL_PACKAGE_SYSTEM_QUERY_OWNS,
PACKAGE_FILL_NO_DIRS_IN_PROVIDES);
OWNS_MUST_HAVE);
/* No need to check packages that we modify */
packagedata_list_prune (&owners, pack->modifies, TRUE, TRUE);
@ -1360,6 +1372,8 @@ check_feature_consistency (EazelInstall *service,
#if EI2_DEBUG & 0x4
trilobite_debug ("checking %s", pack->name);
#else
g_message ("checking feature consistency of %s", pack->name);
#endif
for (modify_it = pack->modifies; modify_it; modify_it = g_list_next (modify_it)) {
@ -1398,6 +1412,11 @@ check_feature_consistency (EazelInstall *service,
pack_broken, pack_broken->name,
pack, pack->name,
pack_modified, pack_modified->name);
#else
g_message ("feature missing : %s breaks, if %s is installed (feature %s would be lost",
pack_broken->name,
pack->name,
feature);
#endif
pack_broken->status = PACKAGE_DEPENDENCY_FAIL;
pack->status = PACKAGE_BREAKS_DEPENDENCY;

View file

@ -59,6 +59,47 @@ eazel_install_problem_debug_attempts (int *key,
}
#endif
static void
get_detailed_messages_breaks_foreach (PackageBreaks *breakage, GetErrorsForEachData *data)
{
PackageData *previous_pack = NULL;
const char *package_broken_name;
GList **errors = &(data->errors);
if (data->path) {
previous_pack = (PackageData*)(data->path->data);
}
package_broken_name = packagebreaks_get_package (breakage)->name;
if (IS_PACKAGEFILECONFLICT (breakage)) {
PackageFileConflict *conflict = PACKAGEFILECONFLICT (breakage);
GList *iterator;
char *message;
message = g_strdup_printf ("Conflict between %s and %s",
previous_pack->name,
package_broken_name);
(*errors) = g_list_append (*errors, message);
for (iterator = conflict->files; iterator; iterator = g_list_next (iterator)) {
char *message;
message = g_strdup_printf ("file : %s", (char*)iterator->data);
(*errors) = g_list_append (*errors, message);
}
} else if (IS_PACKAGEFEATUREMISSING (breakage)) {
PackageFeatureMissing *missing = PACKAGEFEATUREMISSING (breakage);
missing = NULL;
} else {
char *message;
message = g_strdup_printf ("Fuckup between %s and %s",
previous_pack->name,
package_broken_name);
(*errors) = g_list_append (*errors, message);
}
}
static void
get_detailed_messages_foreach (PackageData *pack, GetErrorsForEachData *data)
{
@ -192,7 +233,7 @@ get_detailed_messages_foreach (PackageData *pack, GetErrorsForEachData *data)
g_list_foreach (pack->soft_depends, (GFunc)get_detailed_messages_foreach, data);
g_list_foreach (pack->modifies, (GFunc)get_detailed_messages_foreach, data);
g_list_foreach (pack->breaks, (GFunc)get_detailed_messages_foreach, data);
g_list_foreach (pack->breaks, (GFunc)get_detailed_messages_breaks_foreach, data);
/* Pop the currect pack from the path */
data->path = g_list_remove (data->path, pack);
@ -561,6 +602,10 @@ add_cascade_remove (EazelInstallProblem *problem,
}
}
static void
get_detailed_cases_breaks_foreach (PackageBreaks *breakage, GetErrorsForEachData *data)
{
}
/*
FIXME bugzilla.eazel.com
@ -592,12 +637,6 @@ get_detailed_cases_foreach (PackageData *pack, GetErrorsForEachData *data)
case PACKAGE_SOURCE_NOT_SUPPORTED:
break;
case PACKAGE_FILE_CONFLICT:
g_message ("%s:%d", __FILE__, __LINE__);
if ((pack->name!= NULL) && previous_pack && (strcmp (pack->name, previous_pack->name) != 0)) {
add_update_case (data->problem, pack, TRUE, &(data->errors));
} else {
g_warning ("%s:%d : oops", __FILE__,__LINE__);
}
break;
case PACKAGE_DEPENDENCY_FAIL:
if (pack->soft_depends) {
@ -635,7 +674,7 @@ get_detailed_cases_foreach (PackageData *pack, GetErrorsForEachData *data)
g_list_foreach (pack->soft_depends, (GFunc)get_detailed_cases_foreach, data);
g_list_foreach (pack->modifies, (GFunc)get_detailed_cases_foreach, data);
g_list_foreach (pack->breaks, (GFunc)get_detailed_cases_foreach, data);
g_list_foreach (pack->breaks, (GFunc)get_detailed_cases_breaks_foreach, data);
/* Pop the currect pack from the path */
data->path = g_list_remove (data->path, pack);

View file

@ -106,7 +106,7 @@ eazel_package_system_rpm4_query_impl (EazelPackageSystemRpm4 *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);
}

View file

@ -42,27 +42,45 @@
#ifdef DEBUG_PACKAGE_ALLOCS
static int report_all = 0;
static int package_total_allocs = 0, package_max = 0;
static int package_allocs = 0;
static int category_allocs = 0;
static gboolean at_exit_registered = FALSE;
GList *packages_allocated = NULL;
static void
static int packagebreaks_allocs = 0;
static int category_allocs = 0;
static gboolean at_exit_registered = FALSE;
static void
at_exit_package_data_info (void)
{
GList *iterator;
if (packages_allocated == NULL) {
trilobite_debug ("All packagedata structures deallocated");
trilobite_debug ("Total of %d allocs, max at once was %d", package_total_allocs, package_max);
} else {
trilobite_debug ("Fordømt! Some packagedata structures were not deallocated");
GList *iterator;
trilobite_debug ("Fordømt! %d packagedata structures were leaked", g_list_length (packages_allocated));
trilobite_debug ("Total of %d allocs, max at once was %d", package_total_allocs, package_max);
for (iterator = packages_allocated; iterator; iterator = g_list_next (iterator)) {
PackageData *pack = PACKAGEDATA (iterator->data);
trilobite_debug ("package %p (%s) not deallocated", pack, pack->name);
}
trilobite_debug ("Don't report this as a bug if you're running from CVS or hourly builds");
}
if (category_allocs) {
trilobite_debug ("Fordømt! %d categorydata structures were leaked", category_allocs);
}
if (packagebreaks_allocs) {
trilobite_debug ("Fordømt! %d packagebreaks structures were leaked", packagebreaks_allocs);
}
}
#endif /* DEBUG_PACKAGE_ALLOCS */
static GtkObjectClass *packagedata_parent_class;
static GtkObjectClass *packagebreaks_parent_class;
static PackageBreaksClass *packagefileconflict_parent_class;
static PackageBreaksClass *packagefeaturemissing_parent_class;
const char *
eazel_install_protocol_as_string (URLType protocol)
{
@ -88,7 +106,7 @@ categorydata_new (void)
result = g_new0 (CategoryData, 1);
#ifdef DEBUG_PACKAGE_ALLOCS
category_allocs ++;
if (report_all) trilobite_debug ("category_allocs inced to %d (0x%p)", category_allocs, result);
if (report_all) trilobite_debug ("category_allocs inced to %d (%p)", category_allocs, result);
#endif /* DEBUG_PACKAGE_ALLOCS */
result->name = NULL;
result->description = NULL;
@ -139,7 +157,7 @@ categorydata_destroy_foreach (CategoryData *cd, gpointer ununsed)
{
#ifdef DEBUG_PACKAGE_ALLOCS
category_allocs --;
if (report_all) trilobite_debug ("category_allocs = %d (0x%p) %s", category_allocs, cd, cd ? cd->name: "?");
if (report_all) trilobite_debug ("category_allocs = %d (%p) %s", category_allocs, cd, cd ? cd->name: "?");
#endif /* DEBUG_PACKAGE_ALLOCS */
g_return_if_fail (cd != NULL);
@ -247,17 +265,17 @@ packagedata_finalize (GtkObject *obj)
if (report_all) {
if (pack) {
if (pack->name) {
trilobite_debug ("package_allocs = %d (0x%p) %s",
trilobite_debug ("package_allocs decreased to %d (%p) %s",
package_allocs, pack,pack->name);
} else if (pack->provides) {
trilobite_debug ("package_allocs = %d (0x%p) providing %s",
trilobite_debug ("package_allocs decreased to %d (%p) providing %s",
package_allocs, pack,
(char*)pack->provides->data);
} else {
trilobite_debug ("package_allocs = %d (0x%p) ?", package_allocs, pack);
trilobite_debug ("package_allocs decreased to %d (%p) ?", package_allocs, pack);
}
} else {
trilobite_debug ("package_allocs = %d (0x%p) ??", package_allocs, pack);
trilobite_debug ("package_allocs decreased to %d (%p) ??", package_allocs, pack);
}
}
packages_allocated = g_list_remove (packages_allocated, pack);
@ -321,6 +339,10 @@ packagedata_finalize (GtkObject *obj)
#endif /* HAVE_RPM_30 */
pack->packsys_struc = NULL;
}
if (packagedata_parent_class->finalize) {
packagedata_parent_class->finalize (obj);
}
}
static void
@ -328,8 +350,12 @@ packagedata_class_initialize (PackageDataClass *klass)
{
GtkObjectClass *object_class;
packagedata_parent_class = gtk_type_class (gtk_object_get_type ());
object_class = (GtkObjectClass*)klass;
object_class->finalize = packagedata_finalize;
klass->finalize = packagedata_finalize;
}
static void
@ -340,7 +366,9 @@ packagedata_initialize (PackageData *package) {
#ifdef DEBUG_PACKAGE_ALLOCS
package_allocs ++;
if (report_all) trilobite_debug ("package_allocs inced to %d (0x%p)", package_allocs, package);
package_total_allocs ++;
if (package_allocs > package_max) { package_max = package_allocs; }
if (report_all) trilobite_debug ("package_allocs increased to %d (%p)", package_allocs, package);
if (!at_exit_registered) {
atexit (&at_exit_package_data_info);
at_exit_registered = TRUE;
@ -647,16 +675,16 @@ 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->minor, ".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->minor);
temp2 = strstr (temp, ".200");
temp2 = strstr (temp, "200");
strcpy (temp2, "ESS");
temp2 += strlen (".200x");
temp2 += strlen ("200x");
sscanf (temp2, "%2d%2d%2d%2d", &mo, &da, &ho, &mi);
result = g_strdup_printf ("%s of %d %s, %02d:%02d",
pack->name,
@ -1471,17 +1499,31 @@ static void
packagebreaks_finalize (GtkObject *obj)
{
PackageBreaks *breaks = PACKAGEBREAKS (obj);
#ifdef DEBUG_PACKAGE_ALLOCS
packagebreaks_allocs --;
if (report_all) trilobite_debug ("packagebreaks_allocs decreased to %d (%p)",
packagebreaks_allocs, obj);
#endif /* DEBUG_PACKAGE_ALLOCS */
gtk_object_unref (GTK_OBJECT (breaks->__package));
trilobite_debug ("I'm DYING! %p", obj);
if (packagebreaks_parent_class->finalize) {
packagebreaks_parent_class->finalize (obj);
}
}
static void
packagebreaks_class_initialize (PackageBreaksClass *klass)
{
GtkObjectClass *object_class;
packagebreaks_parent_class = gtk_type_class (gtk_object_get_type ());
object_class = (GtkObjectClass*)klass;
object_class->finalize = packagebreaks_finalize;
klass->finalize = packagebreaks_finalize;
}
static void
@ -1490,6 +1532,12 @@ packagebreaks_initialize (PackageBreaks *breaks)
g_assert (breaks);
g_assert (IS_PACKAGEBREAKS (breaks));
breaks->__package = NULL;
#ifdef DEBUG_PACKAGE_ALLOCS
packagebreaks_allocs ++;
if (report_all) trilobite_debug ("packagebreaks_allocs increased to %d (%p)",
packagebreaks_allocs, breaks);
#endif /* DEBUG_PACKAGE_ALLOCS */
}
GtkType
@ -1557,15 +1605,23 @@ packagefileconflict_finalize (GtkObject *obj)
{
PackageFileConflict *conflict = PACKAGEFILECONFLICT (obj);
g_list_foreach (conflict->files, (GFunc)g_free, NULL);
if (packagefileconflict_parent_class->finalize) {
packagefileconflict_parent_class->finalize (obj);
}
}
static void
packagefileconflict_class_initialize (PackageFileConflictClass *klass)
{
GtkObjectClass *object_class;
packagefileconflict_parent_class = gtk_type_class (packagebreaks_get_type ());
object_class = (GtkObjectClass*)klass;
object_class->finalize = packagefileconflict_finalize;
klass->finalize = packagedata_finalize;
}
static void
@ -1624,6 +1680,10 @@ packagefeaturemissing_finalize (GtkObject *obj)
{
PackageFeatureMissing *conflict = PACKAGEFEATUREMISSING (obj);
g_list_foreach (conflict->features, (GFunc)g_free, NULL);
if (packagefeaturemissing_parent_class->finalize) {
packagefeaturemissing_parent_class->finalize (obj);
}
}
static void
@ -1631,8 +1691,12 @@ packagefeaturemissing_class_initialize (PackageFeatureMissingClass *klass)
{
GtkObjectClass *object_class;
packagefeaturemissing_parent_class = gtk_type_class (packagebreaks_get_type ());
object_class = (GtkObjectClass*)klass;
object_class->finalize = packagefeaturemissing_finalize;
klass->finalize = packagedata_finalize;
}
static void

View file

@ -169,6 +169,7 @@ typedef struct _PackageDataClass PackageDataClass;
struct _PackageDataClass {
GtkObjectClass parent_class;
void (*finalize) (GtkObject *obj);
};
struct _PackageData {
@ -266,8 +267,6 @@ 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);
GList *flatten_packagedata_dependency_tree (GList *packages);
@ -318,6 +317,7 @@ typedef struct _PackageBreaksClass PackageBreaksClass;
struct _PackageBreaksClass {
GtkObjectClass parent_class;
void (*finalize) (GtkObject *obj);
};
struct _PackageBreaks {
@ -341,6 +341,7 @@ typedef struct _PackageFileConflictClass PackageFileConflictClass;
struct _PackageFileConflictClass {
PackageBreaksClass parent_class;
void (*finalize) (GtkObject *obj);
};
struct _PackageFileConflict {
@ -362,6 +363,7 @@ typedef struct _PackageFeatureMissingClass PackageFeatureMissingClass;
struct _PackageFeatureMissingClass {
PackageBreaksClass parent_class;
void (*finalize) (GtkObject *obj);
};
struct _PackageFeatureMissing {

View file

@ -101,10 +101,7 @@ CLEANFILES= $(TRILOBITE_CORBA_GENERATED) idl_stamp
trilobite-service.c: trilobite-service.h
EXTRA_DIST = \
trilobite-service-passwordquery-private.h \
trilobite-root-client-private.h \
trilobite-service-private.h \
trilobite-service-private.h \
EXTRA_DIST = \
trilobite-core-network-slim.c \
$(NULL)