From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.60)
	(envelope-from <gentoo-commits+bounces-426611-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1RxDpx-0007eu-JQ
	for garchives@archives.gentoo.org; Tue, 14 Feb 2012 08:34:09 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 14172E081B;
	Tue, 14 Feb 2012 08:34:02 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id CA7AEE081B
	for <gentoo-commits@lists.gentoo.org>; Tue, 14 Feb 2012 08:34:01 +0000 (UTC)
Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 143761B4004
	for <gentoo-commits@lists.gentoo.org>; Tue, 14 Feb 2012 08:34:01 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by hornbill.gentoo.org (Postfix) with ESMTP id C0C43E5400
	for <gentoo-commits@lists.gentoo.org>; Tue, 14 Feb 2012 08:33:59 +0000 (UTC)
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" <robbat2@gentoo.org>
Message-ID: <1329208306.265363f79df5a545dc47547dbee76972b387e9b7.robbat2@gentoo>
Subject: [gentoo-commits] proj/genkernel:master commit in: /
X-VCS-Repository: proj/genkernel
X-VCS-Files: ChangeLog gen_compile.sh gen_initramfs.sh
X-VCS-Directories: /
X-VCS-Committer: robbat2
X-VCS-Committer-Name: Robin H. Johnson
X-VCS-Revision: 265363f79df5a545dc47547dbee76972b387e9b7
X-VCS-Branch: master
Date: Tue, 14 Feb 2012 08:33:59 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: quoted-printable
X-Archives-Salt: 50692527-0a26-4a1c-ae95-3bfc304cd8de
X-Archives-Hash: 7900b0a69e0d65d00538969764841fb7

commit:     265363f79df5a545dc47547dbee76972b387e9b7
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 14 08:31:46 2012 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Tue Feb 14 08:31:46 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=3Dproj/genkernel.git=
;a=3Dcommit;h=3D265363f7

Fix dmraid building with LVM/device-mapper

dmraid is entirely broken if you try to use the system static
LVM/device-mapper. Instead, always build our own LVM2 for the initramfs,
using DESTDIR for cleaner install. Dead code paths for old LVM2 build
not removed yet until more users have tested.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

---
 ChangeLog        |    7 +++++++
 gen_compile.sh   |   39 +++++++++++++++++++++------------------
 gen_initramfs.sh |    5 +++--
 3 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 41db029..e5c391b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,13 @@
 # Distributed under the GPL v2
 # $Id$
=20
+  14 Feb 2012; Robin H. Johnson <robbat2@gentoo.org> gen_compile.sh,
+  gen_initramfs.sh:
+  dmraid is entirely broken if you try to use the system static
+  LVM/device-mapper. Instead start always building LVM2 for the initramf=
s,
+  using DESTDIR for cleaner install. Dead code paths for old LVM2 build =
not
+  removed yet until more users have tested.
+
   12 Feb 2012; Robin H. Johnson <robbat2@gentoo.org> gen_compile.sh:
   More UTILS_CROSS_COMPILE prefix on strip calls.
=20

diff --git a/gen_compile.sh b/gen_compile.sh
index bc93be8..646e0ef 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -406,7 +406,7 @@ compile_busybox() {
 		/bin/tar -jxpf ${BUSYBOX_SRCTAR} ||
 			gen_die 'Could not extract busybox source tarball!'
 		[ -d "${BUSYBOX_DIR}" ] ||
-			gen_die 'Busybox directory ${BUSYBOX_DIR} is invalid!'
+			gen_die "Busybox directory ${BUSYBOX_DIR} is invalid!"
 		cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config"
 		cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config.gk_orig"
 		cd "${BUSYBOX_DIR}"
@@ -441,19 +441,20 @@ compile_lvm() {
 		/bin/tar -zxpf ${LVM_SRCTAR} ||
 			gen_die 'Could not extract LVM source tarball!'
 		[ -d "${LVM_DIR}" ] ||
-			gen_die 'LVM directory ${LVM_DIR} is invalid!'
+			gen_die "LVM directory ${LVM_DIR} is invalid!"
 		cd "${LVM_DIR}"
 		apply_patches lvm ${LVM_VER}
 		print_info 1 'lvm: >> Configuring...'
 			CFLAGS=3D"-fPIC" \
-			./configure --enable-static_link --prefix=3D${TEMP}/lvm \
+			./configure --enable-static_link --prefix=3D/ \
 				--with-lvm1=3Dinternal --with-clvmd=3Dnone --with-cluster=3Dnone \
 				--disable-readline --disable-selinux --with-mirrors=3Dinternal \
-				--with-snapshots=3Dinternal --with-pool=3Dinternal >> ${LOGFILE} 2>&=
1 || \
+				--with-snapshots=3Dinternal --with-pool=3Dinternal \
+				>> ${LOGFILE} 2>&1 || \
 				gen_die 'Configure of lvm failed!'
 		print_info 1 'lvm: >> Compiling...'
-			compile_generic '' utils
-			compile_generic 'install' utils
+		compile_generic '' utils
+		compile_generic "install DESTDIR=3D${TEMP}/lvm/" utils
=20
 		cd "${TEMP}/lvm"
 		print_info 1 '      >> Copying to bincache...'
@@ -462,11 +463,11 @@ compile_lvm() {
 		# See bug 382555
 		${UTILS_CROSS_COMPILE}strip "sbin/dmsetup.static" ||
 			gen_die 'Could not strip dmsetup.static'
-		/bin/tar -cjf "${LVM_BINCACHE}" sbin/lvm.static sbin/dmsetup.static ||
+		/bin/tar -cjf "${LVM_BINCACHE}" . ||
 			gen_die 'Could not create binary cache'
=20
 		cd "${TEMP}"
-		rm -rf "${TEMP}/device-mapper" > /dev/null
+		rm -rf "${TEMP}/lvm" > /dev/null
 		rm -rf "${LVM_DIR}" lvm
 	fi
 }
@@ -483,7 +484,7 @@ compile_mdadm() {
 		/bin/tar -jxpf "${MDADM_SRCTAR}" ||
 			gen_die 'Could not extract MDADM source tarball!'
 		[ -d "${MDADM_DIR}" ] ||
-			gen_die 'MDADM directory ${MDADM_DIR} is invalid!'
+			gen_die "MDADM directory ${MDADM_DIR} is invalid!"
=20
 		cd "${MDADM_DIR}"
 		apply_patches mdadm ${MDADM_VER}
@@ -521,24 +522,26 @@ compile_dmraid() {
 		/bin/tar -jxpf ${DMRAID_SRCTAR} ||
 			gen_die 'Could not extract DMRAID source tarball!'
 		[ -d "${DMRAID_DIR}" ] ||
-			gen_die 'DMRAID directory ${DMRAID_DIR} is invalid!'
-		rm -rf "${TEMP}/device-mapper" > /dev/null
-		/bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
-			gen_die "Could not extract device-mapper binary cache!";
+			gen_die "DMRAID directory ${DMRAID_DIR} is invalid!"
+		rm -rf "${TEMP}/lvm" > /dev/null
+		mkdir -p "${TEMP}/lvm"
+		/bin/tar -jxpf "${LVM_BINCACHE}" -C "${TEMP}/lvm" ||
+			gen_die "Could not extract LVM2 binary cache!";
=20
 		cd "${DMRAID_DIR}"
 		apply_patches dmraid ${DMRAID_VER}
 		print_info 1 'dmraid: >> Configuring...'
=20
-		LDFLAGS=3D"-L${TEMP}/device-mapper/lib" \
-		CFLAGS=3D"-I${TEMP}/device-mapper/include" \
-		CPPFLAGS=3D"-I${TEMP}/device-mapper/include" \
+		LDFLAGS=3D"-L${TEMP}/lvm/lib" \
+		CFLAGS=3D"-I${TEMP}/lvm/include" \
+		CPPFLAGS=3D"-I${TEMP}/lvm/include" \
+		LIBS=3D"-ldevmapper" \
 		./configure --enable-static_link --prefix=3D${TEMP}/dmraid >> ${LOGFIL=
E} 2>&1 ||
 			gen_die 'Configure of dmraid failed!'
=20
 		# We dont necessarily have selinux installed yet... look into
 		# selinux global support in the future.
-		sed -i tools/Makefile -e "s|DMRAIDLIBS +=3D -lselinux||g"
+		sed -i tools/Makefile -e "/DMRAID_LIBS +=3D/s|-lselinux||g"
 		###echo "DMRAIDLIBS +=3D -lselinux -lsepol" >> tools/Makefile
 		mkdir -p "${TEMP}/dmraid"
 		print_info 1 'dmraid: >> Compiling...'
@@ -553,7 +556,7 @@ compile_dmraid() {
 			gen_die 'Could not create binary cache'
=20
 		cd "${TEMP}"
-		rm -rf "${TEMP}/device-mapper" > /dev/null
+		rm -rf "${TEMP}/lvm" > /dev/null
 		rm -rf "${DMRAID_DIR}" dmraid
 	fi
 }

diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index 5704173..9a17b3a 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -235,7 +235,7 @@ append_lvm(){
 	cd ${TEMP}
 	mkdir -p "${TEMP}/initramfs-lvm-temp/bin/"
 	mkdir -p "${TEMP}/initramfs-lvm-temp/etc/lvm/"
-	if [ -e '/sbin/lvm.static' ]
+	if false && [ -e '/sbin/lvm.static' ]
 	then
 		print_info 1 '          LVM: Adding support (using local static binary=
 /sbin/lvm.static)...'
 		cp /sbin/lvm.static "${TEMP}/initramfs-lvm-temp/bin/lvm" ||
@@ -245,7 +245,7 @@ append_lvm(){
 		then
 			cp /sbin/dmsetup.static "${TEMP}/initramfs-lvm-temp/bin/dmsetup"
 		fi
-	elif [ -e '/sbin/lvm' ] && LC_ALL=3D"C" ldd /sbin/lvm|grep -q 'not a dy=
namic executable'
+	elif false && [ -e '/sbin/lvm' ] && LC_ALL=3D"C" ldd /sbin/lvm|grep -q =
'not a dynamic executable'
 	then
 		print_info 1 '          LVM: Adding support (using local static binary=
 /sbin/lvm)...'
 		cp /sbin/lvm "${TEMP}/initramfs-lvm-temp/bin/lvm" ||
@@ -265,6 +265,7 @@ append_lvm(){
 		# See bug 382555
 		mv ${TEMP}/initramfs-lvm-temp/sbin/dmsetup.static ${TEMP}/initramfs-lv=
m-temp/bin/dmsetup ||
 			gen_die 'LVM error: Could not move dmsetup.static to dmsetup!'
+		rm -rf  ${TEMP}/initramfs-lvm-temp/{lib,share,man,include,sbin/{lvm,dm=
setup}}
 	fi
 	if [ -x /sbin/lvm ]
 	then