View previous topic :: View next topic |
Author |
Message |
Massimo B. Veteran
Joined: 09 Feb 2005 Posts: 1805 Location: PB, Germany
|
Posted: Thu Sep 05, 2024 8:04 am Post subject: Understanding package.env, env, package.bashrc, bashrc |
|
|
Discussion about https://wiki.gentoo.org/wiki//etc/portage/package.env and the discussion https://wiki.gentoo.org/wiki/Talk:/etc/portage/package.env#.2Fetc.2Fportage.2Fenv
Quote from https://wiki.gentoo.org/index.php?title=Talk:/etc/portage/package.env&oldid=1310546#.2Fetc.2Fportage.2Fenv:
Quote: | /etc/portage/env
Currently there is no wiki for this location. Eventhough the man-page says in section "package.env" "Beginners should be careful to recognize the difference between these two types", it's not clearly described in the later section "/etc/portage/env/". The Wiki does not make it clearer. From my understanding, in /etc/portage/env there can be 2 type of files. One is placed in the parent dir and must be referenced by /etc/portage/package.env entries, the other is placed like /etc/portage/env/${CATEGORY}/${PN}. The difference is the time of sourcing.
Then there is package.bashrc with referenced files located in bashrc/ but in section "bashrc" of the man-page I read "Additional package-specific bashrc files can be created in /etc/portage/env.".
I'm confused. Is there somewhere the complete call-stack of all env and bashrc files? |
Like for the example in https://wiki.gentoo.org/wiki//etc/portage/package.env#Use_different_MAKEOPTS_for_a_specific_package :
What is the difference between /etc/portage/env/makeopts-jobs-28.conf: | MAKEOPTS="${MAKEOPTS} --jobs=28" |
/etc/portage/package.env: | dev-qt/qtwebengine makeopts-jobs-28.conf | and /etc/portage/env/dev-qt/qtwebengine: | MAKEOPTS="${MAKEOPTS} --jobs=28" | ?
If there is
/etc/portage/env/${CATEGORY}/${PN} in parallel to /etc/portage/env/myconf AND /etc/portage/package.env/ reference, is there also
/etc/portage/bashrc/${CATEGORY}/${PN} in parallel to /etc/portage/bashrc/myconf AND /etc/portage/package.bashrc/ reference
? _________________ HP ZBook Power 15.6" G8 i7-11800H|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770 |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9594 Location: beyond the rim
|
Posted: Thu Sep 05, 2024 9:07 am Post subject: Re: Understanding package.env, env, package.bashrc, bashrc |
|
|
Massimo B. wrote: | If there is
/etc/portage/env/${CATEGORY}/${PN} in parallel to /etc/portage/env/myconf AND /etc/portage/package.env/ reference, is there also
/etc/portage/bashrc/${CATEGORY}/${PN} in parallel to /etc/portage/bashrc/myconf AND /etc/portage/package.bashrc/ reference
? |
There is no /etc/portage/package.bashrc, that is only available for profiles (for whatever reason), not users. There is /etc/portage/bashrc (a file, not directory) which is sourced globally before package-specific bashrc files.
Quote: | What is the difference between
/etc/portage/env/makeopts-jobs-28.conf:
MAKEOPTS="${MAKEOPTS} --jobs=28"
/etc/portage/package.env:
dev-qt/qtwebengine makeopts-jobs-28.conf
and
/etc/portage/env/dev-qt/qtwebengine:
MAKEOPTS="${MAKEOPTS} --jobs=28"
? |
In that example there is effectively no difference. That comes up when you want to do more fancy stuff:
The first is processed by portage when setting up the initial environment. As stated in the manpage, these files are processed like make.conf, so they can't contain arbitrary bash code and should only be used for setting up environment variables. On the upside you can modify certain variables here that are locked or ineffective when actual bashrc files are processed.
The second is actually sourced by bash when the actual ebuild phase is executed, so it is much more flexible in what it can do syntax-wise. However it will only affect the code executed in ebuild phases, not the base environment used by portage itself.
Quote: | I'm confused. Is there somewhere the complete call-stack of all env and bashrc files? |
Unlikely as it isn't a single call-stack and the complete thing is rather messy. Reason is history: Originally none of these files existed, they were added gradually over time for different incompatible (edge-case) purposes and therefore had to be implemented in different parts of portage.
TL;DR: Just stick to the manpage recommendation: If you want to adjust the ebuild environment (variables), use package.env, that has the best chance to actually do what you expect. If you want to actually execute code, use bashrc files. |
|
Back to top |
|
|
Massimo B. Veteran
Joined: 09 Feb 2005 Posts: 1805 Location: PB, Germany
|
Posted: Thu Sep 05, 2024 9:26 am Post subject: |
|
|
Again, if for the second approach /etc/portage/env/dev-qt/qtwebengine is a sourced bashrc, then it should be better placed at /etc/portage/bashrc/dev-qt/qtwebengine, because it is unusual that some /etc/portage/env tree may contain completely different file types inside.
And what is then the difference to some /etc/portage/package.bashrc/myqtwebenginebashrc: | dev-qt/qtwebengine myqtwebenginebashrc |
/etc/portage/bashrc/myqtwebenginebashrc: | MAKEOPTS="${MAKEOPTS} --jobs=28" |
_________________ HP ZBook Power 15.6" G8 i7-11800H|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770 |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22417
|
Posted: Thu Sep 05, 2024 12:43 pm Post subject: |
|
|
You can disagree with what paths were chosen, but they are now locked by history, and convincing anyone to change them is probably difficult. The current values may not be optimal or make the most sense, but they are supported now and people are using them. |
|
Back to top |
|
|
Massimo B. Veteran
Joined: 09 Feb 2005 Posts: 1805 Location: PB, Germany
|
Posted: Thu Sep 05, 2024 12:47 pm Post subject: |
|
|
Sure, I agree. I just try to understand the differences between the currently implemented approaches. _________________ HP ZBook Power 15.6" G8 i7-11800H|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770 |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9594 Location: beyond the rim
|
Posted: Thu Sep 05, 2024 1:06 pm Post subject: |
|
|
Massimo B. wrote: | Again, if for the second approach /etc/portage/env/dev-qt/qtwebengine is a sourced bashrc, then it should be better placed at /etc/portage/bashrc/dev-qt/qtwebengine, because it is unusual that some /etc/portage/env tree may contain completely different file types inside. |
Agreed, but that has historic reasons as well: /etc/portage/env was first used by a custom bashrc loader (long before package.env was even thought of). When that logic was integrated into portage itself the location was kept to avoid breaking user setups. That package.env later reused that location was probably an unfortunate decision in review, can't recall when that happened and if I had any input on that or was already gone.
Quote: | And what is then the difference to some /etc/portage/package.bashrc/myqtwebenginebashrc: | dev-qt/qtwebengine myqtwebenginebashrc |
/etc/portage/bashrc/myqtwebenginebashrc: | MAKEOPTS="${MAKEOPTS} --jobs=28" |
|
As mentioned in the last post: There is no /etc/portage/package.bashrc, and /etc/portage/bashrc being a directory will likely trigger bash errors. See previous post. |
|
Back to top |
|
|
Massimo B. Veteran
Joined: 09 Feb 2005 Posts: 1805 Location: PB, Germany
|
Posted: Fri Sep 06, 2024 8:15 am Post subject: |
|
|
Genone wrote: | As mentioned in the last post: There is no /etc/portage/package.bashrc, and /etc/portage/bashrc being a directory will likely trigger bash errors. See previous post. |
Really? In man portage I find: Quote: | package.bashrc
Per-package bashrc mechanism. Contains a list of bashrc files to be sourced before emerging a given atom. The bashrc files must be stored in bashrc/, in the profile directory. |
I thought that means /etc/portage/package.bashrc and /etc/portage/bashrc. But it rather means "/bashrc in the profile directory" which is /etc/portage/profile/bashrc, right? What about package.bashrc, where can that be found? _________________ HP ZBook Power 15.6" G8 i7-11800H|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770 |
|
Back to top |
|
|
logrusx Advocate
Joined: 22 Feb 2018 Posts: 2218
|
Posted: Fri Sep 06, 2024 8:59 am Post subject: |
|
|
Massimo B. wrote: | Genone wrote: | As mentioned in the last post: There is no /etc/portage/package.bashrc, and /etc/portage/bashrc being a directory will likely trigger bash errors. See previous post. |
Really? In man portage I find: Quote: | package.bashrc
Per-package bashrc mechanism. Contains a list of bashrc files to be sourced before emerging a given atom. The bashrc files must be stored in bashrc/, in the profile directory. |
I thought that means /etc/portage/package.bashrc and /etc/portage/bashrc. But it rather means "/bashrc in the profile directory" which is /etc/portage/profile/bashrc, right? What about package.bashrc, where can that be found? |
Code: | SPECIFIC FILE DESCRIPTIONS
/etc/portage/make.profile/ or /etc/make.profile/
...
package.bashrc
Per-package bashrc mechanism. Contains a list of bashrc files to be sourced before emerging a given atom. The bashrc files must be stored in bashrc/, in the profile directory.
...
|
Did you miss the above part?
Also for completeness:
Code: | SYNOPSIS
/etc/portage/make.profile/ or /etc/make.profile/
site-specific overrides go in /etc/portage/profile/
...
package.bashrc
...
|
However I find it a bit confusing as package.accept_keywords is right above package.bashrc. Is there a separate package.accept_keywords under /etc/portage/make.profile/ or /etc/make.profile/ or /etc/portage/profile?
Best Regards,
Georgi |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9594 Location: beyond the rim
|
Posted: Sat Sep 07, 2024 2:27 am Post subject: |
|
|
Massimo B. wrote: | Genone wrote: | As mentioned in the last post: There is no /etc/portage/package.bashrc, and /etc/portage/bashrc being a directory will likely trigger bash errors. See previous post. |
Really? In man portage I find: Quote: | package.bashrc
Per-package bashrc mechanism. Contains a list of bashrc files to be sourced before emerging a given atom. The bashrc files must be stored in bashrc/, in the profile directory. |
|
Yes, but that is not in the section about /etc/portage. I agree that it is probably confusing that profile stuff is listed before user config files.
Quote: | What about package.bashrc, where can that be found? |
As already said, that is only for profiles, not for users. And no idea why it even exists for profiles. Just forget about it.
Quote: | However I find it a bit confusing as package.accept_keywords is right above package.bashrc. Is there a separate package.accept_keywords under /etc/portage/make.profile/ or /etc/make.profile/ or /etc/portage/profile? |
Yes. Not sure why profiles would need that AND package.keywords (which is different from the old package.keywords user config file), but it is available. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|