[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.0.0-29-gac85d00



The following commit has been merged in the master branch:
commit 4f833eb616f2def3bd158ac00450dd43c8ddf7d8
Author: Frank Lichtenheld <djpig@debian.org>
Date:   Wed Oct 8 21:04:05 2008 +0200

    Convert most collection scripts from Pipeline to Util
    
    Most old uses of Pipeline are covered by the new functions in Util.

diff --git a/collection/changelog-file b/collection/changelog-file
index 71ff88e..4e3b03d 100755
--- a/collection/changelog-file
+++ b/collection/changelog-file
@@ -21,6 +21,9 @@
 
 use strict;
 
+use lib "$ENV{'LINTIAN_ROOT'}/lib";
+use Util;
+
 ($#ARGV == 1) or fail("syntax: changelog-file <pkg> <type>");
 my $pkg = shift;
 my $type = shift;
@@ -75,11 +78,7 @@ if (defined ($chl) && -l $chl) {
 if (not defined $chl) {
     # no changelog found
 } elsif ($chl =~ /\.gz$/) {
-    use lib "$ENV{'LINTIAN_ROOT'}/lib";
-    use Pipeline;
-
-    pipeline((sub { exec 'gzip', '-dc', $chl }), "changelog") == 0
-	or fail("error in gzip");
+    gunzip_file($chl, 'changelog');
 } elsif (-f $chl && -l $chl) {
     local $_;
     open (CHL, '<', $chl) or fail("cannot open $chl: $!");
@@ -105,25 +104,6 @@ if (-f $news) {
         }
     }
     if ($news) {
-        use lib "$ENV{'LINTIAN_ROOT'}/lib";
-        use Pipeline;
-
-        pipeline((sub { exec 'gzip', '-dc', $news }), "NEWS.Debian") == 0
-            or fail("error in gzip");
-    }
-}
-
-exit 0;
-
-# -----------------------------------
-
-sub fail {
-    if ($_[0]) {
-        print STDERR "internal error: $_[0]\n";
-    } elsif ($!) {
-        print STDERR "internal error: $!\n";
-    } else {
-        print STDERR "internal error.\n";
+	gunzip_file($news, "NEWS.Debian");
     }
-    exit 1;
 }
diff --git a/collection/copyright-file b/collection/copyright-file
index 0146dad..efd474b 100755
--- a/collection/copyright-file
+++ b/collection/copyright-file
@@ -21,6 +21,9 @@
 
 use strict;
 
+use lib "$ENV{'LINTIAN_ROOT'}/lib";
+use Util;
+
 ($#ARGV == 1) or fail("syntax: copyright-file <pkg> <type>");
 my $pkg = shift;
 my $type = shift;
@@ -40,28 +43,8 @@ if (-f $file) {
     link($file, "copyright")
 	or fail("cannot link $file to copyright: $!");
 } elsif (-f "$file.gz") {
-    use lib "$ENV{'LINTIAN_ROOT'}/lib";
-    use Pipeline;
-
-    pipeline((sub { exec 'gzip', '-dc', $file }), "copyright") == 0
-	or fail("error in gzip");
+    gunzip_file($file, 'copyright');
 } else {
     # no copyright file found
-    open(DUMMY, ">copyright");
-    close(DUMMY);
-}
-
-exit 0;
-
-# -----------------------------------
-
-sub fail {
-    if ($_[0]) {
-        print STDERR "internal error: $_[0]\n";
-    } elsif ($!) {
-        print STDERR "internal error: $!\n";
-    } else {
-        print STDERR "internal error.\n";
-    }
-    exit 1;
+    touch_file('copyright');
 }
diff --git a/collection/debfiles b/collection/debfiles
index b443caa..a7664d9 100755
--- a/collection/debfiles
+++ b/collection/debfiles
@@ -28,10 +28,10 @@ my $type = shift;
 -e "unpacked" or fail("debfiles invoked in wrong directory");
 
 use lib "$ENV{'LINTIAN_ROOT'}/lib";
-use Pipeline;
+use Util;
 
 if (-e "debfiles") {
-    spawn('rm', '-rf', 'debfiles') == 0
+    delete_dir('debfiles')
 	or fail("cannot rm old debfiles directory");
 }
 
@@ -42,22 +42,7 @@ opendir(DEBIAN, 'unpacked/debian')
 	or fail("cannot open unpacked/debian/ directory: $!");
 while (my $file=readdir(DEBIAN)) {
 	next if -d $file;
-	spawn('cp', '-a', "unpacked/debian/$file", 'debfiles/') == 0
+	copy_dir("unpacked/debian/$file", 'debfiles/')
 		or fail("cannot copy unpacked/debian/$file: $!");
 }
 closedir(DEBIAN);
-
-exit 0;
-
-# -----------------------------------
-
-sub fail {
-    if ($_[0]) {
-        print STDERR "internal error: $_[0]\n";
-    } elsif ($!) {
-        print STDERR "internal error: $!\n";
-    } else {
-        print STDERR "internal error.\n";
-    }
-    exit 1;
-}
diff --git a/collection/debian-readme b/collection/debian-readme
index 364d496..b82b555 100755
--- a/collection/debian-readme
+++ b/collection/debian-readme
@@ -21,6 +21,9 @@
 
 use strict;
 
+use lib "$ENV{'LINTIAN_ROOT'}/lib";
+use Util;
+
 ($#ARGV == 1) or fail("syntax: debian-readme <pkg> <type>");
 my $pkg = shift;
 my $type = shift;
@@ -34,7 +37,7 @@ my @readmes = ("unpacked/usr/share/doc/$pkg/README.Debian.gz",
 	    "unpacked/usr/share/doc/$pkg/README.Debian",
 	    "unpacked/usr/share/doc/$pkg/README.debian.gz",
 	    "unpacked/usr/share/doc/$pkg/README.debian",
-        "unpacked/usr/doc/$pkg/README.Debian.gz",
+	    "unpacked/usr/doc/$pkg/README.Debian.gz",
 	    "unpacked/usr/doc/$pkg/README.Debian",
 	    "unpacked/usr/doc/$pkg/README.debian.gz",
 	    "unpacked/usr/doc/$pkg/README.debian");
@@ -49,30 +52,10 @@ for (@readmes) {
 
 if (not defined $file) {
     # no README found
-    open(DUMMY, '>', "README.Debian");
-    close(DUMMY);
+    touch_file("README.Debian");
 } elsif ($file =~ m/\.gz$/) {
-    use lib "$ENV{'LINTIAN_ROOT'}/lib";
-    use Pipeline;
-
-    pipeline((sub { exec 'gzip', '-dc', $file }), "README.Debian") == 0
-	or fail("error in gzip");
+    gunzip_file($file, "README.Debian");
 } else {
     link($file, "README.Debian")
 	or fail("cannot link $file to README.Debian: $!");
 }
-
-exit 0;
-
-# -----------------------------------
-
-sub fail {
-    if ($_[0]) {
-        print STDERR "internal error: $_[0]\n";
-    } elsif ($!) {
-        print STDERR "internal error: $!\n";
-    } else {
-        print STDERR "internal error.\n";
-    }
-    exit 1;
-}
diff --git a/collection/diffstat b/collection/diffstat
index 28f77e0..9d07ef3 100755
--- a/collection/diffstat
+++ b/collection/diffstat
@@ -27,7 +27,8 @@
 
 use strict;
 
-my $LINTIAN_ROOT = $ENV{'LINTIAN_ROOT'} || '/usr/share/lintian';
+use lib "$ENV{'LINTIAN_ROOT'}/lib";
+use Util;
 
 ($#ARGV == 1) or fail("syntax: diffstat <pkg>");
 my $pkg = shift;
@@ -43,15 +44,11 @@ $ver =~ s/^\d://; #Remove epoch for this
 my $diff_file = "${pkg}_${ver}.diff.gz";
 unless (-f $diff_file) {
 # we have to write an empty file so that the checks don't crap out. <sigh>
-  open (D, '>', "diffstat"); close D;
+  touch_file('diffstat');
   exit 0;
 }
 
-use lib "$ENV{'LINTIAN_ROOT'}/lib";
-use Pipeline;
-pipeline((sub { exec('gzip', '-dc', $diff_file); }),
-         "debian-patch"
-        );
+gunzip_file($diff_file, "debian-patch");
 
 open (STAT, '>', "diffstat") or fail("cannot open scripts output file: $!");
 # diffstat is noisy on stderr if its stdout is not a tty.
@@ -67,18 +64,3 @@ while (<DIFF>) {
 }
 close DIFF or fail("cannot close pipe to diffstat on debian-patch: $!");
 close STAT or fail("error writing diffstat file: $!");
-
-exit 0;
-
-# -----------------------------------
-
-sub fail {
-    if ($_[0]) {
-        print STDERR "internal error: $_[0]\n";
-    } elsif ($!) {
-        print STDERR "internal error: $!\n";
-    } else {
-        print STDERR "internal error.\n";
-    }
-    exit 1;
-}
diff --git a/collection/doc-base-files b/collection/doc-base-files
index b51f317..3160286 100755
--- a/collection/doc-base-files
+++ b/collection/doc-base-files
@@ -29,32 +29,17 @@ my $type = shift;
 -f "fields/package" or fail("doc-base-files invoked in wrong directory");
 
 use lib "$ENV{'LINTIAN_ROOT'}/lib";
-use Pipeline;
+use Util;
 
 if (-e "doc-base") {
-    spawn('rm', '-rf', 'doc-base') == 0
+    delete_dir("doc-base")
 	or fail("cannot rm old doc-base directory");
 }
 
 if (-d "unpacked/usr/share/doc-base") {
-    spawn('cp', '-a', 'unpacked/usr/share/doc-base', 'doc-base') == 0
+    copy_dir('unpacked/usr/share/doc-base', 'doc-base')
 	or fail("cannot copy directory unpacked/usr/share/doc-base");
 } else {
     # no doc-base directory
     mkdir("doc-base", 0777) or fail("cannot mkdir doc-base: $!");
 }
-
-exit 0;
-
-# -----------------------------------
-
-sub fail {
-    if ($_[0]) {
-        print STDERR "internal error: $_[0]\n";
-    } elsif ($!) {
-        print STDERR "internal error: $!\n";
-    } else {
-        print STDERR "internal error.\n";
-    }
-    exit 1;
-}
diff --git a/collection/init.d b/collection/init.d
index e8d33c8..16f7cf9 100755
--- a/collection/init.d
+++ b/collection/init.d
@@ -28,32 +28,17 @@ my $type = shift;
 -f "fields/package" or fail("init.d invoked in wrong directory");
 
 use lib "$ENV{'LINTIAN_ROOT'}/lib";
-use Pipeline;
+use Util;
 
 if (-e "init.d") {
-    spawn('rm', '-rf', 'init.d') == 0
+    delete_dir("init.d")
 	or fail("cannot rm old init.d directory");
 }
 
 if (-d "unpacked/etc/init.d") {
-    spawn('cp', '-a', 'unpacked/etc/init.d', 'init.d') == 0
+    copy_dir('unpacked/etc/init.d', 'init.d')
 	or fail("cannot copy init.d directory");
 } else {
     # no etc/init.d
     mkdir("init.d", 0777) or fail("cannot mkdir init.d: $!");
 }
-
-exit 0;
-
-# -----------------------------------
-
-sub fail {
-    if ($_[0]) {
-        print STDERR "internal error: $_[0]\n";
-    } elsif ($!) {
-        print STDERR "internal error: $!\n";
-    } else {
-        print STDERR "internal error.\n";
-    }
-    exit 1;
-}
diff --git a/collection/menu-files b/collection/menu-files
index bf7390e..381f9e4 100755
--- a/collection/menu-files
+++ b/collection/menu-files
@@ -28,17 +28,17 @@ my $type = shift;
 -f "fields/package" or fail("menu-files invoked in wrong directory");
 
 use lib "$ENV{'LINTIAN_ROOT'}/lib";
-use Pipeline;
+use Util;
 
 if (-e "menu") {
-    spawn('rm', '-rf', 'menu') == 0
+    delete_dir('menu')
 	or fail("cannot rm old menu directory");
 }
 
 mkdir("menu", 0777) or fail("cannot mkdir menu: $!");
 
 if (-d "unpacked/usr/lib/menu") {    
-    spawn('cp', '-a', 'unpacked/usr/lib/menu', 'menu/lib') == 0
+     copy_dir('unpacked/usr/lib/menu', 'menu/lib')
 	or fail("cannot copy unpacked/usr/lib/menu/ directory");
 } else {
     # no menu directory
@@ -46,25 +46,9 @@ if (-d "unpacked/usr/lib/menu") {
 }
 
 if (-d "unpacked/usr/share/menu") {    
-    spawn('cp', '-a', 'unpacked/usr/share/menu', 'menu/share') == 0
+    copy_dir('unpacked/usr/share/menu', 'menu/share')
 	or fail("cannot copy unpacked/usr/share/menu directory");
 } else {
     # no menu directory
     mkdir("menu/share", 0777) or fail("cannot mkdir menu/share: $!");
 }
-
-
-exit 0;
-
-# -----------------------------------
-
-sub fail {
-    if ($_[0]) {
-        print STDERR "internal error: $_[0]\n";
-    } elsif ($!) {
-        print STDERR "internal error: $!\n";
-    } else {
-        print STDERR "internal error.\n";
-    }
-    exit 1;
-}
diff --git a/collection/override-file b/collection/override-file
index 86902f5..97e2f20 100755
--- a/collection/override-file
+++ b/collection/override-file
@@ -22,6 +22,9 @@
 
 use strict;
 
+use lib "$ENV{'LINTIAN_ROOT'}/lib";
+use Util;
+
 ($#ARGV == 1) or fail("syntax: override-file <pkg> <type>");
 my $pkg = shift;
 my $type = shift;
@@ -46,27 +49,8 @@ if ( ! -f $file )
 if ( $file eq '' ) {
     # no override found
 } elsif ($file =~ /\.gz$/) {
-    use lib "$ENV{'LINTIAN_ROOT'}/lib";
-    use Pipeline;
-
-    pipeline((sub { exec 'gzip', '-dc', $file }), "override") == 0
-	or fail("error in gzip");
+    gunzip_file($file, "override");
 } else {
     link($file, "override")
 	or fail("cannot link $file to override: $!");
 }
-
-exit 0;
-
-# -----------------------------------
-
-sub fail {
-    if ($_[0]) {
-        print STDERR "internal error: $_[0]\n";
-    } elsif ($!) {
-        print STDERR "internal error: $!\n";
-    } else {
-        print STDERR "internal error.\n";
-    }
-    exit 1;
-}

-- 
Debian package checker


Reply to: