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

Bug#882684: lintian should complain about more abuses of Multi-Arch: foreign (cmake, pkg-config, static libraries)



Package: lintian
Version: 2.5.59
Tags: patch
User: helmutg@debian.org
Usertags: rebootstrap

I observe that multiarch adoption generally improves. Unfortunately,
maintainers tend to apply it in cases where it actually is wrong. So we
need to make lintian tell them that they shouldn't do that.

Using the database backing dedup.d.n, I identified three common abuses
of the Multi-Arch: foreign stanza:

 * /usr/lib/<triplet>/cmake/*.cmake (21 binary packages)
 * /usr/lib/<triplet>/pkgconfig/*.pc (5 binary packages)
 * /usr/lib/<truplet>/lib*.a (133 binary packages)

The attached patch makes lintian complain about them. Can you turn it
into something applicable?

Helmut
diff --minimal -Nru lintian-2.5.59/checks/files.desc lintian-2.5.59+nmu1/checks/files.desc
--- lintian-2.5.59/checks/files.desc	2017-11-09 09:48:00.000000000 +0100
+++ lintian-2.5.59+nmu1/checks/files.desc	2017-11-25 17:42:21.000000000 +0100
@@ -1736,7 +1736,7 @@
 
 Tag: multiarch-foreign-shared-library
 Severity: important
-Certainty: wild-guess
+Certainty: possible
 Info: The package is architecture-dependent, ships a shared library in
  a public library search path and is marked <tt>Multi-Arch:
  foreign</tt>. Typically, shared libraries are marked <tt>Multi-Arch:
@@ -1776,3 +1776,36 @@
 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 --minimal -Nru lintian-2.5.59/checks/files.pm lintian-2.5.59+nmu1/checks/files.pm
--- lintian-2.5.59/checks/files.pm	2017-11-09 09:48:00.000000000 +0100
+++ lintian-2.5.59+nmu1/checks/files.pm	2017-11-25 17:38:51.000000000 +0100
@@ -778,6 +778,17 @@
                     and not defined $link) {
                     tag 'image-file-in-usr-lib', $file;
                 }
+
+                my $multiarch_dir = $MULTIARCH_DIRS->value($arch);
+                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$,);
+                }
             }
             # ---------------- /usr/local
             elsif ($fname =~ m,^usr/local/\S+,) {

Reply to: