Package: nocache
Version: 1.0-1
Severity: normal
Tags: patch

Dear Maintainer,

To be effective for all enabled arches (e.g. with i386 cp and amd64 lrzip, `nocache lrzip foo; nocache cp foo.lrz /path/to/`, nocache must be multi-arch co-installable. It is currently not (either you have it for i386 [and it is of no use for amd64], or you have it amd64 [and it is of no use for i386]).

Attached (somewhat hackish) patch fixes this (splits nocache to `M-A: foreign` main package containing binaries and wrapper script, and `M-A: same` libnocache package [supposed to be co-installed for all enabled architectures]; Alternative layout can be main `M-A: same` package containing /usr/bin/nocache and /usr/lib/*/nocache/*, and split off /usr/bin/cache* binaries to separate `M-A: foreign` package.

FIXME: only checked on linux; no idea if hurd/kfreebsd ld.so also
supports $LIB (and multi-arch).

-- System Information:
Debian Release: 8.8
  APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable'), (100, 'proposed-updates')
Architecture: i386 (x86_64)
Foreign Architectures: amd64

Kernel: Linux 3.16.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages nocache depends on:
ii  libc6              2.19-18+deb8u9
ii  multiarch-support  2.19-18+deb8u9

nocache recommends no packages.

nocache suggests no packages.

-- no debconf information

diff -Nru nocache-1.0/debian/changelog nocache-1.0/debian/changelog
--- nocache-1.0/debian/changelog	2016-05-21 07:18:22.000000000 +0300
+++ nocache-1.0/debian/changelog	2017-05-31 16:27:47.000000000 +0300
@@ -1,3 +1,10 @@
+nocache (1.0-1.1) UNRELEASED; urgency=medium
+
+  * Add Multi-Arch support.
+
+ -- Yuriy M. Kaminskiy <[email protected]>  Wed, 31 May 2017 15:23:17 +0300
+
 nocache (1.0-1) unstable; urgency=medium
 
   * New upstream release [May 2016].
diff -Nru nocache-1.0/debian/control nocache-1.0/debian/control
--- nocache-1.0/debian/control	2016-05-21 07:10:04.000000000 +0300
+++ nocache-1.0/debian/control	2017-05-31 16:30:36.000000000 +0300
@@ -12,7 +12,8 @@
 
 Package: nocache
 Architecture: any
-Depends: ${misc:Depends}, ${shlibs:Depends}
+Multi-Arch: foreign
+Depends: ${misc:Depends}, ${shlibs:Depends}, libnocache (= ${binary:Version})
 Description: bypass/minimize file system caching for a program
  `nocache` tries to minimize the effect an application has on the Linux
  file system cache.
@@ -23,3 +24,18 @@
  Also this package provides the following utilities:
  * `cachedel`   : clear page cache for a file.
  * `cachestats` : print number of cached vs. not-cached pages for a file
+
+Package: libnocache
+Architecture: any
+Multi-Arch: same
+Pre-Depends: ${misc:Pre-Depends}
+Depends: ${misc:Depends}, ${shlibs:Depends}
+Description: bypass/minimize file system caching for a program - library
+ `nocache` tries to minimize the effect an application has on the Linux
+ file system cache.
+ .
+ Use case: backup processes that should not interfere with the present
+ state of the cache.
+ .
+ This package contains (multi-arch) shared library for nocache (should
+ be installed in all enabled architectures).
diff -Nru nocache-1.0/debian/libnocache.install nocache-1.0/debian/libnocache.install
--- nocache-1.0/debian/libnocache.install	1970-01-01 03:00:00.000000000 +0300
+++ nocache-1.0/debian/libnocache.install	2017-05-31 16:25:42.000000000 +0300
@@ -0,0 +1 @@
+usr/lib/*/nocache/*.so
diff -Nru nocache-1.0/debian/manpages nocache-1.0/debian/manpages
--- nocache-1.0/debian/manpages	2013-05-02 05:49:40.000000000 +0400
+++ nocache-1.0/debian/manpages	1970-01-01 03:00:00.000000000 +0300
@@ -1 +0,0 @@
-man/*.1
diff -Nru nocache-1.0/debian/nocache.install nocache-1.0/debian/nocache.install
--- nocache-1.0/debian/nocache.install	1970-01-01 03:00:00.000000000 +0300
+++ nocache-1.0/debian/nocache.install	2017-05-31 16:25:58.000000000 +0300
@@ -0,0 +1 @@
+usr/bin/*
diff -Nru nocache-1.0/debian/nocache.manpages nocache-1.0/debian/nocache.manpages
--- nocache-1.0/debian/nocache.manpages	1970-01-01 03:00:00.000000000 +0300
+++ nocache-1.0/debian/nocache.manpages	2013-05-02 05:49:40.000000000 +0400
@@ -0,0 +1 @@
+man/*.1
diff -Nru nocache-1.0/debian/rules nocache-1.0/debian/rules
--- nocache-1.0/debian/rules	2016-05-21 07:16:55.000000000 +0300
+++ nocache-1.0/debian/rules	2017-05-31 16:27:30.000000000 +0300
@@ -4,14 +4,17 @@
 #export DH_VERBOSE=1
 
 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
 
 %:
 	dh $@
 
 override_dh_auto_install:
-	dh_auto_install -v -- PREFIX=/usr LIBDIR=/lib/$(PKG)
+	dh_auto_install -v -- PREFIX=/usr LIBDIR=/lib/$(DEB_HOST_MULTIARCH)/$(PKG)
+	# make script multi-arch co-installable, see man ld.so(8) /Rpath token expansion
+	sed -i 's,lib/$(DEB_HOST_MULTIARCH)/,\\$$LIB/,' $(CURDIR)/debian/tmp/usr/bin/$(PKG)
 	# check if wrapper built for correct PREFIX and LIBDIR
-	[ -n "$$(grep '/usr/lib/$(PKG)/$(PKG)' $(CURDIR)/debian/$(PKG)/usr/bin/$(PKG))" ]
+	[ -n "$$(grep '/usr/\\[$$]LIB/$(PKG)/$(PKG)' $(CURDIR)/debian/tmp/usr/bin/$(PKG))" ]
 
 override_dh_auto_test:
 #	-NOCACHE_NR_FADVISE=2 dh_auto_test -v

Reply via email to