Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
-y or --noask switch for Portage & emaint commands?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Xharlie
n00b
n00b


Joined: 21 May 2017
Posts: 14

PostPosted: Thu Jun 13, 2024 11:46 am    Post subject: -y or --noask switch for Portage & emaint commands? Reply with quote

In my `/etc/portage/make.conf`, I have set `EMERGE_DEFAULT_OPTS="--ask --ask-enter-invalid …"` because, honestly, these saved my arse so many times that it's bonkers.

The full set is:

Code:

EMERGE_DEFAULT_OPTS="--ask --ask-enter-invalid --fail-clean --quiet-build"


However, because `--ask` is there, I also get an interactive halt when I run things like `emaint sync` and that's really not what I want.

I don't think I have ever bothered to type `sudo emaint sync` into a terminal and *not* actually intended to actually sync.

Similarly, there are a few times when I do want to just `emerge` or `emerge --depclean` without being asked, despite having the defaults.

Is there some way to send `--noask` or `-y` or something to these commands to override the pre-existing `--ask` from `EMERGE_DEFAULT_OPTS`?

I have tried a few things but I can't seem to find how to do it.

Shell aliases are also of limited use because they don't get applied when `sudo` enters the picture.
Back to top
View user's profile Send private message
eeckwrk99
Apprentice
Apprentice


Joined: 14 Mar 2021
Posts: 226
Location: Gentoo forums

PostPosted: Thu Jun 13, 2024 11:58 am    Post subject: Re: -y or --noask switch for Portage & emaint commands? Reply with quote

Xharlie wrote:
However, because `--ask` is there, I also get an interactive halt when I run things like `emaint sync` and that's really not what I want. I don't think I have ever bothered to type `sudo emaint sync` into a terminal and *not* actually intended to actually sync.

I'm also using --ask in EMERGE_DEFAULT_OPTS and I'm not getting any interactive confirmation when running
Code:
# emaint sync -a
, be it with sudo or as root.
Xharlie wrote:
Is there some way to send `--noask` or `-y` or something to these commands to override the pre-existing `--ask` from `EMERGE_DEFAULT_OPTS`?

Code:
--ask n
Back to top
View user's profile Send private message
Xharlie
n00b
n00b


Joined: 21 May 2017
Posts: 14

PostPosted: Thu Jun 13, 2024 12:01 pm    Post subject: Reply with quote

This is what `sudo emaint sync` gives me, every time:

Code:

>>> Syncing repository 'gentoo' into '/var/db/repos/gentoo'...
 * Using keys from /usr/share/openpgp-keys/gentoo-release.asc
 * Refreshing keys via WKD ...                                                               [ ok ]
Do you want to sync your ebuild repository with the mirror at
rsync://[2a00:1828:a00d:ffff::6]/gentoo-portage? [Yes/No]


I had just guessed that it began to do so when I added `--ask` to `EMERGE_DEFAULT_OPTS` because it was not always thus.
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1899

PostPosted: Thu Jun 13, 2024 12:19 pm    Post subject: Reply with quote

Xharlie wrote:
Is there some way to send `--noask` or `-y` or something to these commands to override the pre-existing `--ask` from `EMERGE_DEFAULT_OPTS`?

Being python based, many boolean options can be negated like --ask=n. This is covered in the man page as well.
Back to top
View user's profile Send private message
eeckwrk99
Apprentice
Apprentice


Joined: 14 Mar 2021
Posts: 226
Location: Gentoo forums

PostPosted: Thu Jun 13, 2024 12:20 pm    Post subject: Reply with quote

Xharlie wrote:
This is what `sudo emaint sync` gives me, every time:

Code:

>>> Syncing repository 'gentoo' into '/var/db/repos/gentoo'...
 * Using keys from /usr/share/openpgp-keys/gentoo-release.asc
 * Refreshing keys via WKD ...                                                               [ ok ]
Do you want to sync your ebuild repository with the mirror at
rsync://[2a00:1828:a00d:ffff::6]/gentoo-portage? [Yes/No]


I had just guessed that it began to do so when I added `--ask` to `EMERGE_DEFAULT_OPTS` because it was not always thus.


Ha, maybe that's because you're using rsync and I'm using Git (Gentoo Wiki - Portage with Git).
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2380

PostPosted: Thu Jun 13, 2024 1:22 pm    Post subject: Reply with quote

Xharlie wrote:
This is what `sudo emaint sync` gives me, every time:
Code:

rsync://[2a00:1828:a00d:ffff::6]/gentoo-portage? [Yes/No]



Looks like rsync related to me.

Best Regards,
Georgi
Back to top
View user's profile Send private message
Xharlie
n00b
n00b


Joined: 21 May 2017
Posts: 14

PostPosted: Fri Aug 02, 2024 6:47 am    Post subject: Reply with quote

I fiddled with `emerge` and `emaint` commands a bit, this morning, and here's what I've learned.

Firstly, this command does what I want it to do:

Code:
emerge --ask=n --sync


These, however, do not work:

Code:
emaint --ask=n sync
emaint sync --ask=n


... and so I've settled on simply reverting to `emerge --sync` and ignoring the advice in the wiki which recommends use of `emaint`, going forward.

This is not the *only* switch that `emaint` doesn't like. In fact, reverting to `emerge --sync` makes it possible – once again – to do:

Quote:
emerge --ask=n --quiet --sync
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2380

PostPosted: Fri Aug 02, 2024 7:00 am    Post subject: Reply with quote

Xharlie wrote:


... and so I've settled on simply reverting to `emerge --sync` and ignoring the advice in the wiki which recommends use of `emaint`, going forward.


According to that same wiki, if my memory serves me well, emerge --sync just calls emaint, so you should be good.

Best Regards,
Georgi
Back to top
View user's profile Send private message
Xharlie
n00b
n00b


Joined: 21 May 2017
Posts: 14

PostPosted: Fri Aug 02, 2024 7:55 am    Post subject: Reply with quote

's true. Which is why I find it remarkable that any switches to it don't work with `emaint sync ...`. One day, I'll have a Bier in hand and get around to filing an issue or a merge request to patch it.
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2380

PostPosted: Fri Aug 02, 2024 9:03 am    Post subject: Reply with quote

For what's worth, I'm using eix-sync.

It might be useful to you too.

Best Regards,
Georgi
Back to top
View user's profile Send private message
eeckwrk99
Apprentice
Apprentice


Joined: 14 Mar 2021
Posts: 226
Location: Gentoo forums

PostPosted: Fri Aug 02, 2024 9:07 am    Post subject: Reply with quote

Xharlie wrote:
's true. Which is why I find it remarkable that any switches to it don't work with `emaint sync ...`. One day, I'll have a Bier in hand and get around to filing an issue or a merge request to patch it.


There is also this issue with emaint sync:

- #553788 - sys-apps/portage: emaint sync creates no log entries in /var/log/emerge.log
- sys-apps/portage: emaint sync creates no log entries in /var/log/emerge.log
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3683
Location: Rasi, Finland

PostPosted: Fri Aug 02, 2024 9:15 am    Post subject: Reply with quote

I wonder if creating an alias or some kind of wrapper which runs
Code:
EMERGE_DEFAULT_OPTS="" emaint sync
... assuming emaint works the same way as emerge and prefers to use environment variables, if set over the ones in make.conf.
_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2380

PostPosted: Fri Aug 02, 2024 9:42 am    Post subject: Reply with quote

Zucca wrote:
I wonder if creating an alias or some kind of wrapper...


emerge --sync is already a wrapper.

Best Regards,
Georgi
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3683
Location: Rasi, Finland

PostPosted: Fri Aug 02, 2024 9:50 am    Post subject: Reply with quote

logrusx wrote:
emerge --sync is already a wrapper.

Best Regards,
Georgi
That's correct, but the code I provided sets EMERGE_DEFAULT_OPTS to an empty string, which should make emaint run without --ask.
_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2380

PostPosted: Fri Aug 02, 2024 10:10 am    Post subject: Reply with quote

Zucca wrote:
logrusx wrote:
emerge --sync is already a wrapper.

Best Regards,
Georgi
That's correct, but the code I provided sets EMERGE_DEFAULT_OPTS to an empty string, which should make emaint run without --ask.


OP said emerge --sync worked the way they wanted it to.

p.s. I'm not savvy with that stuff. Just stating facts.

Best Regards,
Georgi
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
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