Package: lintian
Version: 2.5.48
Severity: wishlist
Tags: patch

Hi,
Please find attached a patch which add the check of the canonical form
of the homepage field for Bioconductor R packages. It is similar to
the check for the CRAN packages already implemented in lintian.

Best,
Dylan
From f0d86d0cc54b1edde0b1ef643cc182969c7d6c46 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dylan=20A=C3=AFssi?= <bob.dyb...@gmail.com>
Date: Wed, 5 Oct 2016 22:55:29 +0200
Subject: [PATCH] c/fields: Tag non-canonical forms of Bioconductor homepage

---
 checks/fields.desc                                       | 15 +++++++++++++++
 checks/fields.pm                                         |  4 ++++
 .../debian/debian/control.in                             | 16 ++++++++++++++++
 t/tests/fields-bioconductor-homepage/desc                |  4 ++++
 t/tests/fields-bioconductor-homepage/tags                |  2 ++
 5 files changed, 41 insertions(+)
 create mode 100644 t/tests/fields-bioconductor-homepage/debian/debian/control.in
 create mode 100644 t/tests/fields-bioconductor-homepage/desc
 create mode 100644 t/tests/fields-bioconductor-homepage/tags

diff --git a/checks/fields.desc b/checks/fields.desc
index a8143f6..7df3dee 100644
--- a/checks/fields.desc
+++ b/checks/fields.desc
@@ -1318,3 +1318,18 @@ Info: The Homepage field for this package points to an uncanonical CRAN URL.
  not:
  .
   https://cran.r-project.org/web/packages/foo/index.html
+
+Tag: homepage-for-bioconductor-package-not-canonical
+Severity: wishlist
+Certainty: certain
+Info: The Homepage field for this package points to an uncanonical Bioconductor 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://bioconductor.org/packages/foo/
+ .
+ not:
+ .
+ https://www.bioconductor.org/packages/(release|devel|*)/bioc/html/foo.html
diff --git a/checks/fields.pm b/checks/fields.pm
index 66b8d77..4d7343c 100644
--- a/checks/fields.pm
+++ b/checks/fields.pm
@@ -619,6 +619,10 @@ sub run {
         if ($homepage=~ m,/cran\.r-project\.org/web/packages/.+,){
             tag 'homepage-for-cran-package-not-canonical', $orig;
         }
+        if ($homepage=~ m,bioconductor\.org/packages/.*/bioc/html/.*\.html*$,)
+        {
+            tag 'homepage-for-bioconductor-package-not-canonical', $orig;
+        }
     } elsif (not $info->native) {
         if ($type eq 'source') {
             my $binary_has_homepage_field = 0;
diff --git a/t/tests/fields-bioconductor-homepage/debian/debian/control.in b/t/tests/fields-bioconductor-homepage/debian/debian/control.in
new file mode 100644
index 0000000..385c886
--- /dev/null
+++ b/t/tests/fields-bioconductor-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://www.bioconductor.org/packages/release/bioc/html/foo.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-bioconductor-homepage/desc b/t/tests/fields-bioconductor-homepage/desc
new file mode 100644
index 0000000..aeea583
--- /dev/null
+++ b/t/tests/fields-bioconductor-homepage/desc
@@ -0,0 +1,4 @@
+Testname: fields-bioconductor-homepage
+Version: 1.0
+Description: Bioconductor Homepage URLs should be canonical
+Test-For: homepage-for-bioconductor-package-not-canonical
\ No newline at end of file
diff --git a/t/tests/fields-bioconductor-homepage/tags b/t/tests/fields-bioconductor-homepage/tags
new file mode 100644
index 0000000..b539a90
--- /dev/null
+++ b/t/tests/fields-bioconductor-homepage/tags
@@ -0,0 +1,2 @@
+I: fields-bioconductor-homepage source: homepage-for-bioconductor-package-not-canonical https://www.bioconductor.org/packages/release/bioc/html/foo.html
+I: fields-bioconductor-homepage: homepage-for-bioconductor-package-not-canonical https://www.bioconductor.org/packages/release/bioc/html/foo.html
-- 
2.1.4

Reply via email to