[lintian] 01/01: Warn about packages that are missing a Vcs-Browser header when we know that they have at least one Vcs-* header that has has a browser-based interface. (Closes: #891688)
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository lintian.
commit 5987bf72b658df48004d3cfaefc4774ee670abd4
Author: Chris Lamb <lamby@debian.org>
Date: Thu Mar 1 09:13:19 2018 +0000
Warn about packages that are missing a Vcs-Browser header when we know that they have at least one Vcs-* header that has has a browser-based interface. (Closes: #891688)
---
checks/fields.desc | 11 ++++++++
checks/fields.pm | 13 +++++++++
data/fields/vcs-browsers | 31 ++++++++++++++++++++++
debian/changelog | 6 +++++
.../debian/debian/control.in | 18 +++++++++++++
t/tests/fields-missing-vcs-browser/desc | 5 ++++
t/tests/fields-missing-vcs-browser/tags | 1 +
7 files changed, 85 insertions(+)
diff --git a/checks/fields.desc b/checks/fields.desc
index a455caa..60181ab 100644
--- a/checks/fields.desc
+++ b/checks/fields.desc
@@ -1435,3 +1435,14 @@ Info: The specified package appears to be a documentation package
.
Please remove the superfluous trailing "s" from the package name.
Ref: policy 12.3
+
+Tag: missing-vcs-browser-field
+Severity: wishlist
+Certainty: certain
+Info: A Vcs-* field in this package is pointing to a repository that
+ supports browsing of the repository via a web browser.
+ .
+ This is typically a nicer user-experience for developers and avoids
+ unnecessary and time-consuming clones of the repository.
+ .
+ Please add a suitable Vcs-Browser field to the package.
diff --git a/checks/fields.pm b/checks/fields.pm
index 2ef0d47..7d71082 100644
--- a/checks/fields.pm
+++ b/checks/fields.pm
@@ -52,6 +52,8 @@ our $known_build_essential
our $KNOWN_BINARY_FIELDS = Lintian::Data->new('fields/binary-fields');
our $KNOWN_UDEB_FIELDS = Lintian::Data->new('fields/udeb-fields');
our $KNOWN_BUILD_PROFILES = Lintian::Data->new('fields/build-profiles');
+our $KNOWN_VCS_BROWSERS
+ = Lintian::Data->new('fields/vcs-browsers', qr/\s*~~\s*/, sub { $_[1]; });
our %KNOWN_ARCHIVE_PARTS = map { $_ => 1 } ('non-free', 'contrib');
@@ -1392,6 +1394,17 @@ sub run {
and $is_comaintained
and not %seen_vcs;
+ # Check for missing Vcs-Browser headers
+ if (!defined $info->field('vcs-browser')) {
+ foreach my $regex ($KNOWN_VCS_BROWSERS->all) {
+ my $vcs = $KNOWN_VCS_BROWSERS->value($regex);
+ if ($info->field("vcs-$vcs", '') =~ m/^$regex/xi) {
+ tag 'missing-vcs-browser-field', "vcs-$vcs";
+ last; # Only warn once
+ }
+ }
+ }
+
#---- Checksums
tag 'no-strong-digests-in-dsc'
diff --git a/data/fields/vcs-browsers b/data/fields/vcs-browsers
new file mode 100644
index 0000000..bb3e0fb
--- /dev/null
+++ b/data/fields/vcs-browsers
@@ -0,0 +1,31 @@
+# List of Vcs-* fields that should have a Vcs-Browser equivalent
+#
+# Format:
+# ^regex \x\s) ~~ vcs
+
+git://anonscm.debian.org/ ~~ git
+https?://anonscm.debian.org/git/ ~~ git
+https?://anonscm.debian.org/cgit/ ~~ git
+git://git.debian.org/ ~~ git
+https?://git.debian.org/ ~~ git
+git://alioth.debian.org/ ~~ git
+https?://alioth.debian.org/anonscm/git/ ~~ git
+git://anongit.debian.org/ ~~ git
+https?://git.dgit.debian.org/ ~~ git
+git://anongit.freedesktop.org/ ~~ git
+git://anongit.kde.org/ ~~ git
+git://git.code.sf.net/ ~~ git
+https?://git.code.sf.net/p/ ~~ git
+git://*.git.sourceforge.net/ ~~ git
+git://git@github.com: ~~ git
+git://github.com/ ~~ git
+https?://github.com/ ~~ git
+git@gitlab.com: ~~ git
+https?://gitlab.*/ ~~ git
+https?://salsa.debian.org/ ~~ git
+git://git.kernel.org/ ~~ git
+git://gitorious.org/ ~~ git
+git://*.branchable.com/ ~~ git
+git://repo.or.cz/ ~~ git
+https?://repo.or.cz/ ~~ git
+https?://bitbucket.org/ ~~ git
diff --git a/debian/changelog b/debian/changelog
index 5536766..2a139d0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,12 @@ lintian (2.5.78) UNRELEASED; urgency=medium
XXX: generate tag summary
+ * checks/fields.{desc,pm}:
+ + [CL] Warn about packages that are missing a Vcs-Browser header when
+ we know that they have at least one Vcs-* header that has has a
+ browser-based interface. Thanks to Paul Wise for the report.
+ (Closes: #891688)
+
-- Chris Lamb <lamby@debian.org> Tue, 27 Feb 2018 14:04:15 +0000
lintian (2.5.77) unstable; urgency=medium
diff --git a/t/tests/fields-missing-vcs-browser/debian/debian/control.in b/t/tests/fields-missing-vcs-browser/debian/debian/control.in
new file mode 100644
index 0000000..23fc0c1
--- /dev/null
+++ b/t/tests/fields-missing-vcs-browser/debian/debian/control.in
@@ -0,0 +1,18 @@
+Source: {$source}
+Priority: optional
+Section: {$section}
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: {$build_depends}
+Rules-Requires-Root: no
+Homepage: https://lintian.debian.org/
+Vcs-Git: https://salsa.debian.org/project/repo.git
+
+Package: {$source}
+Architecture: {$architecture}
+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.
diff --git a/t/tests/fields-missing-vcs-browser/desc b/t/tests/fields-missing-vcs-browser/desc
new file mode 100644
index 0000000..0cd59c8
--- /dev/null
+++ b/t/tests/fields-missing-vcs-browser/desc
@@ -0,0 +1,5 @@
+Testname: fields-missing-vcs-browser
+Version: 1.0
+Description: Check for packages missing Vcs-Browser
+Test-For:
+ missing-vcs-browser-field
diff --git a/t/tests/fields-missing-vcs-browser/tags b/t/tests/fields-missing-vcs-browser/tags
new file mode 100644
index 0000000..1901a32
--- /dev/null
+++ b/t/tests/fields-missing-vcs-browser/tags
@@ -0,0 +1 @@
+I: fields-missing-vcs-browser source: missing-vcs-browser-field vcs-git
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: