diff options
author | YiFei Zhu <zhuyifei1999@gmail.com> | 2023-06-12 17:47:52 -0700 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-06-16 04:34:46 +0100 |
commit | 224207c7d1988a354d004507bb7ecfb90b4ef097 (patch) | |
tree | 93e09d733ec58906da7d527a7a6f26acbd36b648 /lib/_emerge/depgraph.py | |
parent | tests: resolver: Test the broken behavior of Perl rebuild bug (diff) | |
download | gentoo-portage-224207c7d1988a354d004507bb7ecfb90b4ef097.tar.xz gentoo-portage-224207c7d1988a354d004507bb7ecfb90b4ef097.zip |
depgraph: Do not allow slotted deps to be satisfied by wrong slots
This may be part of what caused the "perl rebuild bug". The
"priority" of perl, when seen by perl modules, may have "satisfied"
set to an installed perl of a wrong slot. Compounding this factor
with bug #756199 where find_smallest_cycle would select a single
node, in this case because the dependency of perl is satisfied and
the priority then gets ignored, the "cycle" becomes a perl module
alone and gets rebuilt early.
I also updated the test from the previous patch to account for
this change. No other tests seems affected.
For a larger scale test, I reproduced this initially with a stage3
chroot from a Jan 1 2022 stage3 snapshot, and testing in an
equivalent dockerfile would work too:
FROM gentoo/stage3:amd64-openrc-20220101
RUN emerge-webrsync
COPY . /portage
Before this patch (USE flags omitted):
# cd /portage && bin/emerge -puDN @world 2>&1 | grep -i perl
[ebuild U ] app-admin/perl-cleaner-2.30-r1 [2.30]
[ebuild rR ] virtual/perl-File-Temp-0.231.100
[ebuild rR ] dev-perl/Locale-gettext-1.70.0-r1
[ebuild rR ] dev-perl/MIME-Charset-1.12.2-r1
[ebuild rR ] dev-perl/Module-Build-0.423.100
[ebuild rR ] dev-perl/Text-CharWidth-0.40.0-r2
[ebuild U ] dev-lang/perl-5.36.0-r2 [5.34.0-r3]
[ebuild N ] virtual/perl-CPAN-2.330.0
[ebuild U ] virtual/perl-ExtUtils-MakeMaker-7.640.0 [7.620.0]
[ebuild U ] virtual/perl-File-Spec-3.840.0 [3.800.0]
[...]
After this patch:
# cd /portage && bin/emerge -puDN @world 2>&1 | grep -i perl
[ebuild U ] app-admin/perl-cleaner-2.30-r1 [2.30]
[ebuild U ] dev-lang/perl-5.36.0-r2:0/5.36 [5.34.0-r3:0/5.34]
[ebuild N ] virtual/perl-CPAN-2.330.0
[ebuild U ] virtual/perl-ExtUtils-MakeMaker-7.640.0 [7.620.0]
[ebuild U ] virtual/perl-Data-Dumper-2.184.0 [2.179.0]
[ebuild U ] virtual/perl-File-Spec-3.840.0 [3.800.0]
[ebuild U ] virtual/perl-Test-Harness-3.440.0-r1 [3.430.0]
[ebuild rR ] dev-perl/Pod-Parser-1.630.0-r1
[ebuild rR ] dev-perl/Text-CharWidth-0.40.0-r2
[ebuild rR ] dev-perl/Text-WrapI18N-0.60.0-r2
[...]
Bug: https://bugs.gentoo.org/463976
Bug: https://bugs.gentoo.org/592880
Bug: https://bugs.gentoo.org/596664
Bug: https://bugs.gentoo.org/631490
Bug: https://bugs.gentoo.org/764365
Bug: https://bugs.gentoo.org/793992
Signed-off-by: YiFei Zhu <zhuyifei1999@gmail.com>
Closes: https://github.com/gentoo/portage/pull/1055
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'lib/_emerge/depgraph.py')
-rw-r--r-- | lib/_emerge/depgraph.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 60e57b226052..28acfed9d4c9 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -4042,6 +4042,16 @@ class depgraph: inst_pkg, modified_use=self._pkg_use_enabled(inst_pkg) ) ] + # Do not allow slotted deps to be satisfied by wrong slots. + # Otherwise, slot-operator-dependent packages may rebuild + # before the slotted package they are dependent on. + if child and atom.slot_operator == "=": + inst_pkgs = [ + inst_pkg + for inst_pkg in inst_pkgs + if inst_pkg.slot == child.slot + and inst_pkg.sub_slot == child.sub_slot + ] if inst_pkgs: for inst_pkg in inst_pkgs: if self._pkg_visibility_check(inst_pkg): @@ -4161,6 +4171,14 @@ class depgraph: inst_pkg, modified_use=self._pkg_use_enabled(inst_pkg) ) ] + # Do not allow slotted deps to be satisfied by wrong slots. + if child and atom.slot_operator == "=": + inst_pkgs = [ + inst_pkg + for inst_pkg in inst_pkgs + if inst_pkg.slot == child.slot + and inst_pkg.sub_slot == child.sub_slot + ] if inst_pkgs: for inst_pkg in inst_pkgs: if self._pkg_visibility_check(inst_pkg): |