Author: adsb
Date: 2009-03-02 18:39:04 +0000 (Mon, 02 Mar 2009)
New Revision: 1831

Modified:
   trunk/debian/changelog
   trunk/scripts/debdiff.pl
Log:
Set the exit status correctly when comparing source packages.  If
differences were found, debdiff will now exit with a status of 1, as
per debdiff(1).

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2009-03-02 18:05:21 UTC (rev 1830)
+++ trunk/debian/changelog      2009-03-02 18:39:04 UTC (rev 1831)
@@ -4,6 +4,9 @@
   * debdiff:
     + Don't treat an absence of differences as an error when comparing
       source packages. (Closes: #515683)
+    + Set the exit status correctly when comparing source packages.  If
+      differences were found, debdiff will now exit with a status of 1, as
+      per debdiff(1).
   * licensecheck:
     + Document --no-conf.
     + Fix an uninitialised variable warning when --no-conf is used. Thanks.

Modified: trunk/scripts/debdiff.pl
===================================================================
--- trunk/scripts/debdiff.pl    2009-03-02 18:05:21 UTC (rev 1830)
+++ trunk/scripts/debdiff.pl    2009-03-02 18:39:04 UTC (rev 1831)
@@ -507,11 +507,16 @@
                system("diffstat $filename");
                print "\n";
            }
-           open( INTERDIFF, '<', $filename );
-           while( <INTERDIFF> ) {
-               print $_;
+
+           if (-s $filename) {
+               open( INTERDIFF, '<', $filename );
+               while( <INTERDIFF> ) {
+                   print $_;
+               }
+               close INTERDIFF;
+
+               $exit_status = 1;
            }
-           close INTERDIFF;
        }
     } else {
        # Any other situation
@@ -623,19 +628,23 @@
            system ("rm", "-rf", $wdiffdir1, $wdiffdir2);
        }
 
-       open( DIFF, '<', $filename );
+       if (-s $filename) {
+           open( DIFF, '<', $filename );
 
-       while(<DIFF>) {
+           while(<DIFF>) {
                s/^--- $dir1\//--- /;
                s/^\+\+\+ $dir2\//+++ /;
                s/^(diff .*) $dir1\/\Q$sdir1\E/$1 $sdir1/;
                s/^(diff .*) $dir2\/\Q$sdir2\E/$1 $sdir2/;
                print;
-       }
-       close DIFF;
+           }
+           close DIFF;
+
+           $exit_status = 1;
+       }
     }
 
-    exit 0;
+    exit $exit_status;
 }
 else {
     fatal "Internal error: \$type = $type unrecognised";



-- 
To unsubscribe, send mail to [email protected].

Reply via email to