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

Bug#776267: lintian: Add check for unsupported PyPI URL in debian/watch



Attached is an updated patch which improves the comments and URLs for testing.

-- 
 \          “It's dangerous to be right when the government is wrong.” |
  `\                                   —Francois Marie Arouet Voltaire |
_o__)                                                                  |
Ben Finney <ben@benfinney.id.au>
--- a/checks/watch-file.desc
+++ b/checks/watch-file.desc
@@ -174,3 +174,15 @@ Certainty: certain
 Info: The watch file contains a standard template included by dh_make.
  Please remove them once you have implemented the watch file.
 
+Tag: debian-watch-file-unsupported-pypi-url
+Severity: important
+Certainty: certain
+Ref: https://wiki.python.org/moin/PyPISimple
+Info: The watch file specifies a PyPI URL which is not a supported API.
+ Instead, use PyPI's Simple API:
+ .
+   https://pypi.python.org/simple/&lt;distribution-name&gt;/
+ .
+ replacing <tt>&lt;distribution-name&gt;</tt> with the canonical name of the
+ Python project.
+
diff --git a/checks/watch-file.pm b/checks/watch-file.pm
index cd0f8de..35522b8 100644
--- a/checks/watch-file.pm
+++ b/checks/watch-file.pm
@@ -132,6 +132,10 @@ sub run {
                 tag 'debian-watch-file-should-use-sf-redirector', "line $.";
             }
 
+            if (m%https?://pypi\.python\.org/packages/source/%) {
+                tag 'debian-watch-file-unsupported-pypi-url', "line $.";
+            }
+
             # This bit is as-is from uscan.pl:
             my ($base, $filepattern, $lastversion, $action) = split ' ', $_, 4;
             # Per #765995, $base might be undefined.
diff --git a/t/tests/watch-file-general/debian/debian/watch b/t/tests/watch-file-general/debian/debian/watch
index 260fa39..aa45280 100644
--- a/t/tests/watch-file-general/debian/debian/watch
+++ b/t/tests/watch-file-general/debian/debian/watch
@@ -20,5 +20,7 @@ version=42
 # Specifies the same version number as the package.
 http://example.com/ foo([\d.]+)\.tar\.gz 2.0.ds1-1 uupdate
 
+# Unsupported PyPI URL.
+https://pypi.python.org/packages/source/p/pip/ pip-(\S+)\.tar\.gz
 
-# without any pgpsigurlmangle
\ No newline at end of file
+# without any pgpsigurlmangle

--- a/t/tests/watch-file-general/desc
+++ b/t/tests/watch-file-general/desc
@@ -13,5 +13,6 @@ Test-For:
  debian-watch-file-should-use-sf-redirector
  debian-watch-file-specifies-wrong-upstream-version
  debian-watch-file-unknown-version
+ debian-watch-file-unsupported-pypi-url
  debian-watch-file-uses-deprecated-sf-redirector-method
 References: Debian Bug#510398

--- a/t/tests/watch-file-general/tags
+++ b/t/tests/watch-file-general/tags
@@ -1,3 +1,4 @@
+E: watch-file-general source: debian-watch-file-unsupported-pypi-url line 24
 I: watch-file-general source: debian-watch-file-should-dversionmangle-not-uversionmangle line 5
 P: watch-file-general source: debian-watch-may-check-gpg-signature
 W: watch-file-general source: debian-watch-file-declares-multiple-versions line 18
@@ -5,6 +6,7 @@ W: watch-file-general source: debian-watch-file-declares-multiple-versions line
 W: watch-file-general source: debian-watch-file-should-mangle-version line 12
 W: watch-file-general source: debian-watch-file-should-mangle-version line 14
 W: watch-file-general source: debian-watch-file-should-mangle-version line 15
+W: watch-file-general source: debian-watch-file-should-mangle-version line 24
 W: watch-file-general source: debian-watch-file-should-use-sf-redirector line 12
 W: watch-file-general source: debian-watch-file-should-use-sf-redirector line 14
 W: watch-file-general source: debian-watch-file-should-use-sf-redirector line 15

Attachment: signature.asc
Description: Digital signature


Reply to: