diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-08-19 06:12:52 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-08-19 06:12:52 +0000 |
commit | 037bddd375cc92c3841aa169043bb5755cbd77aa (patch) | |
tree | f196b3587a5a58a4b59423d75e77eb5f3a800065 /sys-apps/baselayout | |
parent | Version bump (diff) | |
download | gentoo-2-037bddd375cc92c3841aa169043bb5755cbd77aa.tar.gz gentoo-2-037bddd375cc92c3841aa169043bb5755cbd77aa.tar.bz2 gentoo-2-037bddd375cc92c3841aa169043bb5755cbd77aa.zip |
Make the SYMLINK_LIB code in pkg_preinst merge files from lib directories
to lib64 directories when necessary, instead of blindly wiping out the
content of the lib dir. Thanks to Daniel Robbins for finding the cause of
this issue, which he discovered when building stage1 with catalyst.
(Portage version: 2.2_rc8_p11419/cvs/Linux 2.6.26-0810-x86-64 i686)
Diffstat (limited to 'sys-apps/baselayout')
-rw-r--r-- | sys-apps/baselayout/ChangeLog | 8 | ||||
-rw-r--r-- | sys-apps/baselayout/baselayout-2.0.0.ebuild | 84 |
2 files changed, 83 insertions, 9 deletions
diff --git a/sys-apps/baselayout/ChangeLog b/sys-apps/baselayout/ChangeLog index 18de376ecdd3..53985ce49e58 100644 --- a/sys-apps/baselayout/ChangeLog +++ b/sys-apps/baselayout/ChangeLog @@ -1,10 +1,16 @@ # ChangeLog for sys-apps/baselayout # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/ChangeLog,v 1.468 2008/05/10 10:03:38 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/ChangeLog,v 1.469 2008/08/19 06:12:52 zmedico Exp $ # See the rc-scripts ChangeLog in subversion for release info: # http://sources.gentoo.org/viewcvs.py/*checkout*/baselayout/trunk/ChangeLog + 19 Aug 2008; Zac Medico <zmedico@gentoo.org> baselayout-2.0.0.ebuild: + Make the SYMLINK_LIB code in pkg_preinst merge files from lib directories + to lib64 directories when necessary, instead of blindly wiping out the + content of the lib dir. Thanks to Daniel Robbins for finding the cause of + this issue, which he discovered when building stage1 with catalyst. + 10 May 2008; Mike Frysinger <vapier@gentoo.org> baselayout-2.0.0.ebuild: Install the Makefile into $D so that we can use it in pkg_preinst steps (for binpkgs) #218877 by Kevin Cody Jr. diff --git a/sys-apps/baselayout/baselayout-2.0.0.ebuild b/sys-apps/baselayout/baselayout-2.0.0.ebuild index 36ce441b3904..c2c1991d229e 100644 --- a/sys-apps/baselayout/baselayout-2.0.0.ebuild +++ b/sys-apps/baselayout/baselayout-2.0.0.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/baselayout-2.0.0.ebuild,v 1.5 2008/05/10 10:03:38 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/baselayout-2.0.0.ebuild,v 1.6 2008/08/19 06:12:52 zmedico Exp $ inherit multilib @@ -40,13 +40,81 @@ pkg_preinst() { touch "${ROOT}usr/local/${dir}"/.keep done - # Ugly compatibility with stupid ebuilds and old profiles symlinks - if [ "${SYMLINK_LIB}" = "yes" ] ; then - rm -r "${ROOT}"/{lib,usr/lib,usr/local/lib} 2>/dev/null - local lib=$(get_abi_LIBDIR ${DEFAULT_ABI}) - ln -s "${lib}" "${ROOT}lib" - ln -s "${lib}" "${ROOT}usr/lib" - ln -s "${lib}" "${ROOT}usr/local/lib" + # Create symlinks for /lib, /usr/lib, and /usr/local/lib and + # merge contents of duplicate directories if necessary. + # Only do this when $ROOT != / since it should only be necessary + # when merging to an empty $ROOT, and it's not very safe to perform + # this operation when $ROOT = /. + if [ "${SYMLINK_LIB}" = yes ] && [ "$ROOT" != / ] ; then + local prefix libabi=$(get_abi_LIBDIR $DEFAULT_ABI) + for prefix in "$ROOT"{,usr/,usr/local/} ; do + + [ ! -d "${prefix}lib" ] && rm -f "${prefix}lib" && \ + mkdir -p "${prefix}lib" + + [ ! -d "$prefix$libabi" ] && ln -sf "${prefix}lib" + + [ -h "$prefix$libabi" ] && [ -d "${prefix}lib" ] && \ + [ "$prefix$libabi" -ef "${prefix}lib" ] && continue + + local destdir=$prefix$libabi/ srcdir=${prefix}lib/ + + [ -d "$destdir" ] || die "unable to create '$destdir'" + [ -d "$srcdir" ] || die "unable to create $srcdir" + + mv -f "$srcdir".keep "$destdir".keep 2>/dev/null + if ! rmdir "$srcdir" 2>/dev/null ; then + ewarn "merging contents of '$srcdir' into '$destdir':" + + # Move directories if the dest doesn't exist. + find "$srcdir" -type d -print0 | \ + while read -d $'\0' src ; do + dest=$destdir${src#${srcdir}} + if [ ! -d "$dest" ] ; then + if [ -e "$dest" ] ; then + ewarn " not overwriting file '$dest'" \ + "with directory '$src'" + continue + fi + mv -f "$src" "$dest" && \ + ewarn " /${src#${ROOT}} merged" || \ + ewarn " /${src#${ROOT}} not merged" + fi + done + + # Move non-directories. + find "$srcdir" ! -type d -print0 | \ + while read -d $'\0' src ; do + dest=$destdir${src#${srcdir}} + if [ -e "$dest" ] ; then + if [ -d "$dest" ] ; then + ewarn " not overwriting directory '$dest'" \ + "with file '$src'" + else + if [ -f "$src" -a ! -s "$src" ] && \ + [ -f "$dest" -a ! -s "$dest" ] ; then + # Ignore empty files such as '.keep'. + true + else + ewarn " not overwriting file '$dest'" \ + "with file '$src'" + fi + fi + continue + fi + + mv -f "$src" "$dest" && \ + ewarn " /${src#${ROOT}} merged" || \ + ewarn " /${src#${ROOT}} not merged" + done + fi + + rm -rf "${prefix}lib" || \ + die "unable to remove '${prefix}lib'" + + ln -s "$libabi" "${prefix}lib" || \ + die "unable to create '${prefix}lib' symlink" + done fi emake -C "${D}/usr/share/${PN}" DESTDIR="${ROOT}" layout || die "failed to layout filesystem" |