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

[lintian] 01/01: Warn about Multi-Arch: foreign packages that ship CMake, pkg-config or static libraries in public, architecture-dependent search paths. Thanks to Helmut Grohne for the initial patch and report. (Closes: #882684)



This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository lintian.

commit 942bdc0e1c6a38e12198a89d1f5278a8bd06a30f
Author: Chris Lamb <lamby@debian.org>
Date:   Mon Dec 11 21:57:25 2017 +0000

    Warn about Multi-Arch: foreign packages that ship CMake, pkg-config or static libraries in public, architecture-dependent search paths. Thanks to Helmut Grohne for the initial patch and report. (Closes: #882684)
---
 checks/files.desc                                  | 33 ++++++++++++++++++++++
 checks/files.pm                                    | 11 ++++++++
 debian/changelog                                   |  5 ++++
 .../debian/debian/control.in                       | 18 ++++++++++++
 .../debian/debian/rules                            | 18 ++++++++++++
 t/tests/files-multiarch-foreign-files/desc         |  7 +++++
 t/tests/files-multiarch-foreign-files/tags         |  3 ++
 7 files changed, 95 insertions(+)

diff --git a/checks/files.desc b/checks/files.desc
index 399f681..537a767 100644
--- a/checks/files.desc
+++ b/checks/files.desc
@@ -1784,3 +1784,36 @@ Severity: important
 Certainty: certain
 Info: This package installs a Python module with an overly generic name to
  a global namespace.
+
+Tag: multiarch-foreign-cmake-file
+Severity: important
+Certainty: certain
+Info: The package is architecture-dependent, ships a cmake file in a public,
+ architecture-dependent cmake search path and is marked <tt>Multi-Arch:
+ foreign</tt>. CMake will be unable to find this file, unless it is installed
+ for a matching architecture, but the <tt>foreign</tt> marking says that the
+ architecture should not matter.
+ .
+ Please remove the <tt>Multi-Arch: foreign</tt> stanza.
+
+Tag: multiarch-foreign-pkgconfig
+Severity: important
+Certainty: certain
+Info: The package is architecture-dependent, ships a pkg-config file in a
+ public, architecture-dependent pkg-config search path and is marked
+ <tt>Multi-Arch: foreign</tt>. pkg-config will be unable to find this file,
+ unless it is installed for a matching architecture, but the <tt>foreign</tt>
+ marking says that the architecture should not matter.
+ .
+ Please remove the <tt>Multi-Arch: foreign</tt> stanza.
+
+Tag: multiarch-foreign-static-library
+Severity: important
+Certainty: possible
+Info: The package is architecture-dependent, ships a static library in a
+ public, architecture-dependent library search path and is marked
+ <tt>Multi-Arch: foreign</tt>. A compiler will be unable to find this file,
+ unless it is installed for a matching architecture, but the <tt>foreign</tt>
+ marking says that the architecture should not matter.
+ .
+ Please remove the <tt>Multi-Arch: foreign</tt> stanza.
diff --git a/checks/files.pm b/checks/files.pm
index 19e422c..7473d19 100644
--- a/checks/files.pm
+++ b/checks/files.pm
@@ -300,6 +300,7 @@ sub run {
     my $pkg_section = $info->field('section', '');
     my $arch = $info->field('architecture', '');
     my $multiarch = $info->field('multi-arch', 'no');
+    my $multiarch_dir = $MULTIARCH_DIRS->value($arch);
     my $ppkg = quotemeta($pkg);
 
     # get the last changelog timestamp
@@ -1119,6 +1120,16 @@ sub run {
               ) {
                 tag 'file-in-unusual-dir', $file;
             }
+
+            if ($fname =~ m,^usr/lib/\Q$multiarch_dir\E/(.*)$,) {
+                my $tail = $1;
+                tag 'multiarch-foreign-cmake-file', $file
+                  if ($tail =~ m,^cmake/.+\.cmake$,);
+                tag 'multiarch-foreign-pkgconfig', $file
+                  if ($tail =~ m,^pkgconfig/[^/]+\.pc$,);
+                tag 'multiarch-foreign-static-library', $file
+                  if ($tail =~ m,^lib[^/]+\.a$,);
+            }
         }
 
         if ($fname =~ m,^(?:usr/)?lib/([^/]+)/$,o) {
diff --git a/debian/changelog b/debian/changelog
index b69ff8b..9cb096e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,11 @@ lintian (2.5.63) UNRELEASED; urgency=medium
       ELF binaries in $PATH. Host architecture binaries are generally not
       executable so such files are useless for cross builds.
       (Closes: #794295)
+  * checks/files.{pm,desc}:
+    + [CL] Warn about Multi-Arch: foreign packages that ship CMake,
+      pkg-config or static libraries in public, architecture-dependent
+      search paths. Thanks to Helmut Grohne for the initial patch and
+      report.  (Closes: #882684)
   * checks/source-copyright.desc:
     + [CL] Update description of source-includes-file-in-files-excluded
       to clarify the potential problem and to reference the relevant
diff --git a/t/tests/files-multiarch-foreign-files/debian/debian/control.in b/t/tests/files-multiarch-foreign-files/debian/debian/control.in
new file mode 100644
index 0000000..9d6627e
--- /dev/null
+++ b/t/tests/files-multiarch-foreign-files/debian/debian/control.in
@@ -0,0 +1,18 @@
+Source: {$source}
+Priority: optional
+Section: {$section}
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: {$build_depends}
+Rules-Requires-Root: no
+
+Package: libfoo-dev
+Section: libdevel
+Architecture: any
+Depends: $\{misc:Depends\}, $\{shlibs:Depends\},
+Multi-Arch: foreign
+Description: {$description} (dev)
+ This is a test package designed to exercise some feature or tag of
+ Lintian.  It is part of the Lintian test suite and may do very odd
+ things.  It should not be installed like a regular package.  It may
+ be an empty package.
diff --git a/t/tests/files-multiarch-foreign-files/debian/debian/rules b/t/tests/files-multiarch-foreign-files/debian/debian/rules
new file mode 100755
index 0000000..a13c5b2
--- /dev/null
+++ b/t/tests/files-multiarch-foreign-files/debian/debian/rules
@@ -0,0 +1,18 @@
+#!/usr/bin/make -f
+
+DESTDIR = debian/$(shell dh_listpackages)/usr/lib/$(DEB_BUILD_GNU_TYPE)
+
+%:
+	dh $@
+
+override_dh_auto_install:
+	dh_auto_install
+	
+	mkdir -p $(DESTDIR)/cmake
+	mkdir -p $(DESTDIR)/pkgconfig
+	
+	touch $(DESTDIR)/libfoo.a
+	touch $(DESTDIR)/cmake/foo.cmake
+	touch $(DESTDIR)/pkgconfig/libfoo.pc
+
+override_dh_strip:
diff --git a/t/tests/files-multiarch-foreign-files/desc b/t/tests/files-multiarch-foreign-files/desc
new file mode 100644
index 0000000..3f0dc35
--- /dev/null
+++ b/t/tests/files-multiarch-foreign-files/desc
@@ -0,0 +1,7 @@
+Testname: files-multiarch-foreign-files
+Version: 1.0
+Description: Test for files violating Multi-Arch: foreign
+Test-for:
+ multiarch-foreign-cmake-file
+ multiarch-foreign-pkgconfig
+ multiarch-foreign-static-library
diff --git a/t/tests/files-multiarch-foreign-files/tags b/t/tests/files-multiarch-foreign-files/tags
new file mode 100644
index 0000000..8dbbb43
--- /dev/null
+++ b/t/tests/files-multiarch-foreign-files/tags
@@ -0,0 +1,3 @@
+E: libfoo-dev: multiarch-foreign-cmake-file usr/lib/x86_64-linux-gnu/cmake/foo.cmake
+E: libfoo-dev: multiarch-foreign-pkgconfig usr/lib/x86_64-linux-gnu/pkgconfig/libfoo.pc
+E: libfoo-dev: multiarch-foreign-static-library usr/lib/x86_64-linux-gnu/libfoo.a

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: