Package: lintian Version: 2.5.47 Severity: wishlist Tags: patch Hi, Please find attached a patch which add the check of the canonical form of the homepage field for CRAN R packages.
Any comments/suggestions on this patch are welcome :-) Best, Dylan
From ca242bed450f305af621992f384a819717ade2cc Mon Sep 17 00:00:00 2001 From: Dylan Aïssi <[email protected]> Date: Fri, 30 Sep 2016 07:47:04 +0000 Subject: [PATCH] c/fields: Check for the canonical form of the homepage field of CRAN R packages --- checks/fields.desc | 16 ++++++++++++++++ checks/fields.pm | 4 ++++ t/tests/fields-cran-homepage/debian/debian/control.in | 16 ++++++++++++++++ t/tests/fields-cran-homepage/desc | 4 ++++ t/tests/fields-cran-homepage/tags | 2 ++ 5 files changed, 42 insertions(+) create mode 100644 t/tests/fields-cran-homepage/debian/debian/control.in create mode 100644 t/tests/fields-cran-homepage/desc create mode 100644 t/tests/fields-cran-homepage/tags diff --git a/checks/fields.desc b/checks/fields.desc index abcbd43..1830448 100644 --- a/checks/fields.desc +++ b/checks/fields.desc @@ -1291,3 +1291,19 @@ Info: This .dsc file contains no Checksum-Sha256 field and hence only Accordingly it can be fixed by simply rebuilding the source package with a more recent dpkg-source version, i.e. by uploading a new Debian release of the package. + +Tag: homepage-for-cran-package-not-canonical +Severity: wishlist +Certainty: certain +Info: The Homepage field for this package points to an uncanonical CRAN URL. + Please update to use the current canonical URL instead. The canonical URL is + recommended for use in publications, etc., will always redirect to current + release version (or devel if package is not in release yet). For example, the + link for the package "foo" should be: + . + https://cran.r-project.org/package=foo + . + not: + . + https://cran.r-project.org/web/packages/foo/index.html +Ref: At the bottom of the page of each CRAN package. diff --git a/checks/fields.pm b/checks/fields.pm index 328f0f9..4cc2b65 100644 --- a/checks/fields.pm +++ b/checks/fields.pm @@ -616,6 +616,10 @@ sub run { { tag 'homepage-for-cpan-package-contains-version', $orig; } + if ($homepage=~ m,/cran\.r-project\.org/web/packages/.+,) + { + tag 'homepage-for-cran-package-not-canonical', $orig; + } } elsif (not $info->native) { if ($type eq 'source') { my $binary_has_homepage_field = 0; diff --git a/t/tests/fields-cran-homepage/debian/debian/control.in b/t/tests/fields-cran-homepage/debian/debian/control.in new file mode 100644 index 0000000..0799038 --- /dev/null +++ b/t/tests/fields-cran-homepage/debian/debian/control.in @@ -0,0 +1,16 @@ +Source: {$source} +Priority: extra +Section: {$section} +Maintainer: {$author} +Standards-Version: {$standards_version} +Build-Depends: {$build_depends} +Homepage: https://cran.r-project.org/web/packages/foo/index.html + +Package: {$source} +Architecture: {$architecture} +Depends: $\{shlibs:Depends\}, $\{misc:Depends\} +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. It may + be an empty package. \ No newline at end of file diff --git a/t/tests/fields-cran-homepage/desc b/t/tests/fields-cran-homepage/desc new file mode 100644 index 0000000..6d4c434 --- /dev/null +++ b/t/tests/fields-cran-homepage/desc @@ -0,0 +1,4 @@ +Testname: fields-cran-homepage +Version: 1.0 +Description: CRAN Homepage URLs should be canonical +Test-For: homepage-for-cran-package-not-canonical \ No newline at end of file diff --git a/t/tests/fields-cran-homepage/tags b/t/tests/fields-cran-homepage/tags new file mode 100644 index 0000000..ee519af --- /dev/null +++ b/t/tests/fields-cran-homepage/tags @@ -0,0 +1,2 @@ +I: fields-cran-homepage source: homepage-for-cran-package-not-canonical https://cran.r-project.org/web/packages/foo/index.html +I: fields-cran-homepage: homepage-for-cran-package-not-canonical https://cran.r-project.org/web/packages/foo/index.html -- 2.1.4

