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

[SCM] Debian package checker branch, master, updated. 2.5.3-62-g69f93b0



The following commit has been merged in the master branch:
commit 9b758ec5a75185802e5572b34f07cd8107079efb
Author: Niels Thykier <niels@thykier.net>
Date:   Wed Oct 12 14:57:41 2011 +0200

    Fixed source-field-does-not-match-pkg-name
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/fields b/checks/fields
index 7af8df6..a1176ee 100644
--- a/checks/fields
+++ b/checks/fields
@@ -163,6 +163,7 @@ sub run {
 my $pkg = shift;
 my $type = shift;
 my $info = shift;
+my $proc = shift;
 my $version;
 my $arch_indep;
 
@@ -380,8 +381,12 @@ if (not defined $info->field('source')) {
     unfold('source', \$source);
 
     if ($type eq 'source') {
-        if ($source ne $pkg) {
-            tag 'source-field-does-not-match-pkg-name', "$source != $pkg";
+        my $filename = $proc->pkg_path;
+        my ($base) = ($filename =~ m,(?:\a|/)([^/]+)$,o);
+        my ($n) = ($base =~ m/^([^_]+)_/o);
+
+        if ($source ne $n) {
+            tag 'source-field-does-not-match-pkg-name', "$source != $n";
         }
         if ($source !~ /^[a-z0-9][-+\.a-z0-9]+\z/) {
             tag 'source-field-malformed', $source;
diff --git a/debian/changelog b/debian/changelog
index 0047106..1e6183a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -28,6 +28,8 @@ lintian (2.5.4) UNRELEASED; urgency=low
       build-dependency-for-dh_-command to improve readability.  This
       breaks overrides, but according to lintian.d.o there are none
       of these.  (Closes: #644339)
+  * checks/fields:
+    + [NT] Fixed source-field-does-not-match-pkg-name.
   * checks/files{,.desc}:
     + [JW] Suggest the usage of "-delete" rather than "| xargs rm -f".
       (Closes: #641983)
diff --git a/t/COVERAGE b/t/COVERAGE
index 0d473c4..794df15 100644
--- a/t/COVERAGE
+++ b/t/COVERAGE
@@ -1,5 +1,5 @@
 Last generated 2011-10-12
-Coverage: 733/938 (78.14%), w. legacy tests: 851/938 (90.72%)
+Coverage: 734/938 (78.25%), w. legacy tests: 852/938 (90.83%)
 
 The following tags are not tested by the test suite:
 
@@ -37,7 +37,6 @@ fields no-source-field
 fields no-version-field
 fields package-not-lowercase
 fields package-superseded-by-perl
-fields source-field-does-not-match-pkg-name
 
 files FSSTND-dir-in-var
 files compressed-symlink-with-wrong-ext
diff --git a/t/source/fields-src-fields-filename/Makefile b/t/source/fields-src-fields-filename/Makefile
new file mode 100644
index 0000000..c38b4a2
--- /dev/null
+++ b/t/source/fields-src-fields-filename/Makefile
@@ -0,0 +1,26 @@
+name = fields-src-fields-filename
+dsc  = some-other-name
+dir  = $(dsc)-1
+
+all:
+	mkdir $(dir)
+	mkdir $(dir)/debian
+	mkdir $(dir)/debian/source
+	echo "1.0" > $(dir)/debian/source/format
+	echo 7 > $(dir)/debian/compat
+	cp changelog copyright control rules $(dir)/debian/
+	tar cfz $(dsc)_1.tar.gz $(dir)
+	cp dsc.in $(dsc)_1.dsc
+	perl -I$(LINTIAN_ROOT)/lib -MUtil -i -pe \
+	    'BEGIN { $$h = get_file_checksum("sha1", "$(dsc)_1.tar.gz") } s/\@SHA1\@/$$h/g' $(dsc)_1.dsc
+	perl -I$(LINTIAN_ROOT)/lib -MUtil -i -pe \
+	    'BEGIN { $$h = get_file_checksum("sha256", "$(dsc)_1.tar.gz") } s/\@SHA256\@/$$h/g' $(dsc)_1.dsc
+	perl -I$(LINTIAN_ROOT)/lib -MUtil -i -pe \
+	    'BEGIN { $$h = get_file_checksum("md5", "$(dsc)_1.tar.gz") } s/\@MD5\@/$$h/g' $(dsc)_1.dsc
+	perl -i -pe 'BEGIN { $$s = (stat "$(dsc)_1.tar.gz")[7] } s/\@SIZE\@/$$s/g' $(dsc)_1.dsc
+	mv $(dsc)_1.dsc $(name)_1.dsc
+
+clean:
+	rm -rf $(dir)
+	rm -f $(name)_1*
+	rm -fr $(tar)_1*
diff --git a/t/templates/source/skel/control.in b/t/source/fields-src-fields-filename/control.in
similarity index 95%
copy from t/templates/source/skel/control.in
copy to t/source/fields-src-fields-filename/control.in
index 96cea01..3734033 100644
--- a/t/templates/source/skel/control.in
+++ b/t/source/fields-src-fields-filename/control.in
@@ -1,4 +1,4 @@
-Source: {$srcpkg}
+Source: some-other-name
 Priority: extra
 Section: {$section}
 Maintainer: {$author}
diff --git a/t/source/fields-src-fields-filename/desc b/t/source/fields-src-fields-filename/desc
new file mode 100644
index 0000000..e1c57a9
--- /dev/null
+++ b/t/source/fields-src-fields-filename/desc
@@ -0,0 +1,5 @@
+Testname: fields-src-fields-filename
+Sequence: 6000
+Version: 1
+Description: Test package for src field filename mismatch
+Test-For: source-field-does-not-match-pkg-name
diff --git a/t/source/debian-symlink/dsc.in b/t/source/fields-src-fields-filename/dsc.in
similarity index 53%
copy from t/source/debian-symlink/dsc.in
copy to t/source/fields-src-fields-filename/dsc.in
index 667116c..88e8f97 100644
--- a/t/source/debian-symlink/dsc.in
+++ b/t/source/fields-src-fields-filename/dsc.in
@@ -1,14 +1,14 @@
 Format: 1.0
-Source: debian-symlink
-Binary: debian-symlink
+Source: some-other-name
+Binary: fields-src-fields-filename
 Architecture: all
 Version: 1
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Standards-Version: 3.9.2
 Build-Depends: debhelper (>= 7)
 Checksums-Sha1:
- @SHA1@ @SIZE@ debian-symlink_1.tar.gz
+ @SHA1@ @SIZE@ some-other-name_1.tar.gz
 Checksums-Sha256:
- @SHA256@ @SIZE@ debian-symlink_1.tar.gz
+ @SHA256@ @SIZE@ some-other-name_1.tar.gz
 Files:
- @MD5@ @SIZE@ debian-symlink_1.tar.gz
+ @MD5@ @SIZE@ some-other-name_1.tar.gz
diff --git a/t/source/fields-src-fields-filename/tags b/t/source/fields-src-fields-filename/tags
new file mode 100644
index 0000000..797abc2
--- /dev/null
+++ b/t/source/fields-src-fields-filename/tags
@@ -0,0 +1 @@
+E: some-other-name source: source-field-does-not-match-pkg-name some-other-name != fields-src-fields-filename

-- 
Debian package checker


Reply to: