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

[SCM] Debian package checker branch, master, updated. 2.2.2-12-gfdb0423



The following commit has been merged in the master branch:
commit fdb0423d4dcb70589ebc65b72076ff9a829becd0
Author: Russ Allbery <rra@debian.org>
Date:   Fri Feb 6 22:03:50 2009 -0800

    Add additional checks for homepage handling
    
    * checks/description{,.desc}:
      + [RA] Add pedantic check for apparent home page URLs in the long
        description with no Homepage field.  Based on a patch by Paul Wise.
        (Closes: #339829)
    * checks/fields{,.desc}:
      + [RA] Warn about Homepage fields pointing to search.cpan.org pages
        containing a version number.  Based on a patch by Paul Wise.

diff --git a/checks/description b/checks/description
index dfc2c11..f86859b 100644
--- a/checks/description
+++ b/checks/description
@@ -79,6 +79,7 @@ if ($synopsis =~ m/^\s*$/) {
     }
 }
 
+my $flagged_homepage;
 foreach (split /\n/, $description) {
     next if m/^\s*$/o;
     next if m/^\.\s*$/o;
@@ -112,7 +113,8 @@ foreach (split /\n/, $description) {
     }
 
     if (m,^\s*Homepage: https?://,i) {
-        tag "description-contains-homepage";
+	tag "description-contains-homepage";
+	$flagged_homepage = 1;
     }
 
     if (m,This description was automagically extracted from the module by dh-make-perl,i) {
@@ -161,6 +163,19 @@ if ($type ne 'udeb') {
     }
 }
 
+# Check for a package homepage in the description and no Homepage field.  This
+# is less accurate and more of a guess than looking for the old Homepage:
+# convention in the body.
+unless ($info->field('homepage')) {
+    if ($description =~ /homepage|webpage|website|url|upstream|web\s+site
+                         |home\s+page|further\s+information|more\s+info
+                         |official\s+site|project\s+home/xi
+	and $description =~ m,\b(https?://[a-z0-9][^>\s]+),i
+	and not $flagged_homepage) {
+	tag 'description-possibly-contains-homepage', $1;
+    }
+}
+
 if ($description) {
     spelling_check('spelling-error-in-description', $description);
     spelling_check_picky('spelling-error-in-description', $description);
diff --git a/checks/description.desc b/checks/description.desc
index 8c65521..dc34d46 100644
--- a/checks/description.desc
+++ b/checks/description.desc
@@ -167,3 +167,11 @@ Info: You should avoid the use of first person ("I will do this..." or
  For example, rather than saying "I don't recommend this package if you
  are short on memory," say something like "this package is not suitable
  for low-memory systems."
+
+Tag: description-possibly-contains-homepage
+Severity: pedantic
+Certainty: possible
+Info: This package has no Homepage field but has a URL in the description
+ and wording that might indicate this is the package Homepage.  If it is,
+ add a Homepage control field containing it rather than mentioning it in
+ the package description.
diff --git a/checks/fields b/checks/fields
index b130f93..f647c85 100644
--- a/checks/fields
+++ b/checks/fields
@@ -398,6 +398,10 @@ if (defined $info->field('homepage')) {
 	unless ($uri->scheme) { # not an absolute URI
 		tag "bad-homepage", $homepage;
 	}
+
+	if ($homepage =~ m,/search\.cpan\.org/.*-[0-9._]+/*$,) {
+		tag 'homepage-for-cpan-package-contains-version', $homepage;
+	}
 } elsif ($type eq "binary" and not $info->native) {
 	tag "no-homepage-field";
 }
diff --git a/checks/fields.desc b/checks/fields.desc
index 64913f5..084dacd 100644
--- a/checks/fields.desc
+++ b/checks/fields.desc
@@ -333,6 +333,29 @@ Info: The "Homepage:" field in this package's control file does not
  contain a valid absolute URL. Most probably you forgot to specify
  the scheme (e.g. http).
 
+Tag: no-homepage-field
+Severity: pedantic
+Certainty: possible
+Info: This non-native package lacks a <tt>Homepage</tt> field.  If the
+ package has an upstream home page that contains useful information or
+ resources for the end user, consider adding a <tt>Homepage</tt> control
+ field to <tt>debian/control</tt>.
+Ref: policy 5.6.23
+
+Tag: homepage-for-cpan-package-contains-version
+Severity: minor
+Certainty: certain
+Info: The Homepage field for this package points to CPAN and the URL
+ includes the version.  It's better to link to the unversioned CPAN page
+ so that the URL doesn't have to be updated for each new release.  For
+ example, use:
+ .
+   http://search.cpan.org/~samtregar/HTML-Template/
+ .
+ not:
+ .
+   http://search.cpan.org/~samtregar/HTML-Template-2.9/
+
 Tag: obsolete-field
 Severity: important
 Certainty: certain
@@ -931,12 +954,3 @@ 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: no-homepage-field
-Severity: pedantic
-Certainty: possible
-Info: This non-native package lacks a <tt>Homepage</tt> field.  If the
- package has an upstream home page that contains useful information or
- resources for the end user, consider adding a <tt>Homepage</tt> control
- field to <tt>debian/control</tt>.
-Ref: policy 5.6.23
diff --git a/debian/changelog b/debian/changelog
index 39c85ce..60cf21b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ lintian (2.2.3) UNRELEASED; urgency=low
 
   * Summary of tag changes:
     + Added
+      - description-possibly-contains-homepage (pedantic)
+      - homepage-for-cpan-package-contains-version
       - using-first-person-in-description
     + Removed
       - non-us-spelling
@@ -23,9 +25,14 @@ lintian (2.2.3) UNRELEASED; urgency=low
     + [RA] Check for using first person in package descriptions, similar
       to the existing check for debconf questions.  Patch from Raphael
       Geissert.  (Closes: #513053)
+    + [RA] Add pedantic check for apparent home page URLs in the long
+      description with no Homepage field.  Based on a patch by Paul Wise.
+      (Closes: #339829)
   * checks/fields{,.desc}:
     + [ADB] Remove checks for the capitalisation of the obsolete non-US
       archive section.
+    + [RA] Warn about Homepage fields pointing to search.cpan.org pages
+      containing a version number.  Based on a patch by Paul Wise.
   * checks/files:
     + [ADB] Don't report duplicate-font-file for udebs.  Patch by Raphael
       Geissert.  (Closes: #514095)
diff --git a/t/tests/debhelper-dh-clean-k-deprecated/debian/debian/control.in b/t/tests/description-homepage/debian/debian/control.in
similarity index 87%
copy from t/tests/debhelper-dh-clean-k-deprecated/debian/debian/control.in
copy to t/tests/description-homepage/debian/debian/control.in
index ff1a285..ecb7520 100644
--- a/t/tests/debhelper-dh-clean-k-deprecated/debian/debian/control.in
+++ b/t/tests/description-homepage/debian/debian/control.in
@@ -12,3 +12,5 @@ Description: {$description}
  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.
+ .
+ See the package web site at <http://lintian.debian.org/>.
diff --git a/t/tests/description-homepage/desc b/t/tests/description-homepage/desc
new file mode 100644
index 0000000..65d4f39
--- /dev/null
+++ b/t/tests/description-homepage/desc
@@ -0,0 +1,6 @@
+Testname: description-homepage
+Sequence: 6000
+Version: 1.0
+Skeleton: pedantic
+Options: --pedantic -I -E
+Description: Test for a homepage reference in the description
diff --git a/t/tests/description-homepage/tags b/t/tests/description-homepage/tags
new file mode 100644
index 0000000..77dfd68
--- /dev/null
+++ b/t/tests/description-homepage/tags
@@ -0,0 +1 @@
+P: description-homepage: description-possibly-contains-homepage http://lintian.debian.org/
diff --git a/t/tests/control-file-suggests-itself/debian/debian/control.in b/t/tests/fields-cpan-homepage/debian/debian/control.in
similarity index 90%
copy from t/tests/control-file-suggests-itself/debian/debian/control.in
copy to t/tests/fields-cpan-homepage/debian/debian/control.in
index 6247cd4..9aff1e1 100644
--- a/t/tests/control-file-suggests-itself/debian/debian/control.in
+++ b/t/tests/fields-cpan-homepage/debian/debian/control.in
@@ -4,11 +4,11 @@ Section: {$section}
 Maintainer: {$author}
 Standards-Version: 3.8.0
 Build-Depends: debhelper (>= 7)
+Homepage: http://search.cpan.org/Foo-Bar-9.0_01/
 
 Package: {$srcpkg}
 Architecture: {$architecture}
 Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
-Suggests: {$srcpkg}
 Description: {$description}
  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
diff --git a/t/tests/fields-cpan-homepage/desc b/t/tests/fields-cpan-homepage/desc
new file mode 100644
index 0000000..6aa44c6
--- /dev/null
+++ b/t/tests/fields-cpan-homepage/desc
@@ -0,0 +1,5 @@
+Testname: fields-cpan-homepage
+Sequence: 6000
+Version: 1.0
+Description: CPAN Homepage URLs shouldn't have versions
+Check-For: homepage-for-cpan-package-contains-version
diff --git a/t/tests/fields-cpan-homepage/tags b/t/tests/fields-cpan-homepage/tags
new file mode 100644
index 0000000..d364a8d
--- /dev/null
+++ b/t/tests/fields-cpan-homepage/tags
@@ -0,0 +1,2 @@
+W: fields-cpan-homepage source: homepage-for-cpan-package-contains-version http://search.cpan.org/Foo-Bar-9.0_01/
+W: fields-cpan-homepage: homepage-for-cpan-package-contains-version http://search.cpan.org/Foo-Bar-9.0_01/

-- 
Debian package checker


Reply to: