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

[SCM] Debian package checker branch, master, updated. 1.24.2-85-g299444f



The following commit has been merged in the master branch:
commit 0e5fcae36e9f97941398f247ea7433a2edaff56c
Author: Frank Lichtenheld <djpig@debian.org>
Date:   Tue Aug 5 23:53:35 2008 -0300

    Add new --tags/-T option
    
    Used to limit the checks run not by check names but by names of tags
    you're interested in. This will not suppress other tags in the selected checks!
    Requested by Joerg Jaspert for ftpmaster.

diff --git a/debian/changelog b/debian/changelog
index ac02082..fcaa62b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -120,6 +120,12 @@ lintian (1.24.3) unstable; urgency=low
       tags.
   * doc/README:
     + [ADB] Add -E / --show-experimental to the option list
+  
+  * frontend/lintian:
+    + [FL] Add new --tags/-T option to limit the amount of checks
+      run not by check names but by names of tags you're interested
+      in. This will not suppress other tags in the selected checks!
+      Requested by Joerg Jaspert for ftpmaster.  (Closes: #493903)
 
   * lib/Lintian/Collect/Binary.pm:
     + [ADB] When parsing objdump-info, indicate whether a shared object is
@@ -132,6 +138,7 @@ lintian (1.24.3) unstable; urgency=low
   * man/lintian.1
     + [ADB] Update the list of check scripts, removing the no longer present
       deb-format and perl and adding the nmu script.
+    + [FL] Document the new --tags/-T option.
 
   * testset/fields:
     + [ADB] New testset from Tobias Quathamer (including some tags which
diff --git a/frontend/lintian b/frontend/lintian
index 0f5b4ce..86c0674 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -75,6 +75,7 @@ my @packages;
 
 my $action;
 my $checks;
+my $check_tags;
 my $dont_check;
 my $unpack_info;
 my $cwd;
@@ -128,6 +129,7 @@ Actions:
     -c, --check               check packages (default action)
     -C X, --check-part X      check only certain aspects
     -X X, --dont-check-part X don\'t check certain aspects
+    -T X, --tags X            only run checks needed for requested tags
     -u, --unpack              only unpack packages in the lab
     -r, --remove              remove package from the lab
 General options:
@@ -205,6 +207,26 @@ sub record_check_part {
     $checks = "$_[1]";
 }
 
+# Record Parts requested for checking
+# Options: -T|--tags
+sub record_check_tags {
+    if (defined $action and $action eq 'check' and $check_tags) {
+	die("multiple -T or --tags options not allowed");
+    }
+    if ($checks) {
+	die("both -T or --tags and -C or --check-part options not allowed");
+    }
+    if ($dont_check) {
+	die("both -T or --tags and -X or --dont-check-part options not allowed");
+    }
+    if ($action) {
+	die("too many actions specified: $_[0]");
+    }
+    $action = 'check';
+    $check_tags = "$_[1]";
+}
+
+
 # Record Parts requested not to check
 # Options: -X|--dont-check-part X
 sub record_dont_check_part {
@@ -244,6 +266,7 @@ my %opthash = (			# ------------------ actions
 	       "remove-lab|R" => \&record_action,
 	       "check|c" => \&record_action,
 	       "check-part|C=s" => \&record_check_part,
+	       "tags|T=s" => \&record_check_tags,
 	       "dont-check-part|X=s" => \&record_dont_check_part,
 	       "unpack|u" => \&record_action,
 	       "remove|r" => \&record_action,
@@ -1053,7 +1076,7 @@ for my $f (readdir CHECKDIR) {
 	}
 
 	shift(@secs);
-	map Tags::add_tag($_), @secs;
+	map { $_->{'script'}=$script; Tags::add_tag($_) } @secs;
     } # end: if ne lintian
 
 }
@@ -1082,20 +1105,38 @@ for my $c (keys %check_info) {
 
 # {{{ determine which checks have been requested
 if ($action eq 'check') {
-    my %dont_check = map { $_ => 1 } (split m/,/, ($dont_check || ""));
-    $checks or ($checks = join(',',keys %check_info));
-    for my $c (split(/,/,$checks)) {
-	if ($check_info{$c}) {
-	    if ($dont_check{$c} || ($check_info{$c}->{'abbrev'} && $dont_check{$check_info{$c}->{'abbrev'}})) {
-		#user requested not to run this check
+    if ($check_tags) {
+	foreach my $t (split(/,/, $check_tags)) {
+	    my $info = Tags::get_tag_info($t);
+
+	    fail("unknown tag specified: $t") unless defined($info);
+	    my $script = $info->{'script'};
+	    next if $script eq 'lintian';
+	    if ($check_info{$script}) {
+		$checks{$script} = 1;
 	    } else {
-		$checks{$c} = 1;
+		# should never happen
+		fail("no info for script $script");
+	    }
+	}
+    } else {
+	my %dont_check = map { $_ => 1 } (split m/,/, ($dont_check || ""));
+	$checks or ($checks = join(',',keys %check_info));
+	for my $c (split(/,/,$checks)) {
+	    if ($check_info{$c}) {
+		if ($dont_check{$c}
+		    || ($check_info{$c}->{'abbrev'}
+			&& $dont_check{$check_info{$c}->{'abbrev'}})) {
+		    #user requested not to run this check
+		} else {
+		    $checks{$c} = 1;
+		}
+	    } elsif (exists $check_abbrev{$c}) {
+		#abbrevs only used when -C is given, so we don't need %dont_check
+		$checks{$check_abbrev{$c}} = 1;
+	    } else {
+		fail("unknown check specified: $c");
 	    }
-	} elsif (exists $check_abbrev{$c}) {
-	    #abbrevs only used when -C is given, so we don't need %dont_check
-	    $checks{$check_abbrev{$c}} = 1;
-	} else {
-	    fail("unknown check specified: $c");
 	}
     }
 
diff --git a/man/lintian.1 b/man/lintian.1
index 62acb1e..5dde18a 100644
--- a/man/lintian.1
+++ b/man/lintian.1
@@ -88,6 +88,11 @@ name of the check script or the abbreviation.
 For details, see the CHECKS section below.
 
 .TP
+.BR \-T " tag1,tag2,...m " \-\-tags " tag1,tag2,..."
+Run only the checks that issue the requested tags.  This
+will not supress other tags issues by the checks' run!
+
+.TP
 .BR \-X " chk1,chk2,..., " \-\-dont\-check\-part " chk1,chk2,..."
 Run all but the the specified checks.  You can either specify
 the name of the check script or the abbreviation.

-- 
Debian package checker


Reply to: