[lintian] 04/05: Add support for derivative-specific field parsing to allow enforcement of additional restrictions (eg. updating Vcs-Git, etc.)
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository lintian.
commit fb04da2937a68ae795d6d9c5f9bd520ce5b0f364
Author: Chris Lamb <lamby@debian.org>
Date: Mon Apr 9 19:34:23 2018 +0100
Add support for derivative-specific field parsing to allow enforcement of additional restrictions (eg. updating Vcs-Git, etc.)
---
checks/fields.desc | 18 ++++++++++++++++++
checks/fields.pm | 22 ++++++++++++++++++++++
data/fields/derivative-fields | 5 +++++
debian/changelog | 3 +++
vendors/pureos/main/data/fields/derivative-fields | 8 ++++++++
5 files changed, 56 insertions(+)
diff --git a/checks/fields.desc b/checks/fields.desc
index 18f528f..b78568f 100644
--- a/checks/fields.desc
+++ b/checks/fields.desc
@@ -1497,3 +1497,21 @@ Info: This package has a relationship with a mail-transport-agent but
Please change the dependency to:
.
default-mta | pkgname | mail-transport-agent
+
+Tag: invalid-field-for-derivative
+Severity: serious
+Certainty: certain
+Info: The specified field in <tt>debian/control</tt> does not match the
+ required format for this Debian derivative.
+ .
+ Derivative distributions of Debian may enforce additional restrictions
+ on such fields for many reasons including ensuring that:
+ .
+ - Debian maintainers are not contacted for forked or packages that
+ are otherwise modified by the derivative.
+ - The original maintainer is still credited for their work (eg. in a
+ <tt>XSBC-Original-Maintainer</tt> fied.
+ - References to revision control systems (eg. <tt>Vcs-Git</tt>) are
+ pointing to the correct, updated location.
+ - Fields that become misleading in the context of a derivative are
+ removed.
diff --git a/checks/fields.pm b/checks/fields.pm
index 50d41eb..4b36ad7 100644
--- a/checks/fields.pm
+++ b/checks/fields.pm
@@ -57,6 +57,16 @@ our $KNOWN_VCS_BROWSERS
our %KNOWN_ARCHIVE_PARTS = map { $_ => 1 } ('non-free', 'contrib');
+my $DERIVATIVE_FIELDS = Lintian::Data->new(
+ 'fields/derivative-fields',
+ qr/\s*\~\~\s*/,
+ sub {
+ my ($regexp, $explanation) = split(/\s*\~\~\s*/, $_[1], 2);
+ return {
+ 'regexp' => qr/$regexp/,
+ 'explanation' => $explanation,
+ };
+ });
my $KNOWN_PRIOS = Lintian::Data->new('fields/priorities');
our @supported_source_formats = (qr/1\.0/, qr/3\.0\s*\((quilt|native)\)/);
@@ -1419,6 +1429,18 @@ sub run {
tag 'no-strong-digests-in-dsc'
if $type eq 'source' && !$info->field('checksums-sha256');
+ #----- Derivative-specific field checks
+
+ if ($type eq 'source') {
+ foreach my $field ($DERIVATIVE_FIELDS->all) {
+ my $val = $info->field($field, '-');
+ my $data = $DERIVATIVE_FIELDS->value($field);
+ tag 'invalid-field-for-derivative',
+ "$field: $val ($data->{'explanation'})"
+ if $val !~ m/$data->{'regexp'}/;
+ }
+ }
+
#----- Field checks (without checking the value)
for my $field (keys %{$info->field}) {
diff --git a/data/fields/derivative-fields b/data/fields/derivative-fields
new file mode 100644
index 0000000..36600f1
--- /dev/null
+++ b/data/fields/derivative-fields
@@ -0,0 +1,5 @@
+# Derivative-specific field validation
+#
+# format: field ~~ ^regex$ ~~ explanation
+
+source ~~ . ~~ always matches
diff --git a/debian/changelog b/debian/changelog
index 0a5275c..f06645b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,9 @@ lintian (2.5.82) UNRELEASED; urgency=medium
+ [CL] Add a special case for the python3 addon as it needs a
dependency on dh-python unless the -dev packages are used.
Thanks to Julian Andres Klode for the report. (Closes: #895284)
+ * checks/fields.{desc,pm}:
+ + [CL] Add support for derivative-specific field parsing to allow
+ enforcement of additional restrictions (eg. updating Vcs-Git, etc.)
* checks/python.pm:
+ [CL] Apply patch from Pierre-Elliott Bécue to loosen the changelog
parsing of the new-package-should-not-package-python2-module tag to
diff --git a/vendors/pureos/main/data/fields/derivative-fields b/vendors/pureos/main/data/fields/derivative-fields
new file mode 100644
index 0000000..5c9eba8
--- /dev/null
+++ b/vendors/pureos/main/data/fields/derivative-fields
@@ -0,0 +1,8 @@
+maintainer ~~ ^PureOS Maintainers <pureos-project\@lists\.puri\.sm>$ ~~ != PureOS Maintainers <pureos-project@lists.puri.sm>
+uploaders ~~ ^-$ ~~ field must be empty
+xsbc-original-maintainer ~~ . ~~ must be set to original Maintainer field
+vcs-cvs ~~ ^-$ ~~ field must be empty
+vcs-hg ~~ ^-$ ~~ field must be empty
+vcs-svn ~~ ^-$ ~~ field must be empty
+vcs-git ~~ ^https://code.puri.sm/pureos/.+\.git$ ~~ must point to code.puri.sm
+vcs-browser ~~ ^https://code.puri.sm/pureos/.+(?!\.git)$ ~~ must point to code.puri.sm
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: