[SCM] Debian package checker branch, master, updated. 2.5.10-211-g9f68451
The following commit has been merged in the master branch:
commit 9f684516bfa6edaa9c93e7ece190d9a92dba3e58
Author: Niels Thykier <niels@thykier.net>
Date: Sat Oct 20 17:22:19 2012 +0200
L::Profile: Allow "Load-Checks" field in profiles
Add a new optional field to profiles called "Load-Checks". It ensures
that a given list of checks are loaded to allow Enable-Tags or
Disable-Tags to work on third-party checks.
If a check is loaded via Load-Checks, all of its tags will be
disabled. If a check listed in a Load-Checks field is already loaded
(by the time the field is processed), the request is silently ignored.
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/debian/changelog b/debian/changelog
index aabff2a..18645e3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -184,6 +184,9 @@ lintian (2.5.11) UNRELEASED; urgency=low
* lib/Lintian/Lab/Entry.pm:
+ [NT] Use the L::Collect during creation instead of
manually reading the dsc for source packages.
+ * lib/Lintian/Profile.pm:
+ + [NT] Add support for the new optional "Load-Checks"
+ field in profiles.
* lib/Lintian/Tags.pm:
+ [NT] Be explicit about the reason when rejecting an
override. Thanks to Yves-Alexis Perez for the report.
diff --git a/doc/lintian.xml b/doc/lintian.xml
index ff816c8..55af2fe 100644
--- a/doc/lintian.xml
+++ b/doc/lintian.xml
@@ -792,11 +792,36 @@ foo [!any-i386] binary: some-tag-not-for-i386 optional-extra
</listitem>
</varlistentry>
<varlistentry>
+ <term><emphasis>Load-Checks</emphasis> (folded, optional)</term>
+ <listitem>
+ <para>
+ Comma-separated list of checks. Lintian will ensure
+ all checks listed are loaded (allowing tags from
+ them to be enabled or disabled via Enable-Tags or
+ Disable-Tags).
+ </para>
+ <para>
+ If a given check was already loaded before this
+ field is processed, then it is silently ignored.
+ Otherwise, the check is loaded and all of its tags
+ are disabled (as if it had been listed in
+ Disable-Tags-From-Check).
+ </para>
+ <para>
+ This field is most likely only useful if the profile
+ needs to enable a list of tags from a check in
+ additional to any tags already enabled from that
+ check (if any).
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><emphasis>Enable-Tags-From-Check</emphasis> (folded, optional)</term>
<listitem>
<para>
Comma-separated list of checks. All tags from each
- check listed will be enabled in this profile.
+ check listed will be enabled in this profile. The check will
+ be loaded if it wasn't already.
</para>
</listitem>
</varlistentry>
@@ -805,15 +830,20 @@ foo [!any-i386] binary: some-tag-not-for-i386 optional-extra
<listitem>
<para>
Comma-separated list of checks. All tags from each
- check listed will be disabled in this profile.
+ check listed will be disabled in this profile. The check will
+ be loaded if it wasn't already.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Enable-Tags</emphasis> (folded, optional)</term>
<listitem>
- <para> Comma-separated list of tags that should be
- enabled.
+ <para>
+ Comma-separated list of tags that should be enabled.
+ It may only list tags from checks already loaded or
+ listed in one of the following fields "Load-Checks",
+ "Enable-Tags-From-Check" or
+ "Disable-Tags-From-Check" in the current profile.
</para>
</listitem>
</varlistentry>
@@ -822,7 +852,10 @@ foo [!any-i386] binary: some-tag-not-for-i386 optional-extra
<listitem>
<para>
Comma-separated list of tags that should be
- disabled.
+ disabled. It may only list tags from checks already
+ loaded or listed in one of the following fields
+ "Load-Checks", "Enable-Tags-From-Check" or
+ "Disable-Tags-From-Check" in the current profile.
</para>
</listitem>
</varlistentry>
@@ -830,8 +863,9 @@ foo [!any-i386] binary: some-tag-not-for-i386 optional-extra
<para>
The profile is invalid and is rejected, if Enable-Tags and
Disable-Tags lists the same tag twice - even if it is in
- the same field. This holds analogously for
- Enable-Tags-From-Check and Disable-Tags-From-Check.
+ the same field. This holds analogously for checks and the
+ three fields Load-Checks, Enable-Tags-From-Check and
+ Disable-Tags-From-Check.
</para>
<para>
It is allowed to list a tag in Enable-Tags or
@@ -843,9 +877,14 @@ foo [!any-i386] binary: some-tag-not-for-i386 optional-extra
the profile.
</para>
<para>
- It is not an error to enable or disable a check that is
- already enabled or disabled respectively (e.g. by a
- parent profile).
+ Load-Checks, Enable-Tags-From-Check and
+ Disable-Tags-From-Check can be used to load third-party or
+ vendor specific checks.
+ </para>
+ <para>
+ It is not an error to load, enable or disable a check or
+ tag that is already loaded, enabled or disabled
+ respectively (e.g. by a parent profile).
</para>
<para>
A profile is invalid if it directly or indirectly extends
diff --git a/lib/Lintian/Profile.pm b/lib/Lintian/Profile.pm
index ed5787f..999ac51 100644
--- a/lib/Lintian/Profile.pm
+++ b/lib/Lintian/Profile.pm
@@ -391,7 +391,7 @@ sub _read_profile_section {
sub _read_profile_tags{
my ($self, $pname, $pheader) = @_;
$self->_check_for_invalid_fields($pheader, \%MAIN_FIELDS, $pname, 'profile header');
- $self->_check_duplicates($pname, $pheader, 'enable-tags-from-check', 'disable-tags-from-check');
+ $self->_check_duplicates($pname, $pheader, 'load-checks', 'enable-tags-from-check', 'disable-tags-from-check');
$self->_check_duplicates($pname, $pheader, 'enable-tags', 'disable-tags');
my $tags_from_check_sub = sub {
my ($field, $check) = @_;
@@ -410,6 +410,12 @@ sub _read_profile_tags{
}
return $tag;
};
+ if ($pheader->{'load-checks'}) {
+ foreach my $check ($self->_split_comma_sep_field ($pheader->{'load-checks'})) {
+ $self->_load_check ($pname, $check)
+ unless exists $self->{'check-scripts'}->{$check};
+ }
+ }
$self->_enable_tags_from_field($pname, $pheader, 'enable-tags-from-check', $tags_from_check_sub, 1);
$self->_enable_tags_from_field($pname, $pheader, 'disable-tags-from-check', $tags_from_check_sub, 0);
$self->_enable_tags_from_field($pname, $pheader, 'enable-tags', $tag_sub, 1);
--
Debian package checker
Reply to: