commit: 31a136c9efad8a9a6f3694f01d0df06138b0fc52 Author: Benda Xu <heroxbd <AT> gentoo <DOT> org> AuthorDate: Sun Nov 19 04:55:03 2017 +0000 Commit: Benda XU <heroxbd <AT> gentoo <DOT> org> CommitDate: Sun Nov 26 01:05:43 2017 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=31a136c9
db.eclass: support Prefix ROOT and D are replaced with EROOT and ED. eclass/db.eclass | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/eclass/db.eclass b/eclass/db.eclass index c46c431ea9c..5227601c456 100644 --- a/eclass/db.eclass +++ b/eclass/db.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # @ECLASS: db.eclass @@ -17,7 +17,8 @@ DEPEND="test? ( >=dev-lang/tcl-8.4 )" RDEPEND="" db_fix_so() { - LIB="${ROOT}/usr/$(get_libdir)" + has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}" + LIB="${EROOT}/usr/$(get_libdir)" cd "${LIB}" @@ -50,7 +51,7 @@ db_fix_so() { # do the same for headers now # but since there are only two of them, just overwrite them - cd "${ROOT}"/usr/include + cd "${EROOT}"/usr/include target=`find . -maxdepth 1 -type d -name 'db[0-9]*' | sort -n |cut -d/ -f2- | tail -n1` if [ -n "${target}" ] && [ -e "${target}/db.h" ] && ( ! [[ -e db.h ]] || [[ -h db.h ]] ); then einfo "Creating db.h symlinks to ${target}" @@ -67,19 +68,21 @@ db_fix_so() { } db_src_install_doc() { + has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}" # not everybody wants this wad of documentation as it is primarily API docs if use doc; then dodir /usr/share/doc/${PF}/html - mv "${D}"/usr/docs/* "${D}"/usr/share/doc/${PF}/html/ - rm -rf "${D}"/usr/docs + mv "${ED}"/usr/docs/* "${ED}"/usr/share/doc/${PF}/html/ + rm -rf "${ED}"/usr/docs else - rm -rf "${D}"/usr/docs + rm -rf "${ED}"/usr/docs fi db_src_install_examples } db_src_install_examples() { + has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}" if use examples ; then local langs="c cxx stl" [[ "${IUSE/java}" != "${IUSE}" ]] \ @@ -90,15 +93,16 @@ db_src_install_examples() { src="${S}/../examples_${i}/" if [ -f "${src}" ]; then dodir "${destdir}" - cp -ra "${src}" "${D}${destdir}/" + cp -ra "${src}" "${ED}${destdir}/" fi done fi } db_src_install_usrbinslot() { + has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}" # slot all program names to avoid overwriting - for fname in "${D}"/usr/bin/db* + for fname in "${ED}"/usr/bin/db* do dn="$(dirname "${fname}")" bn="$(basename "${fname}")" @@ -109,18 +113,20 @@ db_src_install_usrbinslot() { } db_src_install_headerslot() { + has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}" # install all headers in a slotted location dodir /usr/include/db${SLOT} - mv "${D}"/usr/include/*.h "${D}"/usr/include/db${SLOT}/ + mv "${ED}"/usr/include/*.h "${ED}"/usr/include/db${SLOT}/ } db_src_install_usrlibcleanup() { - LIB="${D}/usr/$(get_libdir)" + has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}" + LIB="${ED}/usr/$(get_libdir)" # Clean out the symlinks so that they will not be recorded in the # contents (bug #60732) - if [ "${D}" = "" ]; then - die "Calling clean_links while \$D not defined" + if [ "${ED}" = "" ]; then + die "Calling clean_links while \$ED not defined" fi if [ -e "${LIB}"/libdb.a ] && [ ! -e "${LIB}"/libdb-${SLOT}.a ]; then @@ -139,7 +145,7 @@ db_src_install_usrlibcleanup() { find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -exec rm \{} \; rm -f \ - "${D}"/usr/include/{db,db_185}.h \ + "${ED}"/usr/include/{db,db_185}.h \ "${LIB}"/libdb{,_{cxx,sql,stl,java,tcl}}.a }