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

[SCM] Debian package checker branch, master, updated. 2.2.8-14-g00b73dc



The following commit has been merged in the master branch:
commit 00b73dc3cfbbbcc0dee9cb9ed0cf91c3ed55e4b8
Author: Frank Lichtenheld <djpig@debian.org>
Date:   Sat Mar 28 22:19:07 2009 +0100

    checks/fields:  Add checks for well formatted Vcs-* fields
    
    Closes: #517635

diff --git a/checks/fields b/checks/fields
index ba66428..cf356bc 100644
--- a/checks/fields
+++ b/checks/fields
@@ -207,6 +207,26 @@ my @NAME_SECTION_MAPPINGS = (
     [ qr/^lib.*-dev$/  => 'libdevel' ],
 );
 
+# Valid URI formats for the Vcs-* fields
+# currently only checks the protocol, not the actual format of the URI
+my %VCS_RECOMMENDED_URIS = (
+    browser => qr;^https?://;,
+    arch    => qr;^https?://;,
+    bzr     => qr;^(lp:~|(?:nosmart\+)?https?://);,
+    cvs     => qr;^:pserver:;,
+    darcs   => qr;^https?://;,
+    hg      => qr;^https?://;,
+    git     => qr;^(?:git|https?|rsync)://;,
+    svn     => qr;^(?:svn|(?:svn\+)?https?)://;,
+    mtn     => qr;^[\w.-]+\s+\S+;, # that's a hostname followed by a module name
+);
+my %VCS_VALID_URIS = (
+    arch    => qr;^https?://;,
+    bzr     => qr;^(?:sftp|(?:bzr\+)?ssh)://;,
+    cvs     => qr;^(?:-d\s*)?:(?:ext|pserver):;,
+    git     => qr;^(?:git\+)?ssh://;,
+    svn     => qr;^(?:svn\+)?ssh://;,
+);
 
 our $PERL_CORE_PROVIDES = Lintian::Data->new('fields/perl-provides', '\s+');
 our $OBSOLETE_PACKAGES  = Lintian::Data->new('fields/obsolete-packages');
@@ -996,6 +1016,22 @@ if (defined $info->field('dm-upload-allowed')) {
 	}
 }
 
+#----- Vcs-*
+
+while (my ($vcs, $regex) = each %VCS_RECOMMENDED_URIS) {
+    if (defined $info->field("vcs-$vcs")) {
+	my $uri = $info->field("vcs-$vcs");
+	if ($uri !~ $regex) {
+	    if ($VCS_VALID_URIS{$vcs} and $uri =~ $VCS_VALID_URIS{$vcs}) {
+		tag "vcs-field-uses-not-recommended-uri-format", "vcs-$vcs", $uri;
+	    } else {
+		tag "vcs-field-uses-unknown-uri-format", "vcs-$vcs", $uri;
+	    }
+	}
+    }
+}
+
+
 #----- Field checks (without checking the value)
 
 for my $field (glob("fields/*")) {
diff --git a/checks/fields.desc b/checks/fields.desc
index 22c09f2..5a599cc 100644
--- a/checks/fields.desc
+++ b/checks/fields.desc
@@ -975,3 +975,18 @@ Info: This package is also provided by one of the Perl core packages
  .
  Example: perl-modules (&gt;= 5.10.0) | libmodule-build-perl (&gt;= 0.26)
 Ref: policy 7.5
+
+Tag: vcs-field-uses-not-recommended-uri-format
+Severity: minor
+Certainty: possible
+Info: The VCS-* field uses an URI which doesn't match the recommended
+ format, but still looks valid. Examples for not recommended URI formats
+ are protocols that require authentication (like SSH). Instead where
+ possible you should provide an URI that is accessible for everyone
+ without authentication.
+
+Tag: vcs-field-uses-unknown-uri-format
+Severity: normal
+Certainty: possible
+Info: The VCS-* field uses an URI which doesn't match any known format.
+ You might have forgotten the protocol before the hostname.
diff --git a/debian/changelog b/debian/changelog
index 61db270..6cf791f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ lintian (2.2.9) UNRELEASED; urgency=low
   * Summary of tag changes:
     + Added:
        - wrong-section-according-to-package-name
+       - vcs-field-uses-not-recommended-uri-format
+       - vcs-field-uses-unknown-uri-format
     + Removed:
        - dev-package-should-be-section-libdevel
        - doc-package-should-be-section-doc
@@ -20,6 +22,7 @@ lintian (2.2.9) UNRELEASED; urgency=low
     + [FL] Add package name checks for the new sections.  Move all package
       section checks to one tag "wrong-section-according-to-package-name"
       instead of one tag per section.
+    + [FL] Add checks for well formatted Vcs-* fields.  (Closes: #517635)
   * checks/lintian.desc:
     + [CW] Add karmic as an allowable distribution for Ubuntu (thanks, Soren
       Hansen).
diff --git a/t/tests/debhelper-dh-clean-k-deprecated/debian/debian/control.in b/t/tests/fields-malformed-vcs-fields/debian/debian/control.in
similarity index 81%
copy from t/tests/debhelper-dh-clean-k-deprecated/debian/debian/control.in
copy to t/tests/fields-malformed-vcs-fields/debian/debian/control.in
index 3ef3f17..186f60b 100644
--- a/t/tests/debhelper-dh-clean-k-deprecated/debian/debian/control.in
+++ b/t/tests/fields-malformed-vcs-fields/debian/debian/control.in
@@ -4,6 +4,8 @@ Section: {$section}
 Maintainer: {$author}
 Standards-Version: 3.8.1
 Build-Depends: debhelper (>= 7)
+Vcs-Browser: svn.debian.org/wsvn/foobar/trunk
+Vcs-Svn: svn+ssh://svn.debian.org/svn/foobar/trunk
 
 Package: {$srcpkg}
 Architecture: {$architecture}
diff --git a/t/tests/fields-malformed-vcs-fields/desc b/t/tests/fields-malformed-vcs-fields/desc
new file mode 100644
index 0000000..5157ddd
--- /dev/null
+++ b/t/tests/fields-malformed-vcs-fields/desc
@@ -0,0 +1,7 @@
+Testname: fields-malformed-vcs-fields
+Sequence: 6000
+Description: Test malformed VCS-* fields
+Version: 1.0
+Test-For:
+ vcs-field-uses-not-recommended-uri-format
+ vcs-field-uses-unknown-uri-format
diff --git a/t/tests/fields-malformed-vcs-fields/tags b/t/tests/fields-malformed-vcs-fields/tags
new file mode 100644
index 0000000..3fdeb6b
--- /dev/null
+++ b/t/tests/fields-malformed-vcs-fields/tags
@@ -0,0 +1,2 @@
+I: fields-malformed-vcs-fields source: vcs-field-uses-not-recommended-uri-format vcs-svn svn+ssh://svn.debian.org/svn/foobar/trunk
+W: fields-malformed-vcs-fields source: vcs-field-uses-unknown-uri-format vcs-browser svn.debian.org/wsvn/foobar/trunk
diff --git a/t/tests/files-fonts/debian/debian/control.in b/t/tests/fields-vcs-fields/debian/debian/control.in
similarity index 50%
copy from t/tests/files-fonts/debian/debian/control.in
copy to t/tests/fields-vcs-fields/debian/debian/control.in
index a85cd8d..e696327 100644
--- a/t/tests/files-fonts/debian/debian/control.in
+++ b/t/tests/fields-vcs-fields/debian/debian/control.in
@@ -4,24 +4,18 @@ Section: {$section}
 Maintainer: {$author}
 Standards-Version: 3.8.1
 Build-Depends: debhelper (>= 7)
-Homepage: http://lintian.debian.org/
+Vcs-Browser: https://svn.debian.org/wsvn/foobar/trunk
+Vcs-Svn: svn://svn.debian.org/svn/foobar/trunk
+Vcs-Mtn: www.example.org org.debian.foobar
+Vcs-Hg: http://hg.debian.org/hg/foobar/pkg/foobar
+Vcs-Git: git://git.debian.org/git/users/djpig/foobar.git
+Vcs-Cvs: :pserver:anonymous@cvs.alioth.debian.org:/cvsroot/foobar
+Vcs-Bzr: nosmart+http://bzr.debian.org/bzr/collab-maint/foobar
 
 Package: {$srcpkg}
 Architecture: {$architecture}
 Depends: $\{misc:Depends\}
 Description: {$description}
- Non-font package containing fonts.
- .
- This is a test package designed to exercise some feature or tag of
- Lintian.  It is part of the Lintian test suite and may do very odd
- things.  It should not be installed like a regular package.
-
-Package: ttf-{$srcpkg}
-Architecture: {$architecture}
-Depends: $\{misc:Depends\}
-Description: {$description} (okay)
- Font package containing fonts.
- .
  This is a test package designed to exercise some feature or tag of
  Lintian.  It is part of the Lintian test suite and may do very odd
  things.  It should not be installed like a regular package.
diff --git a/t/tests/fields-vcs-fields/desc b/t/tests/fields-vcs-fields/desc
new file mode 100644
index 0000000..18e3d63
--- /dev/null
+++ b/t/tests/fields-vcs-fields/desc
@@ -0,0 +1,7 @@
+Testname: fields-vcs-fields
+Sequence: 6000
+Description: Test well formed VCS-* fields
+Version: 1.0
+Test-Against:
+ vcs-field-uses-not-recommended-uri-format
+ vcs-field-uses-unknown-uri-format
diff --git a/t/debs/description-synopsis-spaces/tags b/t/tests/fields-vcs-fields/tags
similarity index 100%
copy from t/debs/description-synopsis-spaces/tags
copy to t/tests/fields-vcs-fields/tags

-- 
Debian package checker


Reply to: