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

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



---
 checks/usrmerge.desc         | 17 ++++++++++++++++
 checks/usrmerge.pm           | 47 ++++++++++++++++++++++++++++++++++++++++++++
 profiles/debian/main.profile |  2 +-
 3 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100644 checks/usrmerge.desc
 create mode 100644 checks/usrmerge.pm

diff --git a/checks/usrmerge.desc b/checks/usrmerge.desc
new file mode 100644
index 0000000..33ae8d4
--- /dev/null
+++ b/checks/usrmerge.desc
@@ -0,0 +1,17 @@
+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 the two (or more) files with the same name
+ installed both in /{bin,sbin,lib*}/ and /usr/{bin,sbin,lib*}/.
+ This is incompatible with the everything-in-usr directories scheme.
+ .
+ Packages which need to do this must create in postinst one of the files
+ to be a symbolic link to the other one.
+Ref: http://anonscm.debian.org/cgit/users/md/usrmerge.git/plain/debian/README.Debian
diff --git a/checks/usrmerge.pm b/checks/usrmerge.pm
new file mode 100644
index 0000000..e222c9a
--- /dev/null
+++ b/checks/usrmerge.pm
@@ -0,0 +1,47 @@
+# usrmerge -- lintian check script -*- perl -*-
+
+# Copyright (C) 2014 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(?:|x?32|64))/,;
+        my $file2 = $info->index("usr/$file1") or next;
+
+        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 7c27ff3..f9bd6fb 100644
--- a/profiles/debian/main.profile
+++ b/profiles/debian/main.profile
@@ -7,7 +7,7 @@ Enable-Tags-From-Check: apache2, automake, binaries, changelog-file, changes-fil
  duplicate-files, fields, filename-length, files, group-checks, huge-usr-share,
  infofiles, init.d, java, lintian, manpages, md5sums, menu-format, menus, nmu,
  ocaml, patch-systems, phppear, po-debconf, rules, scripts, shared-libs,
- source-copyright, standards-version, symlinks, systemd, testsuite,
+ source-copyright, standards-version, symlinks, systemd, testsuite, usrmerge,
  version-substvars, watch-file
 Disable-Tags: hardening-no-stackprotector
 
-- 
2.5.0


Reply to: