From: Ian Jackson Date: Tue, 25 Mar 2008 05:06:59 +0000 (+0200) Subject: Improve log and status-fd output X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b17a3f432918e2c82fd8eb5aeec564d9264a3117;p=dpkg Improve log and status-fd output Add calls to log_message and hook statusfd_send into log_action. --- diff --git a/ChangeLog b/ChangeLog index 562fdda8..457b5c83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-03-25 Ian Jackson + + * src/archives.c (archivefiles): Call log_message. + * src/configure.c (deferred_configure): Likewise. + * src/packages.c (packages): Likewise. + * src/processarc.c (process_archive): Call log_action after printing + the action to perform to stdout. + * src/help.c (log_action): Call statusfd_send. + 2008-03-25 Ian Jackson , Guillem Jover diff --git a/debian/changelog b/debian/changelog index 2b33bfe4..f28d30f0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -36,6 +36,8 @@ dpkg (1.14.17) UNRELEASED; urgency=low * Move test suite invokation to a new check target in debian/rules. * Add support for nocheck DEB_BUILD_OPTIONS in debian/rules, so that the dpkg test suite can be skept if desired. + * Improve log and status-fd output by printing more status change updates + and actions. Thanks to Ian Jackson. [ Raphael Hertzog ] * Add a warning displayed by dpkg-genchanges if the current version is diff --git a/man/ChangeLog b/man/ChangeLog index 586de5de..db2ebac5 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,7 @@ +2008-03-25 Ian Jackson + + * dpkg.1: Document improved status-fd output. + 2008-03-14 Guillem Jover Fix errors spotted by Helge Kreutzmann. diff --git a/man/dpkg.1 b/man/dpkg.1 index a49b5de0..0adbf135 100644 --- a/man/dpkg.1 +++ b/man/dpkg.1 @@ -480,12 +480,30 @@ be marked selected for deinstallation. Don't install the package if the same version of the package is already installed. .TP -\fB\-\-status\-fd \fP\fI\fP -Send package status info to file descriptor \fI\fP. This can be given -multiple times. Status updates are of the form `status: : '. -Errors are reported as `status: : error: extend-error-message'. -Configuration file conflicts are reported as -`status: conffile-prompt: conffile : 'current-conffile' 'new-conffile' useredited distedited'. +\fB\-\-status\-fd \fR\fIn\fR +Send machine-readable package status and progress information to file +descriptor \fIn\fP. This option can be specified multiple times. The +information is generally one record per line, in one of the following +forms: +.RS +.TP +.BI "status: " package ": " status +Package status changed; \fIstatus\fR is as in the status file. +.TP +.BI "status: " package " : error : " extended-error-message +An error occurred. Unfortunately at the time of writing +\fIextended-error-message\fR can contain newlines, although in locales +where the translators have not made mistakes every newline is followed +by at least one space. +.TP +.BI "status: " file " : conffile-prompt : '" real-old "' '" real-new "' " useredited " " distedited +User is being asked a configuration file question. +.TP +.BI "processing: " stage ": " package +Sent just before a processing stage starts. \fIstage\fR is one of +.BR upgrade ", " install " (both sent before unpacking)," +.BR configure ", " trigproc ", " remove ", " purge . +.RE .TP \fB\-\-log=\fP\fIfilename\fP Log status change updates and actions to \fIfilename\fP, instead of diff --git a/src/archives.c b/src/archives.c index c325647f..cfd471f2 100644 --- a/src/archives.c +++ b/src/archives.c @@ -1088,6 +1088,7 @@ void archivefiles(const char *const *argv) { : msdbrw_needsuperuser); checkpath(); + log_message("startup archives %s", cipaction->olong); if (f_recursive) { diff --git a/src/configure.c b/src/configure.c index 8f447fe1..4fbdc74c 100644 --- a/src/configure.c +++ b/src/configure.c @@ -132,6 +132,7 @@ void deferred_configure(struct pkginfo *pkg) { printf(_("Setting up %s (%s) ...\n"),pkg->name, versiondescribe(&pkg->installed.version, vdew_nonambig)); + log_action("configure", pkg); if (f_noact) { pkg->status= stat_installed; diff --git a/src/help.c b/src/help.c index 2396d39b..67371409 100644 --- a/src/help.c +++ b/src/help.c @@ -490,4 +490,5 @@ void log_action(const char *action, struct pkginfo *pkg) { log_message("%s %s %s %s", action, pkg->name, versiondescribe(&pkg->installed.version, vdew_nonambig), versiondescribe(&pkg->available.version, vdew_nonambig)); + statusfd_send("processing: %s: %s", action, pkg->name); } diff --git a/src/packages.c b/src/packages.c index 50f18ec7..9d00ef0e 100644 --- a/src/packages.c +++ b/src/packages.c @@ -94,6 +94,7 @@ void packages(const char *const *argv) { : fc_nonroot ? msdbrw_write : msdbrw_needsuperuser); checkpath(); + log_message("startup packages %s", cipaction->olong); if (f_pending) { diff --git a/src/processarc.c b/src/processarc.c index 271e1b86..d47a3f48 100644 --- a/src/processarc.c +++ b/src/processarc.c @@ -284,11 +284,11 @@ void process_archive(const char *filename) { filesdbinit(); if (pkg->status != stat_notinstalled && pkg->status != stat_configfiles) { - log_action("upgrade", pkg); printf(_("Preparing to replace %s %s (using %s) ...\n"), pkg->name, versiondescribe(&pkg->installed.version,vdew_nonambig), pfilename); + log_action("upgrade", pkg); } else { printf(_("Unpacking %s (from %s) ...\n"),pkg->name,pfilename); log_action("install", pkg);