summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobey Pointer <robey@src.gnome.org>2000-11-03 20:41:20 +0000
committerRobey Pointer <robey@src.gnome.org>2000-11-03 20:41:20 +0000
commit3ea80060436b579faf599f6ff3eda9d3a726a3a5 (patch)
treeb907fd81606df01702b83b07ce7cd5f453fcb40e
parente7bbf724b86da074101688094e223588db0376b4 (diff)
downloadnautilus-3ea80060436b579faf599f6ff3eda9d3a726a3a5.tar.gz
Clean up debug mode (was missing some pieces) and set up the g_log handler
* components/services/install/lib/eazel-install-logic.c: (dump_one_package): * components/services/install/lib/eazel-install-object.c: (eazel_install_set_arg), (eazel_install_initialize), (eazel_install_fetch_remote_package_list), (eazel_install_log), (eazel_install_set_log), (eazel_install_open_log), (eazel_install_log_to_stderr): * components/services/install/lib/eazel-install-private.h: * components/services/install/lib/eazel-install-public.h: * components/services/install/lib/eazel-install-rpm-glue.c: (eazel_install_rpm_set_settings): * components/services/trilobite/libtrilobite/trilobite-core-utils.c : (trilobite_add_log): Clean up debug mode (was missing some pieces) and set up the g_log handler to not work in corba mode (letting libtrilobite handle them in corba mode). Make it start up as early as possible and let the service provide a file pointer for logging.
-rw-r--r--ChangeLog53
-rw-r--r--components/services/install/lib/eazel-install-logic.c26
-rw-r--r--components/services/install/lib/eazel-install-object.c97
-rw-r--r--components/services/install/lib/eazel-install-private.h1
-rw-r--r--components/services/install/lib/eazel-install-public.h4
-rw-r--r--components/services/install/lib/eazel-install-rpm-glue.c3
-rw-r--r--components/services/trilobite/libtrilobite/trilobite-core-utils.c2
7 files changed, 150 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog
index 7f1222236..461ad7b14 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,56 @@
+2000-11-03 Robey Pointer <robey@eazel.com>
+
+ * components/services/install/lib/eazel-install-logic.c:
+ (dump_one_package):
+ * components/services/install/lib/eazel-install-object.c:
+ (eazel_install_set_arg), (eazel_install_initialize),
+ (eazel_install_fetch_remote_package_list), (eazel_install_log),
+ (eazel_install_set_log), (eazel_install_open_log),
+ (eazel_install_log_to_stderr):
+ * components/services/install/lib/eazel-install-private.h:
+ * components/services/install/lib/eazel-install-public.h:
+ * components/services/install/lib/eazel-install-rpm-glue.c:
+ (eazel_install_rpm_set_settings):
+ * components/services/trilobite/libtrilobite/trilobite-core-utils.c
+ : (trilobite_add_log):
+
+ Clean up debug mode (was missing some pieces) and set up the g_log
+ handler to not work in corba mode (letting libtrilobite handle
+ them in corba mode). Make it start up as early as possible and
+ let the service provide a file pointer for logging.
+
+ * components/services/summary/nautilus-view/nautilus-summary-view.c
+ : (generate_summary_form):
+
+ Make the giant label a little bit more palatable to Arlo.
+
+ * nautilus-installer/src/installer.c: (log_debug),
+ (add_bullet_point_to_vbox), (strip_categories),
+ (start_over_make_category_func), (start_over),
+ (start_over_callback), (dont_start_over_callback),
+ (start_over_timer), (jump_to_retry_page), (create_window),
+ (eazel_install_progress), (eazel_download_progress),
+ (add_force_packages), (add_force_remove), (add_update_package),
+ (get_detailed_errors_foreach), (get_detailed_errors),
+ (install_failed), (download_failed), (eazel_install_preflight),
+ (eazel_install_dep_check), (install_done), (check_if_next_okay),
+ (toggle_button_toggled), (eazel_installer_add_category),
+ (check_system), (more_check_system), (eazel_installer_do_install),
+ (draw_splash_text), (eazel_installer_finalize), (start_logging),
+ (find_old_tmpdir), (eazel_installer_initialize):
+ * nautilus-installer/src/installer.h:
+ * nautilus-installer/src/link.sh:
+ * nautilus-installer/src/main.c:
+ * nautilus-installer/src/prescript:
+
+ Use /tmp/eazel-install.log for logging (being very careful to make
+ sure the file is not a booby trap) instead of spamming all over
+ the terminal. However, the --debug option will give you the
+ terminal spam if you want it (in addition to the logfile). Fix
+ the annoying debug logs to use g_log so we can catch them. Add a
+ --batch option that causes the installer to skip all question
+ screens.
+
2000-11-03 Mathieu Lacage <mathieu@eazel.com>
* user-guide/C/Makefile.am: fix pb with buildir != srcdir
diff --git a/components/services/install/lib/eazel-install-logic.c b/components/services/install/lib/eazel-install-logic.c
index 49daa5874..e9e4930d6 100644
--- a/components/services/install/lib/eazel-install-logic.c
+++ b/components/services/install/lib/eazel-install-logic.c
@@ -1832,22 +1832,24 @@ static void
dump_one_package (PackageData *pack, char *prefix)
{
char *softprefix, *hardprefix, *modprefix, *breakprefix;
- GList *iter;
- int count;
+ char *packname;
- trilobite_debug ("%s%s-%s-%s (stat %s/%s), 0x%08X",
- prefix,
- pack->name, pack->version, pack->minor,
+ if (pack->name == NULL) {
+ if (pack->provides && pack->provides->data) {
+ packname = g_strdup_printf ("[provider of %s]", (char *)(pack->provides->data));
+ } else {
+ packname = g_strdup ("[mystery package]");
+ }
+ } else {
+ packname = g_strdup_printf ("%s-%s-%s", pack->name, pack->version, pack->minor);
+ }
+
+ trilobite_debug ("%s%s (stat %s/%s), 0x%08X",
+ prefix, packname,
packagedata_status_enum_to_str (pack->status),
packagedata_modstatus_enum_to_str (pack->modify_status),
(unsigned int)pack);
- for (count = 0, iter = g_list_first (pack->provides); iter; iter = g_list_next (iter), count++) {
- trilobite_debug ("\t\tprovides %s", (char *)(iter->data));
- if (count >= 1) {
- trilobite_debug("\t\t...and others");
- iter = NULL;
- }
- }
+ g_free (packname);
softprefix = g_strdup_printf ("%s (s) ", prefix);
hardprefix = g_strdup_printf ("%s (h) ", prefix);
diff --git a/components/services/install/lib/eazel-install-object.c b/components/services/install/lib/eazel-install-object.c
index adcdfa6ea..62b1c76af 100644
--- a/components/services/install/lib/eazel-install-object.c
+++ b/components/services/install/lib/eazel-install-object.c
@@ -131,6 +131,13 @@ void eazel_install_emit_dependency_check_default (EazelInstall *service,
void eazel_install_emit_done_default (EazelInstall *service,
gboolean result);
+#ifdef EAZEL_INSTALL_NO_CORBA
+static void eazel_install_log (const char *domain,
+ GLogLevelFlags flags,
+ const char *message,
+ EazelInstall *service);
+#endif
+
#ifndef EAZEL_INSTALL_NO_CORBA
/*****************************************
@@ -286,6 +293,9 @@ eazel_install_set_arg (GtkObject *object,
case ARG_SILENT:
eazel_install_set_silent (service, GTK_VALUE_BOOL(*arg));
break;
+ case ARG_DEBUG:
+ eazel_install_set_debug (service, GTK_VALUE_BOOL (*arg));
+ break;
case ARG_TEST:
eazel_install_set_test (service, GTK_VALUE_BOOL(*arg));
break;
@@ -554,6 +564,14 @@ eazel_install_initialize (EazelInstall *service) {
}
#endif /* EAZEL_INSTALL_NO_CORBA */
+ /* when running as part of trilobite, don't catch logs */
+#ifdef EAZEL_INSTALL_NO_CORBA
+ g_log_set_handler (G_LOG_DOMAIN,
+ G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_ERROR,
+ (GLogFunc)eazel_install_log,
+ service);
+#endif
+
service->private = g_new0 (EazelInstallPrivate,1);
service->private->topts = g_new0 (TransferOptions, 1);
service->private->iopts = g_new0 (InstallOptions, 1);
@@ -570,6 +588,7 @@ eazel_install_initialize (EazelInstall *service) {
trilobite_debug ("packsys.rpm.dbs = 0x%x", service->private->packsys.rpm.dbs);
service->private->logfile = NULL;
service->private->logfilename = NULL;
+ service->private->log_to_stderr = FALSE;
service->private->name_to_package_hash = g_hash_table_new ((GHashFunc)g_str_hash,
(GCompareFunc)g_str_equal);
service->private->downloaded_files = NULL;
@@ -750,7 +769,7 @@ eazel_install_fetch_remote_package_list (EazelInstall *service)
SANITY_VAL(service, FALSE);
- g_print (_("Getting package list from remote server ...\n"));
+ trilobite_debug (_("Getting package list from remote server ...\n"));
url = g_strdup_printf ("http://%s:%d%s%s",
eazel_install_get_server (service),
@@ -778,44 +797,78 @@ eazel_install_fetch_remote_package_list (EazelInstall *service)
return retval;
}
+#ifdef EAZEL_INSTALL_NO_CORBA
static void
eazel_install_log (const char *domain,
GLogLevelFlags flags,
const char *message,
EazelInstall *service)
{
+ char *format;
+
SANITY (service);
- if ( flags | G_LOG_LEVEL_MESSAGE) {
- fprintf (service->private->logfile, " : %s\n", message);
- } else if (flags | G_LOG_LEVEL_WARNING) {
- fprintf (service->private->logfile, "w: %s\n", message);
- } else if (flags | G_LOG_LEVEL_ERROR) {
- fprintf (service->private->logfile, "E: %s\n", message);
- }
+
+ if (flags & G_LOG_LEVEL_DEBUG) {
+ format = "d: %s\n";
+ } else if (flags & G_LOG_LEVEL_MESSAGE) {
+ format = " : %s\n";
+ } else if (flags & G_LOG_LEVEL_WARNING) {
+ format = "w: %s\n";
+ } else if (flags & G_LOG_LEVEL_ERROR) {
+ format = "E: %s\n";
+ } else {
+ format = "?: %s\n";
+ }
+
+ if (service->private->logfile != NULL) {
+ fprintf (service->private->logfile, format, message);
+ fflush (service->private->logfile);
+ }
+ if (service->private->log_to_stderr || (service->private->logfile == NULL)) {
+ if ((flags & G_LOG_LEVEL_DEBUG) && ! service->private->iopts->mode_debug) {
+ /* don't log debug stuff to stderr unless debug mode is on */
+ return;
+ }
+ fprintf (stderr, format, message);
+ }
}
+#endif
+
+void
+eazel_install_set_log (EazelInstall *service,
+ FILE *logfp)
+{
+ if (service->private->logfile != NULL) {
+ fclose (service->private->logfile);
+ }
+ service->private->logfile = logfp;
+}
void
eazel_install_open_log (EazelInstall *service,
const char *fname)
{
+ FILE *fp;
+
SANITY (service);
- if (service->private->logfile) {
- fclose (service->private->logfile);
- }
- service->private->logfile = fopen (fname, "wt");
- if (service->private->logfilename) {
- g_free (service->private->logfilename);
+ fp = fopen (fname, "wt");
+ if (fp != NULL) {
+ eazel_install_set_log (service, fp);
+ if (service->private->logfilename) {
+ g_free (service->private->logfilename);
+ }
+ service->private->logfilename = g_strdup (fname);
+ } else {
+ g_warning (_("Cannot write to file %s, using default log handler"), fname);
}
- service->private->logfilename = g_strdup (fname);
- if (service->private->logfile!=NULL) {
- g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_ERROR,
- (GLogFunc)eazel_install_log,
- service);
- return;
- }
+}
- g_warning (_("Cannot write to file %s, using default log handler"), fname);
+void
+eazel_install_log_to_stderr (EazelInstall *service,
+ gboolean log_to_stderr)
+{
+ service->private->log_to_stderr = log_to_stderr;
}
static gboolean
diff --git a/components/services/install/lib/eazel-install-private.h b/components/services/install/lib/eazel-install-private.h
index 0eb1c1f03..df12a91d7 100644
--- a/components/services/install/lib/eazel-install-private.h
+++ b/components/services/install/lib/eazel-install-private.h
@@ -87,6 +87,7 @@ struct _EazelInstallPrivate {
/* The logfile used for the object */
FILE *logfile;
char *logfilename;
+ gboolean log_to_stderr;
/* TRUE if the rpm subcommand is running */
volatile gboolean subcommand_running;
diff --git a/components/services/install/lib/eazel-install-public.h b/components/services/install/lib/eazel-install-public.h
index b7396b935..508ac0c45 100644
--- a/components/services/install/lib/eazel-install-public.h
+++ b/components/services/install/lib/eazel-install-public.h
@@ -120,8 +120,12 @@ POA_Trilobite_Eazel_Install__epv *eazel_install_get_epv (void);
Trilobite_Eazel_Install eazel_install_create_corba_object (BonoboObject *service);
#endif /* EAZEL_INSTALL_NO_CORBA */
+void eazel_install_set_log (EazelInstall *service,
+ FILE *logfp);
void eazel_install_open_log (EazelInstall *service,
const char *fname);
+void eazel_install_log_to_stderr (EazelInstall *service,
+ gboolean log_to_stderr);
/* This sets mode 500 on tmpdir and all files in
private->downloaded_files */
diff --git a/components/services/install/lib/eazel-install-rpm-glue.c b/components/services/install/lib/eazel-install-rpm-glue.c
index 342a6e55b..8fcd63c18 100644
--- a/components/services/install/lib/eazel-install-rpm-glue.c
+++ b/components/services/install/lib/eazel-install-rpm-glue.c
@@ -87,7 +87,8 @@ eazel_install_rpm_set_settings (EazelInstall *service) {
service->private->packsys.rpm.interface_flags = interface_flags;
service->private->packsys.rpm.problem_filters = problem_filters;
- if (eazel_install_get_debug (service)) {
+ /* this spams to stderr -- is that what we really want? */
+ if (eazel_install_get_debug (service) && 0) {
rpmSetVerbosity (RPMMESS_DEBUG);
}
diff --git a/components/services/trilobite/libtrilobite/trilobite-core-utils.c b/components/services/trilobite/libtrilobite/trilobite-core-utils.c
index aea3f6320..b36ab3e82 100644
--- a/components/services/trilobite/libtrilobite/trilobite-core-utils.c
+++ b/components/services/trilobite/libtrilobite/trilobite-core-utils.c
@@ -165,7 +165,7 @@ trilobite_add_log (const char *domain, GLogLevelFlags flags, const char *message
if (flags & G_LOG_LEVEL_DEBUG) {
if (do_debug_log) {
- prefix = "/// debug:";
+ prefix = "d:";
} else {
return;
}