Kaynağa Gözat

Improve log and status-fd output

Add calls to log_message and hook statusfd_send into log_action.
Ian Jackson 18 yıl önce
ebeveyn
işleme
b17a3f4329
9 değiştirilmiş dosya ile 44 ekleme ve 7 silme
  1. 9 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 4 0
      man/ChangeLog
  4. 24 6
      man/dpkg.1
  5. 1 0
      src/archives.c
  6. 1 0
      src/configure.c
  7. 1 0
      src/help.c
  8. 1 0
      src/packages.c
  9. 1 1
      src/processarc.c

+ 9 - 0
ChangeLog

@@ -1,3 +1,12 @@
+2008-03-25  Ian Jackson  <ian@davenant.greenend.org.uk>
+
+	* 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  <ian@davenant.greenend.org.uk>,
 2008-03-25  Ian Jackson  <ian@davenant.greenend.org.uk>,
             Guillem Jover  <guillem@debian.org>
             Guillem Jover  <guillem@debian.org>
 
 

+ 2 - 0
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.
   * 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
   * Add support for nocheck DEB_BUILD_OPTIONS in debian/rules, so that the
     dpkg test suite can be skept if desired.
     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 ]
   [ Raphael Hertzog ]
   * Add a warning displayed by dpkg-genchanges if the current version is
   * Add a warning displayed by dpkg-genchanges if the current version is

+ 4 - 0
man/ChangeLog

@@ -1,3 +1,7 @@
+2008-03-25  Ian Jackson  <ian@davenant.greenend.org.uk>
+
+	* dpkg.1: Document improved status-fd output.
+
 2008-03-14  Guillem Jover  <guillem@debian.org>
 2008-03-14  Guillem Jover  <guillem@debian.org>
 
 
 	Fix errors spotted by Helge Kreutzmann.
 	Fix errors spotted by Helge Kreutzmann.

+ 24 - 6
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
 Don't install the package if the same version of the package is already
 installed.
 installed.
 .TP
 .TP
-\fB\-\-status\-fd \fP\fI<n>\fP
-Send package status info to file descriptor \fI<n>\fP. This can be given
-multiple times. Status updates are of the form `status: <pkg>: <pkg state>'.
-Errors are reported as `status: <pkg>: 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
 .TP
 \fB\-\-log=\fP\fIfilename\fP
 \fB\-\-log=\fP\fIfilename\fP
 Log status change updates and actions to \fIfilename\fP, instead of
 Log status change updates and actions to \fIfilename\fP, instead of

+ 1 - 0
src/archives.c

@@ -1088,6 +1088,7 @@ void archivefiles(const char *const *argv) {
                :                               msdbrw_needsuperuser);
                :                               msdbrw_needsuperuser);
 
 
   checkpath();
   checkpath();
+  log_message("startup archives %s", cipaction->olong);
   
   
   if (f_recursive) {
   if (f_recursive) {
     
     

+ 1 - 0
src/configure.c

@@ -132,6 +132,7 @@ void deferred_configure(struct pkginfo *pkg) {
 
 
 	printf(_("Setting up %s (%s) ...\n"),pkg->name,
 	printf(_("Setting up %s (%s) ...\n"),pkg->name,
 	       versiondescribe(&pkg->installed.version, vdew_nonambig));
 	       versiondescribe(&pkg->installed.version, vdew_nonambig));
+	log_action("configure", pkg);
 
 
 	if (f_noact) {
 	if (f_noact) {
 		pkg->status= stat_installed;
 		pkg->status= stat_installed;

+ 1 - 0
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,
   log_message("%s %s %s %s", action, pkg->name,
 	      versiondescribe(&pkg->installed.version, vdew_nonambig),
 	      versiondescribe(&pkg->installed.version, vdew_nonambig),
 	      versiondescribe(&pkg->available.version, vdew_nonambig));
 	      versiondescribe(&pkg->available.version, vdew_nonambig));
+  statusfd_send("processing: %s: %s", action, pkg->name);
 }
 }

+ 1 - 0
src/packages.c

@@ -94,6 +94,7 @@ void packages(const char *const *argv) {
                : fc_nonroot ? msdbrw_write
                : fc_nonroot ? msdbrw_write
                :              msdbrw_needsuperuser);
                :              msdbrw_needsuperuser);
   checkpath();
   checkpath();
+  log_message("startup packages %s", cipaction->olong);
 
 
   if (f_pending) {
   if (f_pending) {
 
 

+ 1 - 1
src/processarc.c

@@ -284,11 +284,11 @@ void process_archive(const char *filename) {
   filesdbinit();
   filesdbinit();
   
   
   if (pkg->status != stat_notinstalled && pkg->status != stat_configfiles) {
   if (pkg->status != stat_notinstalled && pkg->status != stat_configfiles) {
-    log_action("upgrade", pkg);
     printf(_("Preparing to replace %s %s (using %s) ...\n"),
     printf(_("Preparing to replace %s %s (using %s) ...\n"),
            pkg->name,
            pkg->name,
            versiondescribe(&pkg->installed.version,vdew_nonambig),
            versiondescribe(&pkg->installed.version,vdew_nonambig),
            pfilename);
            pfilename);
+    log_action("upgrade", pkg);
   } else {
   } else {
     printf(_("Unpacking %s (from %s) ...\n"),pkg->name,pfilename);
     printf(_("Unpacking %s (from %s) ...\n"),pkg->name,pfilename);
     log_action("install", pkg);
     log_action("install", pkg);