[SCM] Debian package checker branch, master, updated. 2.2.5-38-gcc59976
The following commit has been merged in the master branch:
commit 80f56a3acd4807af5df8a126c5957087e284175e
Author: Russ Allbery <rra@debian.org>
Date: Sat Feb 21 14:41:55 2009 -0800
Add support for raw source package checks
* t/runtests:
+ [RA] Add support for raw source package checks in the source
subdirectory. See t/source/README for more details.
diff --git a/debian/changelog b/debian/changelog
index 4ea0a74..38dbad4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -77,6 +77,10 @@ lintian (2.2.6) UNRELEASED; urgency=low
+ [RA] New script to generate the list of virtual packages. Based on
a patch by Raphael Geissert.
+ * t/runtests:
+ + [RA] Add support for raw source package checks in the source
+ subdirectory. See t/source/README for more details.
+
* unpack/unpack-srcpkg-l1:
+ [ADB] Handle a number of different ways in which upstream directory
trees may be represented in tarballs. (Closes: #515795)
diff --git a/t/runtests b/t/runtests
index 3c0f4bb..67891f3 100755
--- a/t/runtests
+++ b/t/runtests
@@ -195,6 +195,45 @@ for (@tests) {
$tests_run++;
}
+# --- Run all source tests
+
+$prev = $prev || scalar(@tests);
+@tests = ();
+if ($singletest) {
+ my $test = $singletest;
+ if (-d "$TESTSET/source/$test") {
+ @tests = ($test);
+ }
+} elsif ($tag) {
+ @tests = find_source_for_tag($tag);
+} else {
+ unless (-d "$TESTSET/source") {
+ fail("cannot find $TESTSET/source: $!");
+ }
+ @tests = map {
+ if (-d $_) {
+ s,^\Q$TESTSET/source/\E,,;
+ $_;
+ } else {
+ ();
+ }
+ } sort(<$TESTSET/source/*>);
+}
+if ($prev and @tests) {
+ print "\n";
+ $prev = 0;
+}
+print "Found the following source tests: @tests\n" if $DEBUG;
+print "Raw Debian source package tests:\n" if @tests;
+for (@tests) {
+ my $okay = test_source($_);
+ unless ($okay) {
+ exit 1 unless $run_all_tests;
+ $status = 1;
+ }
+ $tests_run++;
+}
+
# --- Run all package tests
$prev = $prev || scalar(@tests);
@@ -473,7 +512,7 @@ sub find_debs_for_tag {
return @tests;
}
-# Run a test on a changes file and show any diffs in the expected tags or any
+# Run a test on a .deb file and show any diffs in the expected tags or any
# other errors detected. Takes the test name. Returns true if the test
# passes and false if it fails.
sub test_deb {
@@ -507,6 +546,66 @@ sub test_deb {
}
}
+# --- Raw Debian source package testing
+
+# Find all source tests that check a particular tag, either for its presence
+# or absence. Returns a list of check names.
+sub find_source_for_tag {
+ my ($tag) = @_;
+ my @tests;
+ for my $test (<$TESTSET/source/*/tags>) {
+ my ($testname) = ($test =~ m,.*/([^/]+)/tags$,);
+ open(TAGS, '<', $test) or fail("Cannot open $test");
+ local $_;
+ while (<TAGS>) {
+ next if /^N: /;
+ if (not /^.: \S+(?: (?:source|udeb))?: (\S+)/) {
+ next;
+ }
+ if ($1 eq $tag) {
+ push(@tests, $testname);
+ last;
+ }
+ }
+ close TAGS;
+ }
+ return @tests;
+}
+
+# Run a test on a source package and show any diffs in the expected tags or
+# any other errors detected. Takes the test name. Returns true if the test
+# passes and false if it fails.
+sub test_source {
+ my ($test) = @_;
+ print "Running test $test... ";
+
+ my $testdir = "$TESTSET/source/$test";
+ my $targetdir = "$RUNDIR/$test";
+
+ print "Cleaning up and repopulating $targetdir...\n" if $DEBUG;
+ runsystem_ok("rm", "-rf", $targetdir);
+ runsystem("cp", "-rp", $testdir, $targetdir);
+
+ print "building... ";
+ runsystem("cd $targetdir && make >../build.$test 2>&1");
+
+ print "testing... ";
+ runsystem_ok("$LINTIAN -I -E $targetdir/*.dsc 2>&1" .
+ " | sort > $RUNDIR/tags.$test");
+
+ # Compare the output to the expected tags.
+ my $testok = runsystem_ok('cmp', '-s', "$testdir/tags",
+ "$RUNDIR/tags.$test");
+ if ($testok) {
+ print "ok.\n";
+ return 1;
+ } else {
+ print "FAILED:\n";
+ runsystem_ok("diff", "-u", "$testdir/tags", "$RUNDIR/tags.$test");
+ return;
+ }
+}
+
# --------------
# Unquote a heredoc, used to make them a bit more readable in Perl code.
diff --git a/t/debs/README b/t/source/README
similarity index 75%
copy from t/debs/README
copy to t/source/README
index f37e526..c075631 100644
--- a/t/debs/README
+++ b/t/source/README
@@ -1,12 +1,12 @@
WRITING A TEST
==============
-This test framework is intended to test low-level Lintian checks
-and behavior with very malformed packages. It provides a mechanism
-to manually construct pathological deb files and run lintian on
-them. It should only be used when this degree of low-level control
-is necessary. For other, more conventional cases, use the tests
-framework.
+This test framework is intended to test low-level Lintian checks and
+behavior with manually constructed source packages. It provides a
+mechanism to manually construct pathological source packages and run
+lintian on them. It should only be used when this degree of low-level
+control is necessary. For other, more conventional cases, use the
+tests framework.
A test in this framework is a directory containing (at least) a tags
file and a Makefile. The directory may contain other files as needed
@@ -24,21 +24,17 @@ The Makefile
------------
Makefile must be a GNU makefile which, when invoked via make (using
-the default target), creates a <testname>.deb file in the current
-directory. <testname> must match the directory name. This makefile
-may assume that the current working directory when it is invoked is
-the directory in which it's located (or a copy of it). It can take
-any action needed to generate the deb file, such as running dpkg-deb
-or ar.
+the default target), creates a .dsc file in the current directory and
+any other files needed to make up a source package. Any .dsc file
+found in the directory will be checked. <testname> must match the
+directory name. This makefile may assume that the current working
+directory when it is invoked is the directory in which it's located
+(or a copy of it). It can take any action needed to generate the deb
+file, such as running dpkg-source.
The Makefile does not have to clean up after itself. It can assume
that the directory is deleted and recreated between test runs.
-The packages are constructed using fakeroot, so the Makefile doesn't
-need to worry about file ownership when creating the files as long
-as all files included in the archive are newly created or chowned
-before creating the deb.
-
TEST NAMING CONVENTIONS
=======================
--
Debian package checker
Reply to: