commit: eae808b55c1155d75825122ed5d875f7bf277c86 Author: Benda Xu <heroxbd <AT> gentoo <DOT> org> AuthorDate: Sun May 22 04:03:01 2016 +0000 Commit: Benda XU <heroxbd <AT> gentoo <DOT> org> CommitDate: Sun May 22 04:03:01 2016 +0000 URL: https://gitweb.gentoo.org/dev/heroxbd.git/commit/?id=eae808b5
Revert "prefix.eclass: merged" This reverts commit abe0e1cb5fc08292397e3c38895185ec9481c9dc. eclass/prefix.eclass | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/eclass/prefix.eclass b/eclass/prefix.eclass new file mode 100644 index 0000000..1f3c4b0 --- /dev/null +++ b/eclass/prefix.eclass @@ -0,0 +1,52 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# @ECLASS: prefix.eclass +# @MAINTAINER: +# Feel free to contact the Prefix team through <pre...@gentoo.org> if +# you have problems, suggestions or questions. +# @BLURB: Eclass to provide Prefix functionality +# @DESCRIPTION: +# Gentoo Prefix allows users to install into a self defined offset +# located somewhere in the filesystem. Prefix ebuilds require +# additional functions and variables which are defined by this eclass. + +# @ECLASS-VARIABLE: EPREFIX +# @DESCRIPTION: +# The offset prefix of a Gentoo Prefix installation. When Gentoo Prefix +# is not used, ${EPREFIX} should be "". Prefix Portage sets EPREFIX, +# hence this eclass has nothing to do here in that case. +# Note that setting EPREFIX in the environment with Prefix Portage sets +# Portage into cross-prefix mode. +if [[ ! ${EPREFIX+set} ]]; then + export EPREFIX='' +fi + + +# @FUNCTION: eprefixify +# @USAGE: <list of to be eprefixified files> +# @DESCRIPTION: +# replaces @GENTOO_PORTAGE_EPREFIX@ with ${EPREFIX} for the given files, +# dies if no arguments are given, a file does not exist, or changing a +# file failed. +eprefixify() { + [[ $# -lt 1 ]] && die "at least one argument required" + + einfo "Adjusting to prefix ${EPREFIX:-/}" + local x + for x in "$@" ; do + if [[ -e ${x} ]] ; then + ebegin " ${x##*/}" + sed -i -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" "${x}" + eend $? || die "failed to eprefixify ${x}" + else + die "${x} does not exist" + fi + done + + return 0 +} + + +# vim: tw=72: