Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 672914 - sys-apps/portage: add emerge --rebuild-if-conflict option
Summary: sys-apps/portage: add emerge --rebuild-if-conflict option
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Portage team
Depends on:
Blocks: 300071
  Show dependency tree
Reported: 2018-12-11 05:12 UTC by Zac Medico
Modified: 2021-02-05 07:37 UTC (History)
4 users (show)

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


Note You need to log in before you can comment on or make changes to this bug.
Description Zac Medico gentoo-dev 2018-12-11 05:12:21 UTC
The idea is that conflicts often involve packages that simply need to be rebuilt, so it would be nice to have an option to trigger the rebuild automatically.
Comment 1 Zac Medico gentoo-dev 2018-12-25 20:14:56 UTC
In order to solve blockers, some packages may need to be removed rather than rebuilt or upgraded, and for these packages some alternative to the existing @__auto_slot_operator_replace_installed__ set will be needed.
Comment 2 Zac Medico gentoo-dev 2018-12-25 21:24:33 UTC
(In reply to Zac Medico from comment #1)
> In order to solve blockers, some packages may need to be removed rather than
> rebuilt or upgraded, and for these packages some alternative to the existing
> @__auto_slot_operator_replace_installed__ set will be needed.

The existing package.mask behavior is close to the desired behavior for @__auto_slot_operator_replace_installed__, since package.mask is effective for operations like replacing pycrypto with pycryptodome. Also, package.mask allows for fallback to the installed instance when no other option is available. We may be need a mechanism to eliminate unnecessary rebuilds, like this code from bug 439688:
Comment 3 Zac Medico gentoo-dev 2018-12-31 03:23:07 UTC
I have experimented with using the slot_operator_mask_built backtracking info to trigger rebuilds when necessary. Very few changes were necessary, and I was able to get all existing unit tests to pass. The depgraph._complete_graph method pulls a given rebuild into the graph only if it's reachable from @world. The _complete_graph package selection configuration only chooses from the packages that are already installed or in the graph. It needs to be fixed to use the appropriate package selection configuration for packages that are intended to be rebuilt (this also applies to installed packages when we need to uninstall packages in order to solve conflicts, like when transitioning installed packages to use pycryptodome instead of pycrypto).
Comment 4 Zac Medico gentoo-dev 2019-01-01 02:21:50 UTC
During _complete_graph execution, package selection rules need to be like this:

Default behavior is to select packages only from those that are already installed or have already been added to the graph.

Enable all available package sources if any of the following is true:
1) The parent package is not installed yet.
2) The current atom matches a package tagged for rebuild via backtrack parameters.
Comment 5 Zac Medico gentoo-dev 2019-01-01 02:38:30 UTC
Also, if the parent package is already installed and has a disjunctive dependency group (|| dep) where a package tagged for rebuild is among the choices, then enable all available package sources for all choices in the disjunctive dependency group.

This is needed for cases where a package tagged for rebuild (or possible removal) needs to be removed, and disjunctive dependency groups that this package had previously satisfied need to be re-evaluated.