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

lintian: r1003 - in trunk: checks debian man testset/debconf/debian testset/scripts/debian testset/scripts/debian/patches



Author: he
Date: 2007-11-30 17:10:48 +0100 (Fri, 30 Nov 2007)
New Revision: 1003

Added:
   trunk/checks/patch-systems
   trunk/checks/patch-systems.desc
   trunk/testset/scripts/debian/patches/
   trunk/testset/scripts/debian/patches/00list
   trunk/testset/scripts/debian/patches/02_i_dont_have_a_description.patch
Modified:
   trunk/debian/changelog
   trunk/man/lintian.1
   trunk/testset/debconf/debian/control
   trunk/testset/scripts/debian/control
Log:
* checks/patch-systems:
  + [HE] Add complete new check script, intended to check for usual
         problems when using patch systems. Start with three
         checks for common dpatch problems. Idea loosely based on
         patch by Carl F?\195?\131?\194?\188rstenberg <azatoth@gmail.com>. (Closes: #437959)

Added: trunk/checks/patch-systems
===================================================================
--- trunk/checks/patch-systems	2007-11-30 11:08:17 UTC (rev 1002)
+++ trunk/checks/patch-systems	2007-11-30 16:10:48 UTC (rev 1003)
@@ -0,0 +1,92 @@
+# patch-systems -- lintian check script -*- perl -*-
+#
+# Copyright (C) 2007 Marc Brockschmidt
+#
+# 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., 51 Franklin St, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+package Lintian::patch_systems;
+use strict;
+use lib "$ENV{'LINTIAN_ROOT'}/checks/";
+use common_data;
+use Dep;
+use Tags;
+use Util;
+
+sub run {
+	my ($pkg, $type) = @_;
+
+	unless (-d "fields") {
+    	fail("directory in lintian laboratory for $type package $pkg missing: fields");
+	}
+
+	#Get build deps so we can decide which build system the maintainer
+	#meant to use:
+	my $build_deps = "";
+    if (open(IN, '<', "fields/build-depends")) {
+		local $/ = undef;
+        chomp($build_deps .= <IN>);
+		close(IN);
+    }
+	if (open(IN, '<', "fields/build-depends-indep")) {
+		local $/ = undef;
+		chomp($build_deps .= <IN>);
+		close(IN);
+	}
+	$build_deps = Dep::parse($build_deps);
+
+	#----- dpatch
+	if (Dep::implies($build_deps, Dep::parse("dpatch"))) {
+		#check for a debian/patches file:
+		if (! -r "debfiles/patches/00list") {
+			tag "dpatch-build-dep-but-no-patch-list", $pkg;
+		} else {
+			if (open(IN, '<', "debfiles/patches/00list")) {
+				my @patches;
+				while(<IN>) {
+					chomp;
+					next if (/^#/); #ignore comments
+					push @patches, $_;
+					if (! -r "debfiles/patches/$_") {
+						tag "dpatch-index-references-non-existant-patch", $_;
+					}
+				}
+				close(IN);
+
+				#check that we have comments everywhere
+				foreach my $patch_file (@patches) {
+					if (open(PATCH_FILE, '<', "debfiles/patches/" . $patch_file)) {
+						my $has_comment = 0;
+						while (<PATCH_FILE>) {
+							#stop if something looking like a patch starts:
+							last if /^---/;
+							#note comment if we find a proper one
+							$has_comment = 1 if (/^#+\s*DP:\s*(.*)$/ && $1 !~ /^no description\.?$/i)
+						}
+						close(PATCH_FILE);
+						unless ($has_comment) {
+							tag "dpatch-missing-description", $patch_file;
+						}
+					}
+				}
+			}
+		}
+	}
+}
+
+1;
+
+# vim: syntax=perl sw=4 ts=4 noet shiftround

Added: trunk/checks/patch-systems.desc
===================================================================
--- trunk/checks/patch-systems.desc	2007-11-30 11:08:17 UTC (rev 1002)
+++ trunk/checks/patch-systems.desc	2007-11-30 16:10:48 UTC (rev 1003)
@@ -0,0 +1,29 @@
+Check-Script: patch-systems
+Author: Marc Brockschmidt <he@debian.org>
+Abbrev: pat
+Standards-Version: 3.7.2
+Type: source
+Unpack-Level: 1
+Info: This script checks for various possible problems when using patch systems
+Needs-Info: debfiles
+
+Tag: dpatch-build-dep-but-no-patch-list
+Type: warning
+Info: Using dpatch requires you to explicitly list all patches you want
+ to apply in debian/patches/00list. This package build-depends on dpatch,
+ but does not provide a patch list.
+ .
+ You should either remove the dpatch build dependency or add a patch
+ list.
+
+Tag: dpatch-index-references-non-existant-patch
+Type: error
+Info: In the 00list file listing all your dpatches, you referenced a file
+ that is not existant. This will lead to a fatal error when calling
+ dpatch.
+
+Tag: dpatch-missing-description
+Type: warning
+Info: dpatch files should carry a description of the function of the included
+ patch. Description lines start with "## DP:".
+

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2007-11-30 11:08:17 UTC (rev 1002)
+++ trunk/debian/changelog	2007-11-30 16:10:48 UTC (rev 1003)
@@ -30,6 +30,11 @@
            stolen from linda. (Closes: #452839)
     + [HE] Check for Section field in source packages, for which it
            is mandatory. Joerg Jaspert made me do this.
+  * checks/patch-systems:
+    + [HE] Add complete new check script, intended to check for usual
+           problems when using patch systems. Start with three
+           checks for common dpatch problems. Idea loosely based on
+           patch by Carl Fürstenberg <azatoth@gmail.com>. (Closes: #437959)
   * checks/scripts:
     + [HE] Allow packages to drop snippets into /etc/csh/login.d
            without a dependency on csh. Files there should also

Modified: trunk/man/lintian.1
===================================================================
--- trunk/man/lintian.1	2007-11-30 11:08:17 UTC (rev 1002)
+++ trunk/man/lintian.1	2007-11-30 16:10:48 UTC (rev 1003)
@@ -463,6 +463,10 @@
 Check the syntax of menu files installed by the package.
 
 .TP
+.B patch\-system (pat)
+Check source package use of patch systems.
+
+.TP
 .B perl (prl)
 Check perl scripts installed by the package for the usage of perl
 modules, and check that the package declares the appropriate

Modified: trunk/testset/debconf/debian/control
===================================================================
--- trunk/testset/debconf/debian/control	2007-11-30 11:08:17 UTC (rev 1002)
+++ trunk/testset/debconf/debian/control	2007-11-30 16:10:48 UTC (rev 1003)
@@ -1,7 +1,7 @@
 Source: debconf
 Section: utils
 Priority: optional
-Build-Depends: debhelper (>= 4)
+Build-Depends: debhelper (>= 4), dpatch
 Maintainer: Lintian Maintainers <lintian@packages.debian.org>
 Standards-Version: 3.7.2
 

Modified: trunk/testset/scripts/debian/control
===================================================================
--- trunk/testset/scripts/debian/control	2007-11-30 11:08:17 UTC (rev 1002)
+++ trunk/testset/scripts/debian/control	2007-11-30 16:10:48 UTC (rev 1003)
@@ -3,7 +3,7 @@
 Priority: extra
 Maintainer: Lintian Maintainers <lintian-maint@debian.org>
 Uploaders: Jeroen van Wolfelaar <jeroen@wolffelaar.nl>, Marc 'HE' Brockschmidt <he@debian.org>
-Build-Depends-Indep: python (>= 2.3), python (<< 2.4)
+Build-Depends-Indep: python (>= 2.3), python (<< 2.4), dpatch
 Standards-Version: 3.2.1
 
 Package: scripts

Added: trunk/testset/scripts/debian/patches/00list
===================================================================
--- trunk/testset/scripts/debian/patches/00list	2007-11-30 11:08:17 UTC (rev 1002)
+++ trunk/testset/scripts/debian/patches/00list	2007-11-30 16:10:48 UTC (rev 1003)
@@ -0,0 +1,2 @@
+01_not_here_right_now.dpatch
+02_i_dont_have_a_description.patch

Added: trunk/testset/scripts/debian/patches/02_i_dont_have_a_description.patch
===================================================================
--- trunk/testset/scripts/debian/patches/02_i_dont_have_a_description.patch	2007-11-30 11:08:17 UTC (rev 1002)
+++ trunk/testset/scripts/debian/patches/02_i_dont_have_a_description.patch	2007-11-30 16:10:48 UTC (rev 1003)
@@ -0,0 +1,7 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 02_i_dont_have_a_description.patch.dpatch by Marc 'HE' Brockschmidt <Marc 'HE' Brockschmidt <he@debian.org>>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@



Reply to: