Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-alt
Navigation:
Lists: gentoo-alt: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-alt@g.o
From: Fabian Groffen <grobian@g.o>
Subject: Re: [PREFIX] creating a prefix.eclass?
Date: Tue, 10 Mar 2009 18:08:46 +0100
On 10-03-2009 17:34:45 +0100, Fabian Groffen wrote:
> On 10-03-2009 17:17:00 +0100, Michael Haubenwallner wrote:
> > Maybe indeed you're right, eprefixify is just an utility to help fixing
> > package's code and should not be part of an EAPI.
> 
> I think I'll draft up a proposal tonight.

Please review my first shot at prefix.eclass


-- 
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 38991 2009-03-10 17:07:27Z 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.
use !prefix && EPREFIX=""

# @ECLASS-VARIABLE: EROOT
# @DESCRIPTION:
# The offset prefix appended to ${ROOT}.  Prefix Portage sets this
# variable automatically.
[[ -z ${EROOT} ]] && EROOT=${ROOT%/}${EPREFIX}/

# @ECLASS-VARIABLE: ED
# @DESCRIPTION:
# The offset prefix appended to ${D}.  Prefix Portage sets this variable
# automatically.  It is questionable if ${D} is (supposed to be) set
# when this eclass is sourced, so this might not work out in non-Prefix.
[[ -z ${ED} ]] && ED=${D}${EPREFIX}

# @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
}


# vim: tw=72:
Replies:
Re: [PREFIX] creating a prefix.eclass?
-- Michael Haubenwallner
RE: [PREFIX] creating a prefix.eclass?
-- Markus Duft
References:
[PREFIX] creating a prefix.eclass?
-- Fabian Groffen
Re: [PREFIX] creating a prefix.eclass?
-- Michael Haubenwallner
Re: [PREFIX] creating a prefix.eclass?
-- Fabian Groffen
Navigation:
Lists: gentoo-alt: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: [PREFIX] creating a prefix.eclass?
Next by thread:
RE: [PREFIX] creating a prefix.eclass?
Previous by date:
Re: [PREFIX] creating a prefix.eclass?
Next by date:
Re: Bootstrap issues on Mac


Updated Jun 17, 2009

Summary: Archive of the gentoo-alt mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.