Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: prefix.eclass
Date: Thu, 02 Apr 2009 17:36:57
Message-Id: E1LpQqT-0004bz-LX@stork.gentoo.org
1 grobian 09/04/02 17:36:53
2
3 Added: prefix.eclass
4 Log:
5 Add prefix.eclass, after discussion on -dev, this a copy of r40431 from the prefix overlay
6
7 Revision Changes Path
8 1.1 eclass/prefix.eclass
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/prefix.eclass?rev=1.1&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/prefix.eclass?rev=1.1&content-type=text/plain
12
13 Index: prefix.eclass
14 ===================================================================
15 # Copyright 1999-2009 Gentoo Foundation
16 # Distributed under the terms of the GNU General Public License v2
17 # $Id: prefix.eclass,v 1.1 2009/04/02 17:36:53 grobian Exp $
18
19 # @ECLASS: prefix.eclass
20 # @MAINTAINER:
21 # Feel free to contact the Prefix team through <prefix@g.o> if
22 # you have problems, suggestions or questions.
23 # @BLURB: Eclass to provide Prefix functionality
24 # @DESCRIPTION:
25 # Gentoo Prefix allows users to install into a self defined offset
26 # located somewhere in the filesystem. Prefix ebuilds require
27 # additional functions and variables which are defined by this eclass.
28
29 # @ECLASS-VARIABLE: EPREFIX
30 # @DESCRIPTION:
31 # The offset prefix of a Gentoo Prefix installation. When Gentoo Prefix
32 # is not used, ${EPREFIX} should be "". Prefix Portage sets EPREFIX,
33 # hence this eclass has nothing to do here in that case.
34 # Note that setting EPREFIX in the environment with Prefix Portage sets
35 # Portage into cross-prefix mode.
36 if [[ ! ${EPREFIX+set} ]]; then
37 export EPREFIX=''
38 fi
39
40
41 # @FUNCTION: eprefixify
42 # @USAGE: <list of to be eprefixified files>
43 # @DESCRIPTION:
44 # replaces @GENTOO_PORTAGE_EPREFIX@ with ${EPREFIX} for the given files,
45 # dies if no arguments are given, a file does not exist, or changing a
46 # file failed.
47 eprefixify() {
48 [[ $# -lt 1 ]] && die "at least one argument needed"
49
50 einfo "Adjusting to prefix"
51 local x
52 for x in "$@" ; do
53 if [[ -e ${x} ]] ; then
54 ebegin " ${x##*/}"
55 sed -i -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" "${x}"
56 eend $? || die "failed to eprefixify ${x}"
57 else
58 die "${x} does not exist"
59 fi
60 done
61
62 return 0
63 }
64
65
66 # vim: tw=72: