-
Notifications
You must be signed in to change notification settings - Fork 279
Binary package selection #1527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Binary package selection #1527
Conversation
lib/_emerge/actions.py
Outdated
| pkgsettings = portage.config(clone=emerge_config.target_config.settings) | ||
| for cp in penvdict: | ||
| for atom, env in penvdict[cp].items(): | ||
| pkgsettings.setcpv(atom) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suspect this is probably not correct in that other uses of setcpv() usually pass a _pkg_str or Package rather than Atom. Suggestions welcome!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it seems that we only access pkgsettings.features, maybe we could add an optimized pkgsettings.features_contains(atom, feature) method to call here.
|
For what it's worth, this approach has been taken for a few of reasons:
In discussions in #gentoo-portage it seemed pretty clear there was a desire for FEATURES set via package.env to be the mechanism to achieve this, so I've tried to achieve that too (yup still needs some work). The primary challenge around this is that package.env is not really in play during the population of the binary tree or dependency resolution, as I think has been noted already on the above linked bug. I did also try this, which seemed like an easy win: This works provided -g is also forced. However, it is seriously non-performant. On under-powered systems, which are presumably bigger users of binary packages, executing binarytree.populate_remote() goes from ~3 seconds to almost 40 seconds (timing on core i5 limited to 800 MHz). So Using package.env to imply |
I think some people felt that way but I didn't at least. Having a proper config file for this doesn't really seem to have any downsides other than needing to document it, and has upsides like making scripting a bit easier, and letting us add in more information/options in future. Having more files with a specific purpose rather than "god files" is something I'm trying to steer us towards. It's also taken a while to get It may well cause other problems if there's contexts where Compare this to how we previously had TL;DR: I don't think we should concern ourselves with |
|
My perception (as a user) is that package.env is a means to influence the build environment more than emerge itself, but Put another way... It would be much easier to close out this change without support for package.env. While I've got the package specific FEATURES="getbinpkg" thing to sort of work, I cannot clearly see the "right" path to implementing it yet. Without it, the loose ends here are hopefully more like tidy up and admin. |
FTR, while I do feel this way, it's less about "it's a good UX" and more that I think it's an absolutely terrible UX for something to be in FEATURES in make.conf but silently ignored in package.env. (The obvious response to this is "Hey Eli betcha didn't know this other thing also gets ignored in package.env" but don't worry, I think that's terrible too. :D) I daresay I'd also be happy with the compromise option "we will raise a configuration validation error that aborts emerge if you put certain FEATURES in package.env". And maybe, that will run late enough that it's already loaded so "slowdown problem SOLVED". |
|
That could indeed work out (though I wouldn't necessarily ask @jeth-ro to do it as part of this PR). |
57b10be to
faba6b3
Compare
|
Updates:
When a command line option overrides something from repos.conf or binrepos.conf then a warning is issued to that effect. For example, using "Conflicting" means a non-empty intersection of the include and exclude package sets, as dictated by whatever the Emerge will continue after all these warnings. For conflicts in repos.conf or binrepos.conf the behaviour may not be as expected (exclude wins), but the user is at least made aware. Atoms with unsupported adornments are ignored after the warning, but valid atoms on the same attribute remain in effect. No warnings have been added for conflicting include/exclude lists on the command line, or for use of these options on the command line without I believe this covers off my initial list of "obvious problems" :) |
|
Will continue looking at additional tests for now, but if nobody objects by the time I finish that I will look to drop the below commit and so remove the package specific FEATURES=getbinpkg attempt from this change.
Am happy to open another a separate pull request for that and to look at what can be done to either support this or at least add warnings as discussed above, but would ideally like to progress this change first. |
|
A passing thought... Would This might be of limited utility as would only reflect the current config, but perhaps there are use cases if said config is relatively static. For example, |
|
I don't really care about the list of configured atoms. But I do fairly often run emerge --pretend --getbinpkg to check which packages are currently available as binaries, and then rerun without --pretend, with those copy pasted packages. So perhaps I'd like an |
|
I believe that In the case of So I think I'm missing something as you say you are doing this already. When if I run |
I think that you're overthinking this a lot. I have 5 leaf packages in my world file. Two of them are available right now as binaries, and three are not available as binaries. All of them have gotten new version bumps. A theoretical Recursive dependencies either don't exist or for the purpose of this discussion already have binaries if the leaf package does. Edit: |
|
i.e. it's in the realm of helping bug 924772. |
|
I will give this a closer look shortly (next few days). I think we've converged on the design and functionality (though I can't promise I won't have a thought involving those). Could you add some tests now for making sure these options (inc. combinations of cmdline and config) do what we want? The The tests where you want to check for binaries from a specific repo will require a little more work, I think, like I'm doing over there. Note that in that PR, because of what it implements, it does not contain the easier form you can use here too. See |
|
Yeah, I may be overthinking it :) I haven't yet run into #924772 myself, so had not appreciated that complexity. My usage of binpkgs is pretty light, thus the desire for a whitelist. @thesamesam - assuming looking closer means code changes, here's a few things I'm pretty sure I've not take the ideal approach with. Stlil don't know the code very well...
Might still be overthinking... Thanks both! |
|
@zmedico Would you mind taking a look at the above? |
The _frozen_config state is shared for all depgraph instances created during backtracking. If you mutate it in a way that is consistent across all backtracking runs, then it won't do any harm.
Imports from imports from _emerge into portage are perfectly fine. |
faba6b3 to
e59c4cd
Compare
| with open(os.path.join(self.eprefix, USER_CONFIG_PATH, "repos.conf")) as f: | ||
| env["PORTAGE_REPOSITORIES"] = f.read() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did not think this should be necessary as repos.conf is now always written to the resolver playground's temporary environment, but many (not all) unrelated tests failed without this environment variable set.
| "use.force", | ||
| "use.mask", | ||
| "use.stable", | ||
| "layout.conf", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing duplicate, otherwise unrelated to this change.
| bintree = binarytree(pkgdir=self.pkgdir, settings=self.settings) | ||
| bintree.populate(force_reindex=True) | ||
| bintree = binarytree(pkgdir=repo_dir, settings=self.settings) | ||
| bintree.populate(force_reindex=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did not think it necessary to call populate for every binpkg created, once at the end seems to work too?
|
So this has required a bit surgery on
The tests I've included cover the effects of the command line options and settings in A few other things have occurred to me along the way:
The |
I can see this being quite long, so I'm inclined to say no.
I agree. Let's start with ignoring it.
I'm not sure I follow this yet? Do you mean just for testing? |
Alternatively a single line indicating that such options are set? Only suggest as potentially helpful for support.
I guess I'm just seeking to confirm we really do want repository and binhost specific configuration, or whether the global behaviour of the command line options might (a) enough for many use cases and (b) less confusing for users. That said, I ought to get to the bottom of how I've managed to break the tests for CI and not myself. It seemed all ship shape when I posted the above comment, but it's possible that (b) only applies to me ;) |
|
EDIT: We discussed it more on IRC. |
e59c4cd to
70cde7e
Compare
|
Latest changes:
There are now numerous checks and reconciliations between command line options and *.conf files and these are currently implemented in depgraph.py (as part of Happy to look at moving those checks up the stack, e.g. into action.py, but have not done it yet as it's not entirely trivial. Specifically, the package sets built immediately prior said checks are not available earlier. |
Facilitate selection of specific binary packages during a build action, with all others to be satisfied by ebuilds. Has no effect unless -k is specified or implied. This is the logical inverse of existing argument --usepkg-exclude. Signed-off-by: Jethro Donaldson <[email protected]>
Shorthand for emerge --usepkg-include <pkgs> <pkgs> for installing from a binary package without allowing portage to pull any binary packages to satisfy dependencies. Has no effect without -k. Signed-off-by: Jethro Donaldson <[email protected]>
If --pretend is in effect with --getbinpkgs then keep cached binary package index in play even if the remote repository is unreachable. This allows emerge to still show what it would do when the binhost is available. Signed-off-by: Jethro Donaldson <[email protected]>
Provide visual feedback to the user as to whether a selected binary package is local or remote. The symbol 'g' is used to indicate that a remote binary will be fetched due to --getbinpkg, and is shown in the same place as 'f' or 'F'. These flags represent a similar concept yet should never shown for remote binaries, but will still be shown preferentially should they somehow be applicable. Signed-off-by: Jethro Donaldson <[email protected]>
Allow specification of which binary packages can or cannot be satisfied using remote binary packages, with a interface consistent with the --usepkg-include and --usepkg-exclude options. These additional options influence fetching of remote binaries only and have no effect unless -g is also supplied or implied. Signed-of-by: Jethro Donaldson <[email protected]> Suggested-by: Sam James <[email protected]>
Allow configuration in repos.conf of specific packages which are to be satisfied (or not) using binary packages. These attributes appear under the repository section and are specific to that repository, with behaviour otherwise identical to the command line arguments of the same name. Where atoms specified with usepkg-exclude or usepkg-include in repos.conf match those for the opposing command line options then emit a warning and override the repos.conf atoms. Signed-off-by: Jethro Donaldson <[email protected]>
Allow configuration in binrepos.conf of specific packages which are to be satisfied (or not) using remote binary packages. These attributes appear under the repository section and are specific to that binary package host, with the behaviour otherwise identical to the command line arguments of the same name. Where atoms specified with getbinpkg-exclude or getbinpkg-include in binrepos.conf match those for the opposing command line options then emit a warning and override the binrepos.conf atoms. Signed-off-by: Jethro Donaldson <[email protected]> Suggested-by: Sam James <[email protected]>
70cde7e to
6deca6f
Compare
Above is fixed; validation of *.conf files now in I might still prefer to not have |
A number of changes towards the end goal of more granular control over which packages are to be installed using binary packages instead of ebuilds.
Extend emerge command line interface with the following options:
--usepkg-include <atoms>defines a whitelist for binary packages (complements existing--usepkg-excludeoption)--getbinpkg-exclude <atoms>defines blacklist for remote binary packages--getbinpkg-include <atoms>defines whitelist for remote binary packages--nobindepsuses install target as the binary package whitelistNo effect without -k or -g.
Extend repos.conf syntax with the following attributes:
usepkg-excludeconfigures a persistent and repository specific blacklist for binary packagesusepkg-includeconfigures a persistent and repository specific whitelist for binary packagesNo effect without -k.
Extend binrepos.conf syntax with the following attributes:
getbinpkg-excludeconfigures a persistent and binhost specific blacklist for remote binary packagesgetbinpkg-includeconfigures a persistent and binhost specific whitelist for remote binary packagesNo effect without -g.
Populate an implicit
--getbinpkg-includelist from any packages withFEATURES="getbinpkg"set in package.env and also imply-gif said list is not empty (see bug #463964).Only works in absence of -g or FEATURES=getbinpkg (in make.conf or emerge process environment) both of which still have global effect.
Add visible indication in emerge output of when remote binary packages are being used by showing a
gflag in the same place asfandFwould appear for fetch restrict ebuilds.Finally, have slipped in allowing the local cache of a binhost pkgindex to persist when said host is unreachable provided the
--pretendoption is in effect. This might not be desired, but I found this behaviour useful.No tests yet, but will look at that if there is interest in actually merging this. For now have done my best to ensure existing tests still pass.
There remain a number of obvious problems, and no doubt others:
--usepkg-includewithout-kor--getbinpkg-includewithout-g--usepkg-includeand--usepkg-exclude, etcWill tackle these things if it looks like this will go anywhere, but felt I'd taken this far enough to seek feedback.