* [gentoo-dev] Please review: prefix.eclass
@ 2009-03-27 11:59 Fabian Groffen
2009-03-27 12:08 ` Ulrich Mueller
2009-04-01 4:50 ` Donnie Berkholz
0 siblings, 2 replies; 6+ messages in thread
From: Fabian Groffen @ 2009-03-27 11:59 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 687 bytes --]
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
[-- Attachment #2: prefix.eclass --]
[-- Type: text/plain, Size: 1618 bytes --]
# 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@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 [[ -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:
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-dev] Please review: prefix.eclass
2009-03-27 11:59 [gentoo-dev] Please review: prefix.eclass Fabian Groffen
@ 2009-03-27 12:08 ` Ulrich Mueller
2009-03-27 12:24 ` Fabian Groffen
2009-04-01 4:50 ` Donnie Berkholz
1 sibling, 1 reply; 6+ messages in thread
From: Ulrich Mueller @ 2009-03-27 12:08 UTC (permalink / raw
To: gentoo-dev
>>>>> On Fri, 27 Mar 2009, Fabian Groffen wrote:
> Please review.
> r=$?
> eend ${r}
> [[ ${r} != 0 ]] && die "failed to eprefixify ${x}"
Here you could save a variable, since eend returns the status:
eend $? || die "failed to eprefixify ${x}"
Ulrich
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-dev] Please review: prefix.eclass
2009-03-27 12:08 ` Ulrich Mueller
@ 2009-03-27 12:24 ` Fabian Groffen
0 siblings, 0 replies; 6+ messages in thread
From: Fabian Groffen @ 2009-03-27 12:24 UTC (permalink / raw
To: gentoo-dev
On 27-03-2009 13:08:46 +0100, Ulrich Mueller wrote:
> >>>>> On Fri, 27 Mar 2009, Fabian Groffen wrote:
>
> > Please review.
>
> > r=$?
> > eend ${r}
> > [[ ${r} != 0 ]] && die "failed to eprefixify ${x}"
>
> Here you could save a variable, since eend returns the status:
it wasn't even declared local, so double FAIL.
> eend $? || die "failed to eprefixify ${x}"
Applied, thanks!
--
Fabian Groffen
Gentoo on a different level
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-dev] Please review: prefix.eclass
2009-03-27 11:59 [gentoo-dev] Please review: prefix.eclass Fabian Groffen
2009-03-27 12:08 ` Ulrich Mueller
@ 2009-04-01 4:50 ` Donnie Berkholz
2009-04-01 9:13 ` [gentoo-dev] " Christian Faulhammer
1 sibling, 1 reply; 6+ messages in thread
From: Donnie Berkholz @ 2009-04-01 4:50 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 615 bytes --]
On 12:59 Fri 27 Mar , Fabian Groffen wrote:
> 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.
It's great to see you moving toward folding this back into the main
tree! My only comment is that eprefixify could really use a better name
because that one sounds really awkward. How about doprefix, or something
else?
--
Thanks,
Donnie
Donnie Berkholz
Developer, Gentoo Linux
Blog: http://dberkholz.wordpress.com
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [gentoo-dev] Re: Please review: prefix.eclass
2009-04-01 4:50 ` Donnie Berkholz
@ 2009-04-01 9:13 ` Christian Faulhammer
2009-04-02 14:40 ` Jeremy Olexa
0 siblings, 1 reply; 6+ messages in thread
From: Christian Faulhammer @ 2009-04-01 9:13 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 797 bytes --]
Hi,
Donnie Berkholz <dberkholz@gentoo.org>:
> On 12:59 Fri 27 Mar , Fabian Groffen wrote:
> > 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.
>
> It's great to see you moving toward folding this back into the main
> tree! My only comment is that eprefixify could really use a better
> name because that one sounds really awkward. How about doprefix, or
> something else?
To install a prefix file? Like doman, dobin. :)
V-Li
--
Christian Faulhammer, Gentoo Lisp project
<URL:http://www.gentoo.org/proj/en/lisp/>, #gentoo-lisp on FreeNode
<URL:http://gentoo.faulhammer.org/>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-dev] Re: Please review: prefix.eclass
2009-04-01 9:13 ` [gentoo-dev] " Christian Faulhammer
@ 2009-04-02 14:40 ` Jeremy Olexa
0 siblings, 0 replies; 6+ messages in thread
From: Jeremy Olexa @ 2009-04-02 14:40 UTC (permalink / raw
To: gentoo-dev
On Wed, Apr 1, 2009 at 4:13 AM, Christian Faulhammer <fauli@gentoo.org> wrote:
> Hi,
>
> Donnie Berkholz <dberkholz@gentoo.org>:
>
>> On 12:59 Fri 27 Mar , Fabian Groffen wrote:
>> > 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.
>>
>> It's great to see you moving toward folding this back into the main
>> tree! My only comment is that eprefixify could really use a better
>> name because that one sounds really awkward. How about doprefix, or
>> something else?
>
> To install a prefix file? Like doman, dobin. :)
Not that I want to start an argument over a function name but it helps
if you understand what eprefixify() does.
eprefixify simply does a 's/@GENTOO_PORTAGE_EPREFIX@/$EPREFIX/' where
EPREFIX is expanded to its abs value. The common use case for
eprefixify is on installed scripts where you should be able to run the
program in a prefix shell or not. (ie. you should be able to run it
without EPREFIX being set in your env - this is true of all prefix
executables)
So, no, we do not exactly feel like a do* name is appropriate because
this function is not installing anything. In a sense, we made
'eprefix' a verb and that really seems to make sense to new devs and
new users.
-Jeremy
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-04-02 14:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-27 11:59 [gentoo-dev] Please review: prefix.eclass Fabian Groffen
2009-03-27 12:08 ` Ulrich Mueller
2009-03-27 12:24 ` Fabian Groffen
2009-04-01 4:50 ` Donnie Berkholz
2009-04-01 9:13 ` [gentoo-dev] " Christian Faulhammer
2009-04-02 14:40 ` Jeremy Olexa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox