Package: ogre
Version: 1.7.3-5
Severity: serious
Tags: patch

When building ogre on lenny:

...
Install the project...
/usr/bin/cmake -P cmake_install.cmake
-- Install configuration: "RelWithDebInfo"
-- Installing: 
/home/sam/src/ogre/debian/ogre-1.7.3/debian/tmp/usr/include/OGRE/OgreBuildSettings.h
...
make[2]: Leaving directory 
`/home/sam/src/ogre/debian/ogre-1.7.3/obj-x86_64-linux-gnu'
sed -i "/^libdir=/ s|/lib|/lib/|" debian/tmp/usr/lib/pkgconfig/*
sed -i "/{libdir}/ s|{libdir}/OGRE|{libdir}/OGRE-1.7.3|g" 
debian/tmp/usr/lib/pkgconfig/*
mv debian/tmp/usr/lib/OGRE debian/tmp/usr/lib/OGRE-1.7.3
mkdir -p /tmp/
mv debian/tmp/usr/lib/* /tmp//
mv /tmp/ debian/tmp/usr/lib/
mv: cannot access `/tmp/.wine-115': Permission denied
mv: cannot access `/tmp/user': Permission denied
mv: cannot access `/tmp/lost+found': Permission denied
mv: cannot open `/tmp/hsperfdata_minecraft/5017' for reading: Permission denied
make[1]: *** [override_dh_auto_install] Error 1
make[1]: Leaving directory `/home/sam/src/ogre/debian/ogre-1.7.3'
make: *** [binary] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2

The override_dh_auto_install rule replies on DEB_BUILD_MULTIARCH being
set, which is not the case with dpkg-dev 1.15.8.12 from lenny. The rules
are written such that when this variable is empty, it will try to remove
the system's /tmp directory, hence the severity of this bug.

The rules can be rewritten so that they don't use /tmp at all. Aside
from fixing this bug, it also speeds the package build process up if
/tmp is on a separate filesystem. I've attached a patch that makes this
and the following changes:

 * Build-depend on dpkg-dev 1.16.0 to ensure that the multiarch dpkg
   variables are available.

 * Use DEB_HOST_MULTIARCH instead of DEB_BUILD_MULTIARCH. The former
   refers to the architecture that the package will be run on;
   the latter is the architecture that it's built on. In a hypothetical
   cross-compiling situation, the two would not be equal.

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (530, 'testing'), (520, 'unstable'), (510, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru ogre-1.7.3/debian/control ogre-1.7.3/debian/control
--- ogre-1.7.3/debian/control	2011-12-23 12:03:49.000000000 +0000
+++ ogre-1.7.3/debian/control	2012-01-30 17:21:29.000000000 +0000
@@ -4,7 +4,7 @@
 Maintainer: Manuel A. Fernandez Montecelo <manuel.montez...@gmail.com>
 Uploaders: Debian Games Team <pkg-games-de...@lists.alioth.debian.org>
 DM-Upload-Allowed: yes
-Build-Depends: debhelper (>= 8.9.0~), cmake (>= 2.8.5), pkg-config, libboost-date-time-dev, libboost-thread-dev, libfreeimage-dev, libfreetype6-dev, libzzip-dev, zlib1g-dev, libz-dev, libglu1-mesa-dev | libglu-dev, libgl1-mesa-dev | libgl-dev, libxrandr-dev, libxxf86vm-dev, libxaw7-dev, libxt-dev, chrpath
+Build-Depends: debhelper (>= 8.9.0~), dpkg-dev (>= 1.16.0), cmake (>= 2.8.5), pkg-config, libboost-date-time-dev, libboost-thread-dev, libfreeimage-dev, libfreetype6-dev, libzzip-dev, zlib1g-dev, libz-dev, libglu1-mesa-dev | libglu-dev, libgl1-mesa-dev | libgl-dev, libxrandr-dev, libxxf86vm-dev, libxaw7-dev, libxt-dev, chrpath
 Standards-Version: 3.9.2
 Homepage: http://ogre3d.org/
 
diff -Nru ogre-1.7.3/debian/rules ogre-1.7.3/debian/rules
--- ogre-1.7.3/debian/rules	2012-01-17 22:31:06.000000000 +0000
+++ ogre-1.7.3/debian/rules	2012-01-30 19:11:55.000000000 +0000
@@ -44,7 +44,7 @@
 
         # Workaround for CMake and debhelper with mutiarch (Debian bug:
         # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=641051 )
-	sed -i "/^libdir=/ s|/lib|/lib/$(DEB_BUILD_MULTIARCH)|" debian/tmp/usr/lib/pkgconfig/*
+	sed -i "/^libdir=/ s|/lib|/lib/$(DEB_HOST_MULTIARCH)|" debian/tmp/usr/lib/pkgconfig/*
 	sed -i "/{libdir}/ s|{libdir}/OGRE|{libdir}/OGRE-$(OGRE_VERSION)|g" debian/tmp/usr/lib/pkgconfig/*
 
         # More fixes for multi-arch introduced in 1.7.3-5, and attempt at using
@@ -52,21 +52,20 @@
         # be installed at once)
 	mv debian/tmp/usr/lib/OGRE debian/tmp/usr/lib/OGRE-$(OGRE_VERSION)
 
-	mkdir -p /tmp/$(DEB_BUILD_MULTIARCH)
-	mv debian/tmp/usr/lib/* /tmp/$(DEB_BUILD_MULTIARCH)/
-	mv /tmp/$(DEB_BUILD_MULTIARCH) debian/tmp/usr/lib/
+	mkdir -p debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)
+	find debian/tmp/usr/lib -mindepth 1 -maxdepth 1 ! -name $(DEB_HOST_MULTIARCH) -exec mv -v {} debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH) ';'
 
         # multi-arch/rpath issue with lintian:
         # E: libogre-1.7.3: binary-or-shlib-defines-rpath usr/lib/x86_64-linux-gnu/OGRE/Plugin_OctreeZone.so /usr/lib/OGRE
-	chrpath --replace "/usr/lib/$(DEB_BUILD_MULTIARCH)/OGRE-$(OGRE_VERSION)" debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/OGRE-$(OGRE_VERSION)/Plugin_OctreeZone.so
+	chrpath --replace "/usr/lib/$(DEB_HOST_MULTIARCH)/OGRE-$(OGRE_VERSION)" debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/OGRE-$(OGRE_VERSION)/Plugin_OctreeZone.so
 
 override_dh_install:
-	dh_install --fail-missing
+	dh_install --list-missing
 
         # More fixes for multi-arch introduced in 1.7.3-5, and attempt at using
         # versioned files for plugins and config files (so several versions can
         # be installed at once)
-	sed -i "/^PluginFolder=/ s|MULTIARCH_TRIPLET/OGRE_VERSION|$(DEB_BUILD_MULTIARCH)/OGRE-$(OGRE_VERSION)|" debian/libogre-$(OGRE_VERSION)/etc/OGRE/plugins.cfg
+	sed -i "/^PluginFolder=/ s|MULTIARCH_TRIPLET/OGRE_VERSION|$(DEB_HOST_MULTIARCH)/OGRE-$(OGRE_VERSION)|" debian/libogre-$(OGRE_VERSION)/etc/OGRE/plugins.cfg
 	mv debian/libogre-$(OGRE_VERSION)/etc/OGRE debian/libogre-$(OGRE_VERSION)/etc/OGRE-$(OGRE_VERSION)
 
 override_dh_installchangelogs:

Reply via email to