sys-apps/baselayout: Live ebuild cleanups:
authorWilliam Hubbs <williamh@gentoo.org>
Wed, 7 Feb 2018 19:49:41 +0000 (13:49 -0600)
committerWilliam Hubbs <williamh@gentoo.org>
Wed, 7 Feb 2018 19:51:03 +0000 (13:51 -0600)
- run layout targets in src_install
- call multilib_layout only in pkg_setup
- remove some baselayout-1.x migration code from pkg_preinst/pkg_postinst

Package-Manager: Portage-2.3.19, Repoman-2.3.6

sys-apps/baselayout/baselayout-9999.ebuild

index 4622672eb5ba9acfe786fc2af5544eb2122f2fbb..20a7143a7421b01f6f90dd21012983ec2e9bca44 100644 (file)
@@ -18,11 +18,7 @@ fi
 
 LICENSE="GPL-2"
 SLOT="0"
-IUSE="build usrmerge kernel_linux"
-
-pkg_setup() {
-       multilib_layout
-}
+IUSE="usrmerge kernel_linux"
 
 # Create our multilib dirs - the Makefile has no knowledge of this
 multilib_layout() {
@@ -136,31 +132,15 @@ multilib_layout() {
        fi
 }
 
-pkg_preinst() {
-       # Bug #217848 - Since the remap_dns_vars() called by pkg_preinst() of
-       # the baselayout-1.x ebuild copies all the real configs from the user's
-       # /etc/conf.d into ${D}, it makes them all appear to be the default
-       # versions. In order to protect them from being unmerged after this
-       # upgrade, modify their timestamps.
-       touch "${EROOT}"/etc/conf.d/* 2>/dev/null
+pkg_setup() {
+       multilib_layout
+}
 
+pkg_preinst() {
        # This is written in src_install (so it's in CONTENTS), but punt all
        # pending updates to avoid user having to do etc-update (and make the
        # pkg_postinst logic simpler).
        rm -f "${EROOT}"/etc/._cfg????_gentoo-release
-
-       # We need to install directories and maybe some dev nodes when building
-       # stages, but they cannot be in CONTENTS.
-       # Also, we cannot reference $S as binpkg will break so we do this.
-       multilib_layout
-       if use build ; then
-               if ! use usrmerge; then
-                       emake -C "${ED}/usr/share/${PN}" DESTDIR="${EROOT}" layout
-               else
-                       emake -C "${ED}/usr/share/${PN}" DESTDIR="${EROOT}" layout-usrmerge
-               fi
-       fi
-       rm -f "${ED}"/usr/share/${PN}/Makefile
 }
 
 src_prepare() {
@@ -190,15 +170,22 @@ src_prepare() {
 }
 
 src_install() {
+       if ! use usrmerge; then
+               emake \
+                       OS=$(usex kernel_FreeBSD BSD Linux) \
+                       DESTDIR="${ED}" \
+                       layout
+       else
+               emake \
+                       OS=$(usex kernel_FreeBSD BSD Linux) \
+                       DESTDIR="${ED}" \
+                       layout-usrmerge
+       fi
        emake \
                OS=$(usex kernel_FreeBSD BSD Linux) \
                DESTDIR="${ED}" \
                install
        dodoc ChangeLog
-
-       # need the makefile in pkg_preinst
-       insinto /usr/share/${PN}
-       doins Makefile
 }
 
 pkg_postinst() {
@@ -235,10 +222,6 @@ pkg_postinst() {
                fi
        fi
 
-       # baselayout leaves behind a lot of .keep files, so let's clean them up
-       find "${EROOT}"lib*/rcscripts/ -name .keep -exec rm -f {} + 2>/dev/null
-       find "${EROOT}"lib*/rcscripts/ -depth -type d -exec rmdir {} + 2>/dev/null
-
        # whine about users with invalid shells #215698
        if [[ -e "${EROOT}"etc/passwd ]] ; then
                local bad_shells=$(awk -F: 'system("test -e " $7) { print $1 " - " $7}' "${EROOT}"etc/passwd | sort)