Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 759067 - FEATURES=getbinpkg overrides emerge command line args: --usepkg=n --getbinpkg=n
Summary: FEATURES=getbinpkg overrides emerge command line args: --usepkg=n --getbinpkg=n
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Binary packages support (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-08 16:06 UTC by flippynelle
Modified: 2023-08-24 20:38 UTC (History)
2 users (show)

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


Attachments
allow --getbinpkg=n arg to override FEATURES=getbinpkg (1300_getbinpkg_arg.patch,1.00 KB, patch)
2020-12-09 00:03 UTC, flippynelle
Details | Diff
rev2: allow --getbinpkg=n arg to override FEATURES=getbinpkg (1300_getbinpkg_arg.patch,1.00 KB, patch)
2020-12-09 00:19 UTC, flippynelle
Details | Diff
obsoleted bad patches (ignorethisfile.txt,84 bytes, text/plain)
2020-12-09 00:39 UTC, flippynelle
Details
small bash script to test if behavior is good (test_getbinpkg.bash,5.39 KB, application/x-shellscript)
2020-12-09 02:48 UTC, flippynelle
Details
temp-patch I'm using that works for me (1300_getbinpkg_arg_3.patch,1.24 KB, patch)
2020-12-09 02:48 UTC, flippynelle
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description flippynelle 2020-12-08 16:06:18 UTC
Using command "emerge --usepkg=n --getbinpkg=n rust"
in order to avoid emerging a binpkg, doesn't work if /etc/portage/make.conf already has FEATURES=getbinpkg

ie. it wants to emerge binary pkg anyway!


Reproducible: Always

Steps to Reproduce:
1. have FEATURES=getbinpkg in /etc/portage.make.conf
2. run "emerge --usepkg=n --getbinpkg=n rust"
or: "emerge --usepkg n --getbinpkg n rust"
or: "emerge --usepkg n --getbinpkg n --getbinpkgonly=n --usepkgonly=n rust"
Actual Results:  
[binary   R    ] dev-lang/rust-1.48.0 


Expected Results:  
[ebuild   R    ] dev-lang/rust-1.48.0 


workaround:

# FEATURES=-getbinpkg emerge --usepkg=n --getbinpkg=n rust

see: https://github.com/gentoo/portage/blob/master/lib/_emerge/EbuildBuild.py#L291
or search for "#buildsyspkg" in there.

Also note that EMERGE_DEFAULT_OPTS (in make.conf) doesn't contain any usepkg or getbinpkg args
Comment 1 flippynelle 2020-12-08 16:14:09 UTC
workaround can be a bit simpler like:

FEATURES=-getbinpkg emerge --usepkg=n rust

which possibly means that only getbinpkg overriding is broken somehow.
Comment 2 flippynelle 2020-12-08 23:42:58 UTC
please ignore the github link I used before.

The problem seems to be this line: https://github.com/gentoo/portage/blob/15ac405fecf3e52ffd93d9a34e472bdc18604a4f/lib/_emerge/actions.py#L2924

    if "getbinpkg" in emerge_config.target_config.settings.features:
        emerge_config.opts["--getbinpkg"] = True

in other words, it sets "--getbinpkg" if it's set in FEATURES
but there's no code afterwards that would unset it or set it to =False if it's --getbinpkg=n on args.
Comment 3 flippynelle 2020-12-08 23:48:56 UTC
ah I see I misunderstood how it works:
emerge_config.opts["--getbinpkg"] = False
is the same as
emerge_config.opts["--getbinpkg"] = True

I guess then removing the key is what I assumed =False would do.

confirmed something like this works:
emerge_config.opts.pop("--getbinpkg", None)
Comment 4 flippynelle 2020-12-09 00:03:22 UTC
Created attachment 677344 [details, diff]
allow --getbinpkg=n arg to override FEATURES=getbinpkg

using this temp-patch until official fix is available.
Comment 5 flippynelle 2020-12-09 00:04:26 UTC
oops, I made a booboo
Comment 6 flippynelle 2020-12-09 00:19:18 UTC
Created attachment 677353 [details, diff]
rev2: allow --getbinpkg=n arg to override FEATURES=getbinpkg

fixed temp-patch

example output after:

# FEATURES=getbinpkg emerge  --getbinpkg=n --usepkg=n --pretend --ask=n rust
 * Just avoided bug https://bugs.gentoo.org/759067 where --getbinpkg=n wouldn't be considered!

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] dev-lang/rust-1.48.0 


# FEATURES=-getbinpkg emerge  --getbinpkg=n --usepkg=n --pretend --ask=n rust

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] dev-lang/rust-1.48.0 

example output before:

# FEATURES=getbinpkg emerge  --getbinpkg=n --usepkg=n --pretend --ask=n rust

These are the packages that would be merged, in order:

Calculating dependencies... done!
[binary   R    ] dev-lang/rust-1.48.0 

# FEATURES=-getbinpkg emerge  --getbinpkg=n --usepkg=n --pretend --ask=n rust

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] dev-lang/rust-1.48.0
Comment 7 flippynelle 2020-12-09 00:26:35 UTC
it's still not good.

--getbinpkg is not in emerge_config.opts even before that emerge_config.target_config.settings.features line adds it.

I should probably go to sleep for making the same mistake twice :D
Comment 8 flippynelle 2020-12-09 00:31:14 UTC
(In reply to flippynelle from comment #7)
> it's still not good.
> 
> --getbinpkg is not in emerge_config.opts even before that
> emerge_config.target_config.settings.features line adds it.
> 

actually I was wrong:
--getbinpkg is in emerge_config.opts
if arg is --getbinpkg=y or --getbinpkg
and isn't if --getbinpkg=n
which is correct!
so the only problem is that it gets overridden by the one in FEATURES at that very line in comment 2
Comment 9 flippynelle 2020-12-09 00:36:38 UTC
So wait a second:
# EMERGE_DEFAULT_OPTS= FEATURES=getbinpkg emerge  --getbinpkg=n --pretend --ask=n rust

have only: {'--pretend': True, '--regex-search-auto': 'y'}
in emerge_config.opts

this means that there's no way to detect that --getbinpkg=n was passed?
or not via emerge_config.opts
I would've expected(at first) emerge_config.opts["--getbinpkg"]=False for that --getbinpkg=n

how odd

So how would you detect that a FEATURES=getbinpkg  is overridden by command line arg --getbinpkg=n  ? since it looks like either --getbinpkg arg wasn't specified on cmdline or that getbinpkg wasn't on FEATURES

So something like --ask=n is the same as not specifying --ask=y or --ask  on command line for emerge. But how would you detect that --ask=n was specified in order to be used as an explicit override?! Something seems fundamentally wrong.
Comment 10 flippynelle 2020-12-09 00:39:55 UTC
Created attachment 677356 [details]
obsoleted bad patches
Comment 11 flippynelle 2020-12-09 00:46:13 UTC
(In reply to flippynelle from comment #9)
> So wait a second:
> # EMERGE_DEFAULT_OPTS= FEATURES=getbinpkg emerge  --getbinpkg=n --pretend
> --ask=n rust
> 
> have only: {'--pretend': True, '--regex-search-auto': 'y'}
> in emerge_config.opts
> 
> this means that there's no way to detect that --getbinpkg=n was passed?
> or not via emerge_config.opts
> I would've expected(at first) emerge_config.opts["--getbinpkg"]=False for
> that --getbinpkg=n
> 
> how odd
> 
> So how would you detect that a FEATURES=getbinpkg  is overridden by command
> line arg --getbinpkg=n  ? since it looks like either --getbinpkg arg wasn't
> specified on cmdline or that getbinpkg wasn't on FEATURES
> 
> So something like --ask=n is the same as not specifying --ask=y or --ask  on
> command line for emerge. But how would you detect that --ask=n was specified
> in order to be used as an explicit override?! Something seems fundamentally
> wrong.

ok this way still works (as long as I place it above the overriding line from comment 2):
emerge_config.opts.get('--getbinpkg')
returns "True" if --getbinpkg=y or --getbinpkg=True or --getbinpkg was used
and "None" if --getbinpkg=n was used, as emerge arg.

so this can still be fixed and there's nothing fundamentally wrong then :-"
Comment 12 flippynelle 2020-12-09 00:48:07 UTC
(In reply to flippynelle from comment #11)
> (In reply to flippynelle from comment #9)
> > So wait a second:
> > # EMERGE_DEFAULT_OPTS= FEATURES=getbinpkg emerge  --getbinpkg=n --pretend
> > --ask=n rust
> > 
> > have only: {'--pretend': True, '--regex-search-auto': 'y'}
> > in emerge_config.opts
> > 
> > this means that there's no way to detect that --getbinpkg=n was passed?
> > or not via emerge_config.opts
> > I would've expected(at first) emerge_config.opts["--getbinpkg"]=False for
> > that --getbinpkg=n
> > 
> > how odd
> > 
> > So how would you detect that a FEATURES=getbinpkg  is overridden by command
> > line arg --getbinpkg=n  ? since it looks like either --getbinpkg arg wasn't
> > specified on cmdline or that getbinpkg wasn't on FEATURES
> > 
> > So something like --ask=n is the same as not specifying --ask=y or --ask  on
> > command line for emerge. But how would you detect that --ask=n was specified
> > in order to be used as an explicit override?! Something seems fundamentally
> > wrong.
> 
> ok this way still works (as long as I place it above the overriding line
> from comment 2):
> emerge_config.opts.get('--getbinpkg')
> returns "True" if --getbinpkg=y or --getbinpkg=True or --getbinpkg was used
> and "None" if --getbinpkg=n was used, as emerge arg.
> 
> so this can still be fixed and there's nothing fundamentally wrong then :-"

NEVERMIND that! I forgot to test the case when no arg of --getbinpkg is specified in which case it returns "None"  lol  dang it!

Ideas?
Comment 13 flippynelle 2020-12-09 00:59:45 UTC
Alright, I see the problem:

    if myoptions.getbinpkg in true_y:
        myoptions.getbinpkg = True
    #else:
    #   myoptions.getbinpkg = None         

now I can get =n
Comment 14 Zac Medico gentoo-dev 2020-12-09 01:08:39 UTC
We should do something like this commit from bug 409085:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=500e0567432019835ef56e69d60266f9189c6700

This part is important because it blocks FEATURES=buildpkg from being enabled via package.env:

    settings.features.discard("buildpkg")

The special discard behavior came from here:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=13af7cb709711b00394e80b3a7a928a95133229f
Comment 15 flippynelle 2020-12-09 02:48:30 UTC
Created attachment 677371 [details]
small bash script to test if behavior is good

# time ./test_getbinpkg.bash 
good: expected 'binary' got 'binary' for 'FEATURES=-getbinpkg' and emerge arg:'--getbinpkg'
good: expected 'binary' got 'binary' for 'FEATURES=-getbinpkg' and emerge arg:'--getbinpkg=True'
good: expected 'binary' got 'binary' for 'FEATURES=-getbinpkg' and emerge arg:'--getbinpkg=y'
good: expected 'ebuild' got 'ebuild' for 'FEATURES=-getbinpkg' and emerge arg:'--getbinpkg=n'
good: expected 'ebuild' got 'ebuild' for 'FEATURES=-getbinpkg' and emerge arg:''
good: expected 'binary' got 'binary' for 'FEATURES=getbinpkg' and emerge arg:'--getbinpkg'
good: expected 'binary' got 'binary' for 'FEATURES=getbinpkg' and emerge arg:'--getbinpkg=True'
good: expected 'binary' got 'binary' for 'FEATURES=getbinpkg' and emerge arg:'--getbinpkg=y'
good: expected 'ebuild' got 'ebuild' for 'FEATURES=getbinpkg' and emerge arg:'--getbinpkg=n'
good: expected 'binary' got 'binary' for 'FEATURES=getbinpkg' and emerge arg:''
good: expected 'binary' got 'binary' for 'FEATURES=' and emerge arg:'--getbinpkg'
good: expected 'binary' got 'binary' for 'FEATURES=' and emerge arg:'--getbinpkg=True'
good: expected 'binary' got 'binary' for 'FEATURES=' and emerge arg:'--getbinpkg=y'
good: expected 'ebuild' got 'ebuild' for 'FEATURES=' and emerge arg:'--getbinpkg=n'
good: expected 'binary' got 'binary' for 'FEATURES=' and emerge arg:''
good: expected 'binary' got 'binary' for 'FEATURES=-getbinpkg' and emerge arg:'--getbinpkg'
good: expected 'binary' got 'binary' for 'FEATURES=-getbinpkg' and emerge arg:'--getbinpkg=True'
good: expected 'binary' got 'binary' for 'FEATURES=-getbinpkg' and emerge arg:'--getbinpkg=y'
good: expected 'ebuild' got 'ebuild' for 'FEATURES=-getbinpkg' and emerge arg:'--getbinpkg=n'
good: expected 'ebuild' got 'ebuild' for 'FEATURES=-getbinpkg' and emerge arg:''
good: expected 'binary' got 'binary' for 'FEATURES=getbinpkg' and emerge arg:'--getbinpkg'
good: expected 'binary' got 'binary' for 'FEATURES=getbinpkg' and emerge arg:'--getbinpkg=True'
good: expected 'binary' got 'binary' for 'FEATURES=getbinpkg' and emerge arg:'--getbinpkg=y'
good: expected 'ebuild' got 'ebuild' for 'FEATURES=getbinpkg' and emerge arg:'--getbinpkg=n'
good: expected 'binary' got 'binary' for 'FEATURES=getbinpkg' and emerge arg:''
good: expected 'binary' got 'binary' for 'FEATURES=' and emerge arg:'--getbinpkg'
good: expected 'binary' got 'binary' for 'FEATURES=' and emerge arg:'--getbinpkg=True'
good: expected 'binary' got 'binary' for 'FEATURES=' and emerge arg:'--getbinpkg=y'
good: expected 'ebuild' got 'ebuild' for 'FEATURES=' and emerge arg:'--getbinpkg=n'
good: expected 'ebuild' got 'ebuild' for 'FEATURES=' and emerge arg:''
All ok.

real	1m13.876s
user	1m10.832s
sys	0m3.104s
Comment 16 flippynelle 2020-12-09 02:48:57 UTC
Created attachment 677377 [details, diff]
temp-patch I'm using that works for me
Comment 17 Sebastian Parborg 2022-10-21 13:27:05 UTC
Any update on this?

I'm running into the same issue.
I have setup a binhost, but I sometimes want to debug packages.
That FEATURES=getbinpkg trumps both the merge option flags and package.env settings makes this quite tedious.