Commit fb04da29 by Chris Lamb

Add support for derivative-specific field parsing to allow enforcement of…

Add support for derivative-specific field parsing to allow enforcement of additional restrictions (eg. updating Vcs-Git, etc.)
parent 7d887c08
......@@ -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.
......@@ -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}) {
......
# Derivative-specific field validation
#
# format: field ~~ ^regex$ ~~ explanation
source ~~ . ~~ always matches
......@@ -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
......
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment