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

lintian: r216 - in branches/1.23.0: checks collection debian man



Author: djpig
Date: 2004-04-23 20:58:59 +0200 (Fri, 23 Apr 2004)
New Revision: 216

Added:
   branches/1.23.0/collection/source-control-file
   branches/1.23.0/collection/source-control-file.desc
Modified:
   branches/1.23.0/checks/debhelper
   branches/1.23.0/checks/debhelper.desc
   branches/1.23.0/debian/changelog
   branches/1.23.0/man/lintian.1
Log:
New collection script to extract field information
from debian/control in source packages. Currently used
in checks/debhelper to guess udeb packages for avoiding
false positives in certain checks.


Modified: branches/1.23.0/checks/debhelper
===================================================================
--- branches/1.23.0/checks/debhelper	2004-04-23 11:50:05 UTC (rev 215)
+++ branches/1.23.0/checks/debhelper	2004-04-23 18:58:59 UTC (rev 216)
@@ -89,13 +89,29 @@
 
 exit unless $seencommand;
 
+# We may need to make a difference between deb and udeb packages
+# so try to find out
+my %pkgs;
+opendir(BINPKGS, 'control')
+    or fail("Can't open control directory.");
+while(my $binpkg = readdir(BINPKGS)) {
+    if (-d "control/$binpkg") {
+        if (open TYPE, "<", "control/$binpkg/xc-package-type") {
+            $pkgs{$binpkg} = <TYPE> || 'deb';
+        } else {
+            $pkgs{$binpkg} = 'deb';
+        }
+    }
+}
+
 # If we got this far, they need to have #DEBHELPER# in their scripts.
 # search for scripts that look like maintainer scripts.
 opendir(DEBIAN, 'debfiles')
     or fail("Can't open debfiles directory.");
 while (defined(my $file=readdir(DEBIAN))) {
-    if ($file =~ m/^(?:.*\.)?(?:post|pre)(?:inst|rm)$/) {
+    if ($file =~ m/^(?:(.*)\.)?(?:post|pre)(?:inst|rm)$/) {
 	
+        my $binpkg = $1 || '';
 	open(IN,"debfiles/$file")
 	    or fail("Can't open debfiles/$file: $!");
 	my $seentag = '';
@@ -108,7 +124,7 @@
 	close IN;
 	
 	if ((! $seentag) and $needtomodifyscripts) {
-	    print "W: $pkg $type: maintainer-script-lacks-debhelper-token debian/$file\n";
+	    print "W: $pkg $type: maintainer-script-lacks-debhelper-token debian/$file\n" unless $binpkg && ($pkgs{$binpkg} =~ /udeb/i);
 	}
     } elsif ($file =~ m/^compat$/) {
 	open IN, "debfiles/$file"

Modified: branches/1.23.0/checks/debhelper.desc
===================================================================
--- branches/1.23.0/checks/debhelper.desc	2004-04-23 11:50:05 UTC (rev 215)
+++ branches/1.23.0/checks/debhelper.desc	2004-04-23 18:58:59 UTC (rev 216)
@@ -5,7 +5,7 @@
 Type: source
 Unpack-Level: 2
 Info: This looks for common mistakes in debhelper source packages.
-Needs-Info: debfiles
+Needs-Info: debfiles, source-control-file
 
 Tag: maintainer-script-lacks-debhelper-token
 Type: warning

Added: branches/1.23.0/collection/source-control-file
===================================================================
--- branches/1.23.0/collection/source-control-file	2004-04-23 11:50:05 UTC (rev 215)
+++ branches/1.23.0/collection/source-control-file	2004-04-23 18:58:59 UTC (rev 216)
@@ -0,0 +1,52 @@
+#!/usr/bin/perl -w
+# source-control-file -- lintian collector script
+
+# Copyright (C) 2004 Frank Lichtenheld
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, you can find it on the World Wide
+# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
+use strict;
+use warnings;
+
+($#ARGV == 1) or fail("syntax: source-control-file <pkg> <type>");
+my $pkg = shift;
+my $type = shift;
+
+-f "debfiles/control" or fail("control invoked in wrong directory");
+
+use lib "$ENV{'LINTIAN_ROOT'}/lib";
+use Util;
+
+my @control_data = read_dpkg_control("debfiles/control");
+shift @control_data; # we don't need the source information
+
+mkdir "control", 0777  or fail( "can't create dir control: $!" );
+
+foreach (@control_data) {
+    my $pkg_name = $_->{'package'};
+    fail("no package line found in control file of $pkg $type")
+        if !$pkg_name;
+    mkdir "control/$pkg_name", 0777
+        or fail( "can't create dir control/$pkg_name: $!" );
+    for my $field (keys %$_) {
+        my $field_file = "control/$pkg_name/$field";
+        open F, ">", "$field_file"
+            or fail("cannot open file $field_file for writing: $!");
+        print F $_->{$field},"\n";
+        close F;
+    }
+}


Property changes on: branches/1.23.0/collection/source-control-file
___________________________________________________________________
Name: svn:executable
   + *

Added: branches/1.23.0/collection/source-control-file.desc
===================================================================
--- branches/1.23.0/collection/source-control-file.desc	2004-04-23 11:50:05 UTC (rev 215)
+++ branches/1.23.0/collection/source-control-file.desc	2004-04-23 18:58:59 UTC (rev 216)
@@ -0,0 +1,8 @@
+Collector-Script: source-control-file
+Author: Frank Lichtenheld <djpig@debian.org>
+Info: Collects information about binary packages from debian/control in source packages
+Type: source
+Unpack-Level: 1
+Output: control
+Order: 2
+Needs-Info: debfiles

Modified: branches/1.23.0/debian/changelog
===================================================================
--- branches/1.23.0/debian/changelog	2004-04-23 11:50:05 UTC (rev 215)
+++ branches/1.23.0/debian/changelog	2004-04-23 18:58:59 UTC (rev 216)
@@ -135,6 +135,10 @@
   * collection/override-file:
     + [FL] add support for source overrides (Closes: #129510)
       See the User Manual for more information.
+  * collection/source-control-file:
+    + [FL] New collection script to extract field information
+      from debian/control in source packages. Currently used
+      in checks/debhelper to guess udeb packages.
 
   * debian/control,debian/copyright:
     + [FL] Add Marc 'HE' Brockschmidt to Uploaders and

Modified: branches/1.23.0/man/lintian.1
===================================================================
--- branches/1.23.0/man/lintian.1	2004-04-23 11:50:05 UTC (rev 215)
+++ branches/1.23.0/man/lintian.1	2004-04-23 18:58:59 UTC (rev 216)
@@ -546,6 +546,11 @@
 .B scripts
 Collect information about scripts in binary package.
 
+.TP
+.B source-control-file
+Collects information about binary packages from debian/control
+in source packages
+
 .SH FILES
 Lintian looks for its configuration file in the following locations:
 .TP



Reply to: