Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 699078 - I_KNOW_WHAT_I_AM_DOING support for ebuild command
Summary: I_KNOW_WHAT_I_AM_DOING support for ebuild command
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Ebuild Support (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-01 09:17 UTC by Rafal Lalik
Modified: 2021-10-20 14:45 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rafal Lalik 2019-11-01 09:17:01 UTC
I don't know what are exact internal differences between `emerge` and `ebuild` but sometimes when large package like libreoffice failes, I would like to continue compilation with `ebuild` instead of starting whole stuff again with `emerge`.

However, though `emerge` supports this variable and lets libreoffice compile when e.g. unsufficient space on the disk, it doesn't work with `ebuild`. Despite what is your opinion about this variable (e.g. #390473) maybe can you at least make `ebuild` accepting it and passing to the actual scripts which will handle it?
Comment 1 Rafal Lalik 2019-11-01 09:19:15 UTC
To add to above, I know I can edit environment file in the ebuild working directory variable and manually add

declare -x I_KNOW_WHAT_I_AM_DOING="yes"

which solves it but would be nice to do it without need to play with the files.
Comment 2 Brian Evans (RETIRED) gentoo-dev 2019-11-01 13:21:37 UTC
(In reply to Rafal Lalik from comment #1)
> To add to above, I know I can edit environment file in the ebuild working
> directory variable and manually add
> 
> declare -x I_KNOW_WHAT_I_AM_DOING="yes"
> 
> which solves it but would be nice to do it without need to play with the
> files.

But this is exactly your issue.  Because you reuse the environment by not cleaning the ebuild, no new bash variables are added.  If you give ebuild such a variable with a clean env, then it does include and is supported.
Comment 3 Zac Medico gentoo-dev 2019-11-01 21:03:46 UTC
(In reply to Brian Evans from comment #2)
> (In reply to Rafal Lalik from comment #1)
> > To add to above, I know I can edit environment file in the ebuild working
> > directory variable and manually add
> > 
> > declare -x I_KNOW_WHAT_I_AM_DOING="yes"
> > 
> > which solves it but would be nice to do it without need to play with the
> > files.
> 
> But this is exactly your issue.  Because you reuse the environment by not
> cleaning the ebuild, no new bash variables are added.  If you give ebuild
> such a variable with a clean env, then it does include and is supported.

Right. This is the intended behavior and is covered by the "11.2 The State of Variables Between Functions" section of PMS:

https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-11400011.2
Comment 4 Rafal Lalik 2019-11-03 11:23:08 UTC
What I understand, the environment script should has defined all variables set on the creation of environment.

So if I call

I_KNOW_WHAT_I_AM_DOING=yes emerge ...

should the variable be then included in the environment script?

or it is only for `ebuild` script?
Comment 5 Zac Medico gentoo-dev 2019-11-03 18:51:16 UTC
Both emerge and `ebuild` commands create the environment in exactly the same way. The environment is sealed as soon as it is created, which is necessary in order to fulfill PMS requirements. For example, an ebuild function could unset the I_KNOW_WHAT_I_AM_DOING variable, and according to PMS that variable should remain unset when future ebuild functions are called. Once an ebuild environment is created, we can't add new variables without explicitly violating PMS.
Comment 6 Rafal Lalik 2019-11-03 19:52:38 UTC
I understand this. I am just wondering, why it is then not stored in the script if I call emerge with this variable set? What I see from greping /usr/portage there are no places where this variable would be unset by ebuild or eclass. So I assume there is no scenario where ebuild would in any way usnet it.

So why this variable is missing from environment script when I set it upon calling emerge?
Comment 7 Zac Medico gentoo-dev 2019-11-03 20:29:26 UTC
(In reply to Rafal Lalik from comment #6)
> I understand this. I am just wondering, why it is then not stored in the
> script if I call emerge with this variable set? What I see from greping
> /usr/portage there are no places where this variable would be unset by
> ebuild or eclass. So I assume there is no scenario where ebuild would in any
> way usnet it.
> 
> So why this variable is missing from environment script when I set it upon
> calling emerge?

Hmm, it seems to be in the environment if I ^C interrupt emerge and grep the environment file:

> # I_KNOW_WHAT_I_AM_DOING=1 emerge --nodeps portage
> >>> Verifying ebuild manifests
> >>> Running pre-merge checks for sys-apps/portage-2.3.78-r2
>  * Determining the location of the kernel source code
>  * Found kernel source directory:
>  *     /usr/src/linux
>  * Found sources for kernel version:
>  *     4.19.67-0822
>  * Checking for suitable kernel configuration options...                                                                        [ ok ]
> >>> Emerging (1 of 1) sys-apps/portage-2.3.78-r2::gentoo
> >>> Jobs: 0 of 1 complete, 1 running                Load avg: 1.57, 1.15, 0.98^C
> 
> Exiting on signal 2
> 
> # grep I_KNOW_WHAT_I_AM_DOING /var/tmp/portage/sys-apps/portage-2.3.78-r2/temp/environment 
> declare -x I_KNOW_WHAT_I_AM_DOING="1"
Comment 8 Zac Medico gentoo-dev 2019-11-04 16:15:59 UTC
NOTE: If you want to add environment variables to an ebuild environment *after* it has been created, it's possible to do so via bashrc files which are documented in the `man 5 portage`:

> Portage will source all of these bashrc files after /etc/portage/bashrc in the
> following order:
> 
> 1. /etc/portage/env/${CATEGORY}/${PN}
> 
> 2. /etc/portage/env/${CATEGORY}/${PN}:${SLOT}
> 
> 3. /etc/portage/env/${CATEGORY}/${P}
> 
> 4. /etc/portage/env/${CATEGORY}/${PF}

The relevant variables are documented in `man 5 ebuild`.