diff options
author | 2009-04-02 17:36:53 +0000 | |
---|---|---|
committer | 2009-04-02 17:36:53 +0000 | |
commit | ea1346cd951b91c5567d4cd1f62e16e01a142d5b (patch) | |
tree | 82555b197d486a8ecdd72f7943f9b901f145f55c /eclass | |
parent | Version bump. Fixes bug #264138. (diff) | |
download | gentoo-2-ea1346cd951b91c5567d4cd1f62e16e01a142d5b.tar.gz gentoo-2-ea1346cd951b91c5567d4cd1f62e16e01a142d5b.tar.bz2 gentoo-2-ea1346cd951b91c5567d4cd1f62e16e01a142d5b.zip |
Add prefix.eclass, after discussion on -dev, this a copy of r40431 from the prefix overlay
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/prefix.eclass | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/eclass/prefix.eclass b/eclass/prefix.eclass new file mode 100644 index 000000000000..477ce55168b3 --- /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: prefix.eclass,v 1.1 2009/04/02 17:36:53 grobian Exp $ + +# @ECLASS: prefix.eclass +# @MAINTAINER: +# Feel free to contact the Prefix team through <prefix@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 needed" + + einfo "Adjusting to prefix" + 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: |