[dpkg] 22/28: dpkg-gensymbols: Print "error" instead of "warning" when these are fatal

Mattia Rizzolo mattia at debian.org
Mon Jan 22 17:11:24 UTC 2018


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

mattia pushed a commit to branch master
in repository dpkg.

commit cfb7a0e98b05e41cdbe9f695fd9f625c7a119b81
Author: Guillem Jover <guillem at debian.org>
Date:   Sun Dec 10 13:36:11 2017 +0100

    dpkg-gensymbols: Print "error" instead of "warning" when these are fatal
    
    It's confusing to emit the compare problems as warnings when they cause
    the program to exit with an error exit code.
    
    Closes: #881488
---
 debian/changelog           |  2 ++
 scripts/dpkg-gensymbols.pl | 31 +++++++++++++++++++------------
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index f83b8b6..7883dac 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,8 @@ dpkg (1.19.1) UNRELEASED; urgency=medium
     variables to buildtools.mk. Prompted by Helmut Grohne <helmut at subdivi.de>.
   * Restore rejecting negated architectures in Architecture field in
     dpkg-gencontrol and dpkg-genchanges. Regression introduced in dpkg 1.18.5.
+  * Fix dpkg-gensymbols to print "error" instead of "warning" when these
+    are fatal. Closes: #881488
   * Architecture support:
     - Add support for riscv64 CPU. Closes: #822914
       Thanks to Manuel A. Fernandez Montecelo <mafm at debian.org>
diff --git a/scripts/dpkg-gensymbols.pl b/scripts/dpkg-gensymbols.pl
index 09b0aa6..ef09928 100755
--- a/scripts/dpkg-gensymbols.pl
+++ b/scripts/dpkg-gensymbols.pl
@@ -253,27 +253,34 @@ if ($stdout) {
 
 # Check if generated files differs from reference file
 my $exitcode = 0;
+
+sub compare_problem
+{
+    my ($level, $msg, @args) = @_;
+
+    if ($compare >= $level) {
+        errormsg($msg, @args);
+        $exitcode = $level;
+    } else {
+        warning($msg, @args) unless $quiet;
+    }
+}
+
 if ($compare || ! $quiet) {
     # Compare
     if (my @libs = $symfile->get_new_libs($ref_symfile)) {
-	warning(g_('new libraries appeared in the symbols file: %s'), "@libs")
-	    unless $quiet;
-	$exitcode = 4 if ($compare >= 4);
+        compare_problem(4, g_('new libraries appeared in the symbols file: %s'), "@libs");
     }
     if (my @libs = $symfile->get_lost_libs($ref_symfile)) {
-	warning(g_('some libraries disappeared in the symbols file: %s'), "@libs")
-	    unless $quiet;
-	$exitcode = 3 if ($compare >= 3);
+        compare_problem(3, g_('some libraries disappeared in the symbols file: %s'), "@libs");
     }
     if ($symfile->get_new_symbols($ref_symfile)) {
-	warning(g_('some new symbols appeared in the symbols file: %s'),
-		g_('see diff output below')) unless $quiet;
-	$exitcode = 2 if ($compare >= 2);
+        compare_problem(2, g_('some new symbols appeared in the symbols file: %s'),
+                           g_('see diff output below'));
     }
     if ($symfile->get_lost_symbols($ref_symfile)) {
-	warning(g_('some symbols or patterns disappeared in the symbols file: %s'),
-	        g_('see diff output below')) unless $quiet;
-	$exitcode = 1 if ($compare >= 1);
+        compare_problem(1, g_('some symbols or patterns disappeared in the symbols file: %s'),
+                           g_('see diff output below'))
     }
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list