This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=8c7a750be37a5940232a4f1f6b2c32d19754c24c

commit 8c7a750be37a5940232a4f1f6b2c32d19754c24c
Author: Guillem Jover <[email protected]>
AuthorDate: Fri Oct 26 09:46:29 2018 +0200

    u-a: Add new --debug option
    
    The code was there but commented out. Let's add proper support for
    debugging output, controllable at run-time.
---
 debian/changelog            |  1 +
 man/update-alternatives.man |  8 ++++++--
 utils/update-alternatives.c | 15 ++++++++++-----
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b3c86a11e..e5ffd7908 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,6 +18,7 @@ dpkg (1.19.3) UNRELEASED; urgency=medium
   * start-stop-daemon: Add new --notify-await and --notify-timeout options,
     which implement the systemd readiness protocol for services.
     Closes: #910707
+  * update-alternatives: Add new --debug option.
   * Perl modules:
     - Dpkg::Changelog::Debian: Preserve modelines at EOF. Closes: #916056
       Thanks to Chris Lamb <[email protected]> for initial test cases.
diff --git a/man/update-alternatives.man b/man/update-alternatives.man
index 7d81271c9..a1023d854 100644
--- a/man/update-alternatives.man
+++ b/man/update-alternatives.man
@@ -364,11 +364,15 @@ Skip configuration prompt for alternatives which are 
properly configured
 in automatic mode. This option is only relevant with \fB\-\-config\fR or
 \fB\-\-all\fR.
 .TP
+.B \-\-quiet
+Do not generate any comments unless errors occur.
+.TP
 .B \-\-verbose
 Generate more comments about what is being done.
 .TP
-.B \-\-quiet
-Don't generate any comments unless errors occur.
+.B \-\-debug
+Generate even more comments, helpful for debugging, about what is being done
+(since version 1.19.3).
 .
 .SH EXIT STATUS
 .TP
diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 61e07bc8f..88db6e274 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -94,6 +94,7 @@ enum output_mode {
        OUTPUT_QUIET = -1,
        OUTPUT_NORMAL = 0,
        OUTPUT_VERBOSE = 1,
+       OUTPUT_DEBUG = 2,
 };
 
 /* Action to perform */
@@ -164,8 +165,9 @@ usage(void)
 "  --force                  allow replacing files with alternative links.\n"
 "  --skip-auto              skip prompt for alternatives correctly 
configured\n"
 "                           in automatic mode (relevant for --config only)\n"
-"  --verbose                verbose operation, more output.\n"
 "  --quiet                  quiet operation, minimal output.\n"
+"  --verbose                verbose operation, more output.\n"
+"  --debug                  debug output, way more output.\n"
 "  --help                   show this help message.\n"
 "  --version                show the version.\n"
 ));
@@ -231,15 +233,16 @@ warning(char const *fmt, ...)
 static void DPKG_ATTR_PRINTF(1)
 debug(char const *fmt, ...)
 {
-#if 0
        va_list args;
 
+       if (opt_verbose < OUTPUT_DEBUG)
+               return;
+
        fprintf(stderr, "DEBUG: ");
        va_start(args, fmt);
        vfprintf(stderr, fmt, args);
        va_end(args);
        fprintf(stderr, "\n");
-#endif
 }
 
 static void DPKG_ATTR_PRINTF(1)
@@ -2635,10 +2638,12 @@ main(int argc, char **argv)
                } else if (strcmp("--version", argv[i]) == 0) {
                        version();
                        exit(0);
-               } else if (strcmp("--verbose", argv[i]) == 0) {
-                       opt_verbose = OUTPUT_VERBOSE;
                } else if (strcmp("--quiet", argv[i]) == 0) {
                        opt_verbose = OUTPUT_QUIET;
+               } else if (strcmp("--verbose", argv[i]) == 0) {
+                       opt_verbose = OUTPUT_VERBOSE;
+               } else if (strcmp("--debug", argv[i]) == 0) {
+                       opt_verbose = OUTPUT_DEBUG;
                } else if (strcmp("--install", argv[i]) == 0) {
                        char *prio_str, *prio_end;
                        long prio;

-- 
Dpkg.Org's dpkg

Reply via email to