* [gentoo-user] How is /etc/portage/env supposed to work?
@ 2015-10-20 14:04 Nikos Chantziaras
2015-10-20 14:26 ` Michael Orlitzky
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Nikos Chantziaras @ 2015-10-20 14:04 UTC (permalink / raw
To: gentoo-user
I'm following the documentation here:
https://wiki.gentoo.org/wiki/Handbook:AMD64/Portage/Advanced#Using_.2Fetc.2Fportage.2Fenv
to hook into the postinst phase of an ebuild. The docs only provide an
actual example for the global hook case (/etc/portage/bashrc), but it
says it works the same way on a per-ebuild basis using /etc/portage/env.
But it is totally silent on how to actually do that :-/
So I assume, since the docs don't mention anything special, that I
should put the code in a conf file. So I created this file:
/etc/portage/env/test.conf
and in it:
if [ "${EBUILD_PHASE}" == "postinst" ];
then
echo ":: TEST"
fi
Then I added this line to /etc/portage/package.env:
app-misc/mc test.conf
But when I "emerge app-misc/mc", I get:
!!! Problem in 'app-misc/mc' dependencies.
!!! "/etc/portage/env/test.conf", line 1: Invalid token '[' (not '=')
portage.exception
... done!
"/etc/portage/env/test.conf", line 1: Invalid token '[' (not '=')
I don't get it... Can't I have a per-package bashrc or something? The
docs are suggesting that I can, but don't tell me how.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] How is /etc/portage/env supposed to work?
2015-10-20 14:04 [gentoo-user] How is /etc/portage/env supposed to work? Nikos Chantziaras
@ 2015-10-20 14:26 ` Michael Orlitzky
2015-10-20 16:35 ` [gentoo-user] " Nikos Chantziaras
` (2 more replies)
2015-10-20 14:58 ` [gentoo-user] " Alexander Kapshuk
2015-10-20 15:37 ` Neil Bothwick
2 siblings, 3 replies; 10+ messages in thread
From: Michael Orlitzky @ 2015-10-20 14:26 UTC (permalink / raw
To: gentoo-user
On 10/20/2015 10:04 AM, Nikos Chantziaras wrote:
> I'm following the documentation here:
>
> https://wiki.gentoo.org/wiki/Handbook:AMD64/Portage/Advanced#Using_.2Fetc.2Fportage.2Fenv
>
> to hook into the postinst phase of an ebuild.
Deja vu:
http://comments.gmane.org/gmane.linux.gentoo.devhelp/151
https://bugs.gentoo.org/show_bug.cgi?id=388781
There's two separate uses for /etc/portage/env -- one of them will get
you the make.conf parser (when you list the file in
/etc/portage/package.env) and the other that will get you the bash
parser (when you put the file at /etc/portage/env/${CATEGORY}/${PN}).
The whole thing is confusing. If you ever get it working please put a
decent example on the wiki because I remember spending hours trying to
do the same thing.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] How is /etc/portage/env supposed to work?
2015-10-20 14:04 [gentoo-user] How is /etc/portage/env supposed to work? Nikos Chantziaras
2015-10-20 14:26 ` Michael Orlitzky
@ 2015-10-20 14:58 ` Alexander Kapshuk
2015-10-20 15:37 ` Neil Bothwick
2 siblings, 0 replies; 10+ messages in thread
From: Alexander Kapshuk @ 2015-10-20 14:58 UTC (permalink / raw
To: Gentoo mailing list
[-- Attachment #1: Type: text/plain, Size: 1465 bytes --]
On Tue, Oct 20, 2015 at 5:04 PM, Nikos Chantziaras <realnc@gmail.com> wrote:
> I'm following the documentation here:
>
>
> https://wiki.gentoo.org/wiki/Handbook:AMD64/Portage/Advanced#Using_.2Fetc.2Fportage.2Fenv
>
> to hook into the postinst phase of an ebuild. The docs only provide an
> actual example for the global hook case (/etc/portage/bashrc), but it says
> it works the same way on a per-ebuild basis using /etc/portage/env. But it
> is totally silent on how to actually do that :-/
>
> So I assume, since the docs don't mention anything special, that I should
> put the code in a conf file. So I created this file:
>
> /etc/portage/env/test.conf
>
> and in it:
>
> if [ "${EBUILD_PHASE}" == "postinst" ];
> then
> echo ":: TEST"
> fi
>
> Then I added this line to /etc/portage/package.env:
>
> app-misc/mc test.conf
>
> But when I "emerge app-misc/mc", I get:
>
> !!! Problem in 'app-misc/mc' dependencies.
> !!! "/etc/portage/env/test.conf", line 1: Invalid token '[' (not '=')
> portage.exception
> ... done!
> "/etc/portage/env/test.conf", line 1: Invalid token '[' (not '=')
>
According to test(1), comparing two strings for equality is done using a
single '=':
STRING1 = STRING2
the strings are equal
Try '[ "${EBUILD_PHASE}" = postinst ]' to hush the 'invalid token' thingie.
>
> I don't get it... Can't I have a per-package bashrc or something? The docs
> are suggesting that I can, but don't tell me how.
>
>
>
[-- Attachment #2: Type: text/html, Size: 2369 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] How is /etc/portage/env supposed to work?
2015-10-20 14:04 [gentoo-user] How is /etc/portage/env supposed to work? Nikos Chantziaras
2015-10-20 14:26 ` Michael Orlitzky
2015-10-20 14:58 ` [gentoo-user] " Alexander Kapshuk
@ 2015-10-20 15:37 ` Neil Bothwick
2015-10-20 16:32 ` [gentoo-user] " Nikos Chantziaras
2 siblings, 1 reply; 10+ messages in thread
From: Neil Bothwick @ 2015-10-20 15:37 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1812 bytes --]
On Tue, 20 Oct 2015 17:04:10 +0300, Nikos Chantziaras wrote:
> I'm following the documentation here:
>
> https://wiki.gentoo.org/wiki/Handbook:AMD64/Portage/Advanced#Using_.2Fetc.2Fportage.2Fenv
>
> to hook into the postinst phase of an ebuild. The docs only provide an
> actual example for the global hook case (/etc/portage/bashrc), but it
> says it works the same way on a per-ebuild basis
> using /etc/portage/env. But it is totally silent on how to actually do
> that :-/
>
> So I assume, since the docs don't mention anything special, that I
> should put the code in a conf file. So I created this file:
>
> /etc/portage/env/test.conf
>
> and in it:
>
> if [ "${EBUILD_PHASE}" == "postinst" ];
> then
> echo ":: TEST"
> fi
>
> Then I added this line to /etc/portage/package.env:
>
> app-misc/mc test.conf
>
> But when I "emerge app-misc/mc", I get:
>
> !!! Problem in 'app-misc/mc' dependencies.
> !!! "/etc/portage/env/test.conf", line 1: Invalid token '[' (not '=')
> portage.exception
> ... done!
> "/etc/portage/env/test.conf", line 1: Invalid token '[' (not '=')
>
> I don't get it... Can't I have a per-package bashrc or something? The
> docs are suggesting that I can, but don't tell me how.
I'm nut sure you can put that sort of thing in package.env, I thought it
was only for settings variables, like make.conf but per-package. You can
add function calls in /etc/portage/env/cat/pkg, for example I have
used this for a couple of packages that didn't support epatch_user
post_src_unpack() {
cd "${S}"
epatch_user
}
AFAIK you can do this for any of the standard ebuild functions listed in
man 5 ebuild.
--
Neil Bothwick
"We demand rigidly defined areas of doubt and uncertainty!"
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [gentoo-user] Re: How is /etc/portage/env supposed to work?
2015-10-20 15:37 ` Neil Bothwick
@ 2015-10-20 16:32 ` Nikos Chantziaras
2015-10-20 20:20 ` Neil Bothwick
0 siblings, 1 reply; 10+ messages in thread
From: Nikos Chantziaras @ 2015-10-20 16:32 UTC (permalink / raw
To: gentoo-user
On 20/10/15 18:37, Neil Bothwick wrote:
> On Tue, 20 Oct 2015 17:04:10 +0300, Nikos Chantziaras wrote:
>
>> So I assume, since the docs don't mention anything special, that I
>> should put the code in a conf file. So I created this file:
>>
>> /etc/portage/env/test.conf
>>
>> and in it:
>>
>> if [ "${EBUILD_PHASE}" == "postinst" ];
>> then
>> echo ":: TEST"
>> fi
>> [...]
>>
>> But when I "emerge app-misc/mc", I get:
>>
>> !!! Problem in 'app-misc/mc' dependencies.
>> !!! "/etc/portage/env/test.conf", line 1: Invalid token '[' (not '=')
>> portage.exception
>> ... done!
>> "/etc/portage/env/test.conf", line 1: Invalid token '[' (not '=')
>
> I'm nut sure you can put that sort of thing in package.env, I thought it
> was only for settings variables, like make.conf but per-package. You can
> add function calls in /etc/portage/env/cat/pkg, for example I have
> used this for a couple of packages that didn't support epatch_user
>
> post_src_unpack() {
> cd "${S}"
> epatch_user
> }
>
> AFAIK you can do this for any of the standard ebuild functions listed in
> man 5 ebuild.
Thanks! That works just fine.
Btw, you can put your epatch_user in /etc/portage/bashrc instead and
have it for all packages. It is safe to have it twice even in packages
that do support epatch_user. That function is specifically written for
this use case, so that even when using it multiple times, the patches
are only applied once.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [gentoo-user] Re: How is /etc/portage/env supposed to work?
2015-10-20 14:26 ` Michael Orlitzky
@ 2015-10-20 16:35 ` Nikos Chantziaras
2015-10-20 18:24 ` [gentoo-user] " Alan McKinnon
2015-10-22 20:03 ` [gentoo-user] " Nikos Chantziaras
2 siblings, 0 replies; 10+ messages in thread
From: Nikos Chantziaras @ 2015-10-20 16:35 UTC (permalink / raw
To: gentoo-user
On 20/10/15 17:26, Michael Orlitzky wrote:
> On 10/20/2015 10:04 AM, Nikos Chantziaras wrote:
>> I'm following the documentation here:
>>
>> https://wiki.gentoo.org/wiki/Handbook:AMD64/Portage/Advanced#Using_.2Fetc.2Fportage.2Fenv
>>
>> to hook into the postinst phase of an ebuild.
>
> Deja vu:
>
> http://comments.gmane.org/gmane.linux.gentoo.devhelp/151
>
> https://bugs.gentoo.org/show_bug.cgi?id=388781
>
> There's two separate uses for /etc/portage/env -- one of them will get
> you the make.conf parser (when you list the file in
> /etc/portage/package.env) and the other that will get you the bash
> parser (when you put the file at /etc/portage/env/${CATEGORY}/${PN}).
>
> The whole thing is confusing. If you ever get it working please put a
> decent example on the wiki because I remember spending hours trying to
> do the same thing.
As suggested by Neil, putting the code in /etc/portage/env/app-misc/mc
worked.
Will later write an example in the Wiki.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] How is /etc/portage/env supposed to work?
2015-10-20 14:26 ` Michael Orlitzky
2015-10-20 16:35 ` [gentoo-user] " Nikos Chantziaras
@ 2015-10-20 18:24 ` Alan McKinnon
2015-10-22 20:03 ` [gentoo-user] " Nikos Chantziaras
2 siblings, 0 replies; 10+ messages in thread
From: Alan McKinnon @ 2015-10-20 18:24 UTC (permalink / raw
To: gentoo-user
On 20/10/2015 16:26, Michael Orlitzky wrote:
> On 10/20/2015 10:04 AM, Nikos Chantziaras wrote:
>> I'm following the documentation here:
>>
>> https://wiki.gentoo.org/wiki/Handbook:AMD64/Portage/Advanced#Using_.2Fetc.2Fportage.2Fenv
>>
>> to hook into the postinst phase of an ebuild.
>
> Deja vu:
>
> http://comments.gmane.org/gmane.linux.gentoo.devhelp/151
>
> https://bugs.gentoo.org/show_bug.cgi?id=388781
>
> There's two separate uses for /etc/portage/env -- one of them will get
> you the make.conf parser (when you list the file in
> /etc/portage/package.env) and the other that will get you the bash
> parser (when you put the file at /etc/portage/env/${CATEGORY}/${PN}).
>
> The whole thing is confusing. If you ever get it working please put a
> decent example on the wiki because I remember spending hours trying to
> do the same thing.
I had to go down this road too recently. The portage man pages mention
the two ways and recommend the completely non-obvious one that melted my
brain. It works like this:
$ cat /etc/portage/package.env
=app-emulation/virtualbox-5.0.6 vbox-makeopts
=app-emulation/virtualbox-5.0.6-r1 vbox-makeopts
$ cat /etc/portage/env/vbox-makeopts
MAKEOPTS="-j2 -l4"
All the atoms listed in package.env (2 virtual box ebuilds in this case)
will apply the environment settings in a file called vbox-makeopts. I
had to do this because virtualbox-5 has a weird parallel build bug - it
often fails with j=1 or j>2 but never with j=2. Odd.
The other method is very obvious but somehow not recommended:
$ ls -l /etc/portage/env/mail-client
-rw-r--r-- 1 root root 92 Sep 25 17:00 thunderbird-38.2.0
-rw-r--r-- 1 root root 92 Oct 1 14:52 thunderbird-38.3.0
$ cat /etc/portage/env/mail-client/thunderbird-38.2.0
LDFLAGS="${LDFLAGS}
-Wl,-rpath,/usr/lib/thunderbird,-rpath,/usr/lib/thunderbird/components"
The dir and version structure of env/<pkg>-<version> is compared to
what is being merged (IIRC $P, $PN, $PV all work) and the env in the
file is applied.
--
Alan McKinnon
alan.mckinnon@gmail.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] Re: How is /etc/portage/env supposed to work?
2015-10-20 16:32 ` [gentoo-user] " Nikos Chantziaras
@ 2015-10-20 20:20 ` Neil Bothwick
0 siblings, 0 replies; 10+ messages in thread
From: Neil Bothwick @ 2015-10-20 20:20 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 639 bytes --]
On Tue, 20 Oct 2015 19:32:15 +0300, Nikos Chantziaras wrote:
> Btw, you can put your epatch_user in /etc/portage/bashrc instead and
> have it for all packages. It is safe to have it twice even in packages
> that do support epatch_user. That function is specifically written for
> this use case, so that even when using it multiple times, the patches
> are only applied once.
That's good to know. I only set it where I knew I needed it because I was
unsure of that. However, the files are dated Feb 2012, so things have
probably improved since then.
--
Neil Bothwick
- We are but packets in the internet of Life-
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [gentoo-user] Re: How is /etc/portage/env supposed to work?
2015-10-20 14:26 ` Michael Orlitzky
2015-10-20 16:35 ` [gentoo-user] " Nikos Chantziaras
2015-10-20 18:24 ` [gentoo-user] " Alan McKinnon
@ 2015-10-22 20:03 ` Nikos Chantziaras
2015-10-23 2:05 ` Michael Orlitzky
2 siblings, 1 reply; 10+ messages in thread
From: Nikos Chantziaras @ 2015-10-22 20:03 UTC (permalink / raw
To: gentoo-user
On 20/10/15 17:26, Michael Orlitzky wrote:
> The whole thing is confusing. If you ever get it working please put a
> decent example on the wiki because I remember spending hours trying to
> do the same thing.
OK, I just created an account, but it doesn't look that the wiki is
actually editable:
You do not have permission to edit this page, for the following reason:
You do not have permission to edit pages in the Handbook namespace.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] Re: How is /etc/portage/env supposed to work?
2015-10-22 20:03 ` [gentoo-user] " Nikos Chantziaras
@ 2015-10-23 2:05 ` Michael Orlitzky
0 siblings, 0 replies; 10+ messages in thread
From: Michael Orlitzky @ 2015-10-23 2:05 UTC (permalink / raw
To: gentoo-user
On 10/22/2015 04:03 PM, Nikos Chantziaras wrote:
> On 20/10/15 17:26, Michael Orlitzky wrote:
>> The whole thing is confusing. If you ever get it working please put a
>> decent example on the wiki because I remember spending hours trying to
>> do the same thing.
>
> OK, I just created an account, but it doesn't look that the wiki is
> actually editable:
>
> You do not have permission to edit this page, for the following reason:
> You do not have permission to edit pages in the Handbook namespace.
>
>
Some pages aren't, but most are. The exceptions are things like project
pages and the handbook (which I guess is where you got that error?). I
think this
https://wiki.gentoo.org/wiki//etc/portage/package.env
is a normal page and you should be able to edit it.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-10-23 2:05 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-20 14:04 [gentoo-user] How is /etc/portage/env supposed to work? Nikos Chantziaras
2015-10-20 14:26 ` Michael Orlitzky
2015-10-20 16:35 ` [gentoo-user] " Nikos Chantziaras
2015-10-20 18:24 ` [gentoo-user] " Alan McKinnon
2015-10-22 20:03 ` [gentoo-user] " Nikos Chantziaras
2015-10-23 2:05 ` Michael Orlitzky
2015-10-20 14:58 ` [gentoo-user] " Alexander Kapshuk
2015-10-20 15:37 ` Neil Bothwick
2015-10-20 16:32 ` [gentoo-user] " Nikos Chantziaras
2015-10-20 20:20 ` Neil Bothwick
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox