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

Bug#767754: new check: file-in-root-and-usr



I updated the patch as discussed, by:
- splitting it in two checks, for libraries and regular files
- referring to a wiki page with example maintainer scripts

> You do not check if md5sum of both file are equal. If the file are
> different I think it deserve another tags....
I amended the text to make clear that removing one of the files is an 
option.
I do not think that a different tag is really useful because it is not 
the content of the files that matters and even if they are really 
different (there are no such cases in the archive) no generic advice is 
possible.

-- 
ciao,
Marco
diff --git a/checks/usrmerge.desc b/checks/usrmerge.desc
new file mode 100644
index 0000000..9aeae48
--- /dev/null
+++ b/checks/usrmerge.desc
@@ -0,0 +1,32 @@
+Check-Script: usrmerge
+Author: Marco d'Itri <md@linux.it>
+Abbrev: usr
+Type: binary
+Needs-Info: unpacked
+Info: This script checks for files with the same name installed in / and /usr.
+
+Tag: file-in-root-and-usr
+Severity: important
+Certainty: certain
+Info: The package ships two files with the same name installed both in
+ /{bin,sbin,lib*}/ and /usr/{bin,sbin,lib*}/.
+ This is incompatible with the merged /usr directories scheme.
+ .
+ Packages with conflicting files must remove one of them if possible or
+ make it a symlink to the other and manage the links in the maintainer
+ scripts.
+Ref: https://wiki.debian.org/UsrMerge,
+     http://anonscm.debian.org/cgit/users/md/usrmerge.git/plain/debian/README.Debian
+
+Tag: library-in-root-and-usr
+Severity: important
+Certainty: certain
+Info: The package ships two files with the same name installed both in
+ /lib*/ and /usr/lib*/ (or their subdirectories).
+ This is not useful and is incompatible with the merged /usr directories
+ scheme.
+ .
+ Shared library files, both static and dynamic, must be installed in
+ the correct directories as documented in Policy 8.1.
+Ref: https://wiki.debian.org/UsrMerge,
+     policy 8.1
diff --git a/checks/usrmerge.pm b/checks/usrmerge.pm
new file mode 100644
index 0000000..d35ff7d
--- /dev/null
+++ b/checks/usrmerge.pm
@@ -0,0 +1,52 @@
+# usrmerge -- lintian check script -*- perl -*-
+
+# Copyright (C) 2016 Marco d'Itri
+#
+# 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::usrmerge;
+use strict;
+use warnings;
+use autodie;
+
+use Lintian::Tags qw(tag);
+
+sub run {
+    my (undef, undef, $info) = @_;
+
+    foreach my $file1 ($info->sorted_index) {
+        next unless $file1 =~ m,^(?:s?bin|lib(?:|[ox]?32|64))/,;
+        my $file2 = $info->index("usr/$file1") or next;
+        next if $file1->is_dir and $file2->is_dir;
+
+        if ($file1 =~ m,^lib.+\.(?:so[\.0-9]*|a)$,) {
+            tag 'library-in-root-and-usr', $file1, $file2;
+        } else {
+            tag 'file-in-root-and-usr', $file1, $file2;
+        }
+    }
+
+    return;
+}
+
+1;
+
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 sts=4 sr et
diff --git a/profiles/debian/main.profile b/profiles/debian/main.profile
index d28bf3e..92adb0d 100644
--- a/profiles/debian/main.profile
+++ b/profiles/debian/main.profile
@@ -8,6 +8,6 @@ Enable-Tags-From-Check: apache2, application-not-library, automake, binaries,
  group-checks, huge-usr-share, infofiles, init.d, java, lintian, manpages,
  md5sums, menu-format, menus, nmu, obsolete-sites, ocaml, patch-systems, phppear,
  po-debconf, rules, scripts, shared-libs, source-copyright, standards-version,
- symlinks, systemd, testsuite, version-substvars, watch-file
+ symlinks, systemd, testsuite, usrmerge, version-substvars, watch-file
 Disable-Tags: hardening-no-stackprotector
 

Attachment: signature.asc
Description: PGP signature


Reply to: