Gentoo Archives: gentoo-user

From: "»Q«" <boxcars@×××.net>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: suppressing the 'would you like to add --pretend' prompt when using emerge --ask
Date: Sun, 17 Apr 2016 19:47:33
Message-Id: 20160417144714.6b478871@sepulchrave.remarqs
In Reply to: Re: [gentoo-user] suppressing the 'would you like to add --pretend' prompt when using emerge --ask by Alexander Kapshuk
1 On Sun, 17 Apr 2016 21:54:16 +0300
2 Alexander Kapshuk <alexander.kapshuk@×××××.com> wrote:
3
4 > On Sun, Apr 17, 2016 at 8:57 PM, »Q« <boxcars@×××.net> wrote:
5 > > I too often forget to use sudo along with emerge --ask, which gets
6 > > me a prompt to add --pretend to the options, e.g.
7 > >
8 > > $ emerge -a firefox
9 > > This action requires superuser access...
10 > > Would you like to add --pretend to options? [Yes/No] n
11 > > $ doh
12 > > Password:
13 > >
14 > > These are the packages that would be merged, in order:
15 > >
16 > > Calculating dependencies /... done!
17 > >
18 > > ( 'doh' is an alias for 'sudo $(history -p \!\!)' )
19 > >
20 > > I never want to add --pretend to the options; if I've used --ask,
21 > > I also meant to use sudo. I've looked through the documentation and
22 > > couldn't find a way to stop emerge from prompting me about
23 > > --pretend, so now I'm asking you if I've overlooked a way.
24 >
25 > Yes, the 'Would you like to add --pretend to options?' query does seem
26 > to be hard-coded. See below.
27 > portage-2.2.26/pym/_emerge/actions.py:2976,3004
28 > # check if root user is the current user for the actions where emerge
29 > needs this ...
30 > uq = UserQuery(emerge_config.opts)
31 > if uq.query("Would you like to add --pretend to options?",
32 > "--ask-enter-invalid" in emerge_config.opts) == "No":
33 > ...
34
35 Thanks. I'll keep living with the prompt and maybe eventually file an
36 enhancement bug to make it optional.
37
38 > I wonder if running the command line in the debug mode, 'emerge -ad
39 > firefox', would reveal anything of interest.
40
41 It shows my options for emerge.
42
43 $ emerge -ad firefox
44 myaction None
45 myopts {'--with-bdeps': 'y', '--load-average': 11.2, '--debug': True, '--jobs': 8, '--ask': True, '--ask-enter-invalid': True}
46 This action requires superuser access...
47 Would you like to add --pretend to options? [Yes/No] n
48
49 Since --ask-enter-invalid appeared in that bit of code, I tried taking
50 it out of my options in make.conf -- as I expected, that didn't
51 change whether I get the prompt, just changed how I can answer it.