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

lintian: r714 - in trunk: checks debian testset testset/binary/debian testset/debug/debian testset/libbaz/debian



Author: rra
Date: 2006-08-19 02:04:18 +0200 (Sat, 19 Aug 2006)
New Revision: 714

Added:
   trunk/checks/version-substvars
   trunk/checks/version-substvars.desc
Modified:
   trunk/debian/changelog
   trunk/testset/binary/debian/control
   trunk/testset/binary/debian/rules
   trunk/testset/debug/debian/control
   trunk/testset/libbaz/debian/control
   trunk/testset/tags.binary
   trunk/testset/tags.debug
   trunk/testset/tags.libbaz
Log:
* checks/version-substvars{.desc,}:
  + [RA] New check from Adeodato Sim?\195?\179 for proper use of substvars for
    versioned dependencies between packages built from the same source
    package so that NMUs will work properly.  Also catch use of such a
    substvar for a versioned dependency on a package not built from the
    same source.  (Closes: #377141, #376596)

Added: trunk/checks/version-substvars
===================================================================
--- trunk/checks/version-substvars	2006-08-18 23:12:38 UTC (rev 713)
+++ trunk/checks/version-substvars	2006-08-19 00:04:18 UTC (rev 714)
@@ -0,0 +1,86 @@
+# version-substvars -- lintian check script -*- perl -*-
+#
+# Copyright (C) 2006 Adeodato Simó
+# 
+# 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.
+
+# SUMMARY
+# =======
+#
+# What breaks
+# -----------
+# 
+# (b1) any -> any (= ${source:Version})		 -> use b:V
+# (b2) any -> all (= ${Source-Version}) [or b:V] -> use s:V
+# (b3) all -> any (= ${either-of-them})		 -> use (>= ${s:V}), optionally (<< ${s:V}.1~)
+
+
+package Lintian::version_substvars;
+use strict;
+
+use Util;
+use Tags;
+
+sub run {
+
+my $pkg = shift;
+my $type = shift;
+
+my @control_data = read_dpkg_control("debfiles/control");
+
+shift @control_data; # skip source info entry
+
+foreach (@control_data) {
+	my ($pkg1, $pkg1_is_any, $pkg2, $pkg2_is_any, $substvar_strips_binNMU);
+
+	$pkg1 = $_->{'package'};
+	$pkg1_is_any = ($_->{'architecture'} ne 'all');
+
+	foreach (split /,/, ($_->{'depends'} || "")) {
+		next unless m/(\S+)\s*\(\s*=\s*\${((?:Source-|source:|binary:)Version)}/x;
+
+		$pkg2 = $1;
+		$substvar_strips_binNMU = ($2 eq 'source:Version');
+
+		if (not -f "control/$pkg2/architecture") {
+			tag "version-substvar-for-external-package", "$pkg1 -> $pkg2";
+			next;
+		}
+		$pkg2_is_any = (slurp_entire_file("control/$pkg2/architecture") !~ m/^all$/);
+
+		if ($pkg1_is_any) {
+			if ($pkg2_is_any and $substvar_strips_binNMU) {
+				# (b1) any -> any (= ${source:Version})
+				tag "not-binnmuable-any-depends-any", "$pkg1 -> $pkg2";
+			} elsif (not $pkg2_is_any and not $substvar_strips_binNMU) {
+				# (b2) any -> all (= ${Source-Version}) [or b:V]
+				tag "not-binnmuable-any-depends-all", "$pkg1 -> $pkg2";
+			}
+		} elsif ($pkg2_is_any) {
+			# (b3) all -> any (= ${either-of-them})
+			tag "not-binnmuable-all-depends-any", "$pkg1 -> $pkg2";
+		}
+
+		# TODO (post-Etch?): warn/error about ${Source-Version} being deprecated
+	}
+}
+
+}
+
+1;
+
+# vim: syntax=perl sw=4 ts=4 noet shiftround

Added: trunk/checks/version-substvars.desc
===================================================================
--- trunk/checks/version-substvars.desc	2006-08-18 23:12:38 UTC (rev 713)
+++ trunk/checks/version-substvars.desc	2006-08-19 00:04:18 UTC (rev 714)
@@ -0,0 +1,43 @@
+Check-Script: version-substvars
+Author: Adeodato Simó <dato@net.com.org.es>
+Abbrev: v-s
+Standards-Version: 3.7.2
+Type: source
+Unpack-Level: 1
+Needs-Info: debfiles, source-control-file
+Info: This script checks for correct use of the various *Version
+ substvars, e.g. deprecated substvars, or usage that can cause
+ un-binNMUability
+
+Tag: not-binnmuable-any-depends-any
+Type: error
+Info: The package is not safely binNMUable because an arch:any package
+ depends on another arch:any package with a (= ${source:Version})
+ relationship. Please use (= ${binary:Version}) instead.
+
+Tag: not-binnmuable-any-depends-all
+Type: warning
+Info: The package is not safely binNMUable because an arch:any package
+ depends on an arch:all package with a (= ${Source-Version}) or
+ (= ${binary:Version}) relationship. Please use (= ${source:Version})
+ instead.
+
+Tag: not-binnmuable-all-depends-any
+Type: warning
+Info: The package is not safely binNMUable because an arch:all package
+ depends on an arch:any package with a strict (= ${Source-Version}), or
+ similar, relationship.
+ .
+ It is not possible for arch:all packages to depend so strictly on
+ arch:any packages while having the package binNMUable, so please use
+ one of these, whichever is more appropriate:
+ .
+   Depends: arch_any (>= ${source:Version})
+   Depends: arch_any (>= ${source:Version}), arch_any (<< ${source:Version}.1~)
+
+Tag: version-substvar-for-external-package
+Type: error
+Info: The first package has a dependency on the second package that uses
+ (= ${binary:Version}), (= ${source:Version}), or (= ${Source-Version}),
+ but the second package is not built from this source package.  Usually
+ this means there is a mistake in the package name in this dependency.

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2006-08-18 23:12:38 UTC (rev 713)
+++ trunk/debian/changelog	2006-08-19 00:04:18 UTC (rev 714)
@@ -48,6 +48,12 @@
       description as requiring a Korn shell and make it clearer that the
       primary arbiter of this test is the POSIX shell specification.
       (Closes: #381800 by clarification)
+  * checks/version-substvars{.desc,}:
+    + [RA] New check from Adeodato Simó for proper use of substvars for
+      versioned dependencies between packages built from the same source
+      package so that NMUs will work properly.  Also catch use of such a
+      substvar for a versioned dependency on a package not built from the
+      same source.  (Closes: #377141, #376596)
 
   * collection/changelog-file:
     + [RA] Be much more careful about changelog files that are symlinks.

Modified: trunk/testset/binary/debian/control
===================================================================
--- trunk/testset/binary/debian/control	2006-08-18 23:12:38 UTC (rev 713)
+++ trunk/testset/binary/debian/control	2006-08-19 00:04:18 UTC (rev 714)
@@ -6,7 +6,14 @@
 Standards-Version: 3.2.1
 
 Package: binary
-Architecture: alpha amd64 arm hppa hurd-i386 i386 ia64 kfreebsd-i386 m68k mips mipsel powerpc ppc64 s390 sparc
-Depends: ${shlibs:Depends}, xorg
+Architecture: any
+Depends: ${shlibs:Depends}, xorg, binary-data (= ${Source-Version})
 Description: test handling of binary files
  Regression test for lintian's handling of binary files.
+
+Package: binary-data
+Architecture: all
+Depends: binary (= ${Source-Version})
+Description: test handling of binary relationships
+ Regression test for lintian's checking of package relationships between
+ arch:any and arch:all packages.

Modified: trunk/testset/binary/debian/rules
===================================================================
--- trunk/testset/binary/debian/rules	2006-08-18 23:12:38 UTC (rev 713)
+++ trunk/testset/binary/debian/rules	2006-08-19 00:04:18 UTC (rev 714)
@@ -53,9 +53,15 @@
 
 	dd if=/dev/zero of=$(tmp)/usr/share/binary/largefile bs=1024 count=2000
 
+	install -d debian/binary-data/DEBIAN
+	install -d debian/binary-data/usr/share/doc
+	ln -s binary debian/binary-data/usr/share/doc/binary-data
+
 	dpkg-shlibdeps $(tmp)/usr/bin/hello
-	dpkg-gencontrol -isp
+	dpkg-gencontrol -pbinary -isp
+	dpkg-gencontrol -pbinary-data -Pdebian/binary-data -isp
 	dpkg --build debian/tmp ..
+	dpkg --build debian/binary-data ..
 
 binary: binary-arch
 

Modified: trunk/testset/debug/debian/control
===================================================================
--- trunk/testset/debug/debian/control	2006-08-18 23:12:38 UTC (rev 713)
+++ trunk/testset/debug/debian/control	2006-08-19 00:04:18 UTC (rev 714)
@@ -7,21 +7,21 @@
 Standards-Version: 3.7.0
 
 Package: hello
-Architecture: any
+Architecture: alpha amd64 arm hppa hurd-i386 i386 ia64 kfreebsd-i386 m68k mips mipsel powerpc ppc64 s390 sparc
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: Test for external debugging information
  lintian regression test for external debugging file handling.
 
 Package: hello-dbg
 Priority: extra
-Architecture: any
+Architecture: alpha amd64 arm hppa hurd-i386 i386 ia64 kfreebsd-i386 m68k mips mipsel powerpc ppc64 s390 sparc
 Depends: hello (= ${Source-Version}), ${shlibs:Depends}, ${misc:Depends}
 Description: Test for external debugging information
  lintian regression test for external debugging file handling.
 
 Package: libhello0
 Section: libs
-Architecture: any
+Architecture: alpha amd64 arm hppa hurd-i386 i386 ia64 kfreebsd-i386 m68k mips mipsel powerpc ppc64 s390 sparc
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: Test for external debugging information
  lintian regression test for external debugging file handling.
@@ -29,7 +29,7 @@
 Package: libhello0-dbg
 Section: libdevel
 Priority: extra
-Architecture: any
+Architecture: alpha amd64 arm hppa hurd-i386 i386 ia64 kfreebsd-i386 m68k mips mipsel powerpc ppc64 s390 sparc
 Depends: libhello (= ${Source-Version}), ${shlibs:Depends}, ${misc:Depends}
 Description: Test for external debugging information
  lintian regression test for external debugging file handling.

Modified: trunk/testset/libbaz/debian/control
===================================================================
--- trunk/testset/libbaz/debian/control	2006-08-18 23:12:38 UTC (rev 713)
+++ trunk/testset/libbaz/debian/control	2006-08-19 00:04:18 UTC (rev 714)
@@ -12,7 +12,7 @@
 
 Package: libbaz1-dev
 Architecture: any
-Depends: libbaz1
+Depends: libbaz1 (= ${source:Version})
 Description: development package
  Regression test for lintian's handling of libraries
 
@@ -24,6 +24,6 @@
 
 Package: libbaz2-dev
 Architecture: any
-Depends: ${shlibs:Depends}, libbaz2
+Depends: ${shlibs:Depends}, libbaz2 (= ${Source-Version})
 Description: development package
  Regression test for lintian's handling of libraries

Modified: trunk/testset/tags.binary
===================================================================
--- trunk/testset/tags.binary	2006-08-18 23:12:38 UTC (rev 713)
+++ trunk/testset/tags.binary	2006-08-19 00:04:18 UTC (rev 714)
@@ -26,13 +26,13 @@
 E: binary: symlink-contains-spurious-segments usr/share/doc/binary/html/ch2.html ../html/./ch1.html
 E: binary: symlink-should-be-relative usr/share/doc/binary/html/ch3.html /usr/share/doc/binary/htm/ch1.html
 E: binary: unstripped-binary-or-object ./usr/bin/hello
-I: binary source: non-standard-architecture kfreebsd-i386
-I: binary source: non-standard-architecture ppc64
 I: binary: arch-dep-package-has-big-usr-share
 I: binary: binary-has-unneeded-section ./usr/bin/hello-static .comment
 W: binary source: ancient-standards-version 3.2.1 (current is 3.7.2)
 W: binary source: maintainer-upload-has-incorrect-version-number 4-1.1
 W: binary source: native-package-with-dash-version
+W: binary source: not-binnmuable-all-depends-any binary-data -> binary
+W: binary source: not-binnmuable-any-depends-all binary -> binary-data
 W: binary: binary-without-manpage hello
 W: binary: binary-without-manpage hello-static
 W: binary: binary-without-manpage hello.static

Modified: trunk/testset/tags.debug
===================================================================
--- trunk/testset/tags.debug	2006-08-18 23:12:38 UTC (rev 713)
+++ trunk/testset/tags.debug	2006-08-19 00:04:18 UTC (rev 714)
@@ -1,8 +1,11 @@
 E: debug source: build-depends-indep-without-arch-indep
+E: debug source: version-substvar-for-external-package libhello0-dbg -> libhello
 E: hello: statically-linked-binary ./usr/bin/hello.dbg
 E: hello: unstripped-binary-or-object ./usr/bin/hello.dbg
 E: libhello0-dbg: binary-with-bad-dynamic-table ./usr/lib/libhello.so.dbg
 E: libhello0-dbg: sharedobject-in-library-directory-not-actually-a-shlib usr/lib/libhello.so.dbg
+I: debug source: non-standard-architecture kfreebsd-i386
+I: debug source: non-standard-architecture ppc64
 W: debug source: changelog-should-not-mention-nmu
 W: debug source: out-of-date-standards-version 3.7.0 (current is 3.7.2)
 W: hello: binary-without-manpage hello

Modified: trunk/testset/tags.libbaz
===================================================================
--- trunk/testset/tags.libbaz	2006-08-18 23:12:38 UTC (rev 713)
+++ trunk/testset/tags.libbaz	2006-08-19 00:04:18 UTC (rev 714)
@@ -1,4 +1,5 @@
 E: libbaz source: debian-rules-missing-required-target binary-indep
+E: libbaz source: not-binnmuable-any-depends-any libbaz1-dev -> libbaz1
 E: libbaz1: control-file-has-bad-permissions shlibs 0755 != 0644
 E: libbaz1: duplicate-entry-in-shlibs-control-file libdoesntexist2 1.0
 E: libbaz1: duplicate-entry-in-shlibs-control-file udeb: libdoesntexist2 1.0



Reply to: