Gentoo Logo
Gentoo Spaceship

Installation:
Gentoo Handbook
Installation Docs

Documentation:
Home
Listing
About Gentoo
Philosophy
Social Contract

Resources:
Bug Tracker
Developer List
Discussion Forums
Gentoo BitTorrents
Gentoo Linux Enhancement Proposals
IRC Channels
Mailing Lists
Mirrors
Name and Logo Guidelines
Online Package Database
Security Announcements
Staffing Needs
Supporting Vendors
View our CVS

Graphics:
Logos and themes
Icons
ScreenShots

Miscellaneous Resources:
Gentoo Linux Store
Gentoo-hosted projects
IBM dW/Intel article archive




List Archive: gentoo-dev
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-dev@g.o
From: Fabian Groffen <grobian@g.o>
Subject: Please review: prefix.eclass
Date: Fri, 27 Mar 2009 12:59:18 +0100
Hi,

This eclass facilitates in some of the needs of the Gentoo Prefix
project.  For now it provides the 'eprefixify' function, which is
often used in Gentoo Prefix ebuilds to incorporate the used offset
prefix into files.

Next to this, the eclass sets the EPREFIX to the empty string, if unset.
Ideally we would have liked to set EROOT and ED, based on ROOT and D,
but since the latter variables need not to be available when the eclass
is sourced, EROOT and ED (which both consist of the E-less variable +
EPREFIX) might get set wrongly.

This eclass brings Gentoo Prefix ebuilds one step closer to gentoo-x86
ebuilds.

Please review.


-- 
Fabian Groffen
Gentoo on a different level
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id: prefix.eclass 40407 2009-03-27 11:51:37Z grobian $

# @ECLASS: prefix.eclass
# @MAINTAINER:
# Feel free to contact the Prefix team through <prefix@g.o> 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 [[ -z ${EPREFIX} ]]; 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"
	for x in "$@" ; do
		if [[ -e ${x} ]] ; then
			ebegin "  ${x##*/}"
			sed -i -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" "${x}"
			r=$?
			eend ${r}
			[[ ${r} != 0 ]] && die "failed to eprefixify ${x}"
		else
			die "${x} does not exist"
		fi
	done

	return 0
}


# vim: tw=72:
Replies:
Re: Please review: prefix.eclass
-- Donnie Berkholz
Re: Please review: prefix.eclass
-- Ulrich Mueller
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: [gentoo-commits] gentoo-x86 commit in eclass: portability.eclass
Next by thread:
Re: Please review: prefix.eclass
Previous by date:
Re: EAPI 3 PMS Draft
Next by date:
Re: Please review: prefix.eclass


Updated Jun 17, 2009

Donate to support our development efforts.

Gentoo Centric Hosting: vr.org

VR Hosted

Tek Alchemy

Tek Alchemy

SevenL.net

SevenL.net

php|architect

php|architect

Copyright 2001-2007 Gentoo Foundation, Inc. Questions, Comments? Email www@gentoo.org.