Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 793992 - Portage performs perl subslot rebuilds before upgrading perl
Summary: Portage performs perl subslot rebuilds before upgrading perl
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Dependencies (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on: 756199 907949
Blocks: build-order
  Show dependency tree
 
Reported: 2021-06-03 03:18 UTC by Khumba
Modified: 2023-09-09 21:13 UTC (History)
3 users (show)

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


Attachments
emerge --info (emerge-info.txt,7.40 KB, text/plain)
2021-06-03 03:18 UTC, Khumba
Details
emerge -puvDU @world (emerge-puvDU-world.log,21.88 KB, text/x-log)
2021-06-03 03:18 UTC, Khumba
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Khumba 2021-06-03 03:18:05 UTC
If package A has a := dependency on package B, then when B is scheduled for upgrade, is it valid for Portage to rebuild A before upgrading B?

I'm hitting this case on a couple of my machines, with the perl 5.30.3 to 5.32.1 upgrade.  When I run 'emerge -puvDU @world', Portage wants to rebuild several dev-perl/* and virtual/perl-* packages [rR] before building dev-lang/perl [rU].  At best, the initial rebuilds look redundant, but this disagrees with how I understand subslot rebuilds to work.

A section of the emerge pretend output is as follows, the full log is attached:

> ... (53 other packages, mostly perl things) ...
> [ebuild  rR    ] dev-perl/TimeDate-2.330.0::gentoo  0 KiB
> [ebuild  rR    ] perl-core/File-Temp-0.230.900::gentoo  74 KiB
> [ebuild     U  ] dev-perl/Digest-HMAC-1.30.0-r2::gentoo [1.30.0-r1::gentoo] 0 KiB
> [ebuild     U  ] sys-devel/automake-1.16.3-r1:1.16::gentoo [1.16.2-r1:1.16::gentoo] USE="-test" 1,554 KiB
> [ebuild  rR    ] dev-perl/Module-Build-0.422.400::gentoo  USE="-test" 298 KiB
> [ebuild  rR    ] dev-perl/Locale-gettext-1.70.0::gentoo  9 KiB
> [ebuild  r  U  ] dev-lang/perl-5.32.1:0/5.32::gentoo [5.30.3:0/5.30::gentoo] USE="berkdb gdbm -debug -doc -ithreads -minimal%" 12,442 KiB
> [ebuild     U  ] dev-vcs/git-2.31.1::gentoo [2.26.3::gentoo] USE="blksha1 curl emacs gpg iconv nls pcre perl threads tk webdav -cgi -cvs -doc -gnome-keyring -highlight -mediawiki -mediawiki-experimental -perforce (-ppcsha1) -subversion -test -xinetd (-pcre-jit%*)" PYTHON_SINGLE_TARGET="python3_8 -python3_7 -python3_9%" 6,740 KiB
> [ebuild  rR    ] dev-perl/IPC-System-Simple-1.250.0::gentoo  USE="-test" 0 KiB
> ...
> The following packages are causing rebuilds:
> 
>   (dev-lang/perl-5.32.1:0/5.32::gentoo, ebuild scheduled for merge) causes rebuilds for:
>     ...
>     (dev-perl/Locale-gettext-1.70.0:0/0::gentoo, ebuild scheduled for merge)
>     ...

dev-lang/perl-5.32.1 has PDEPEND on some virtual/perl-* packages, but at least I don't see why Locale-gettext couldn't be built after perl.

Portage wanted to do this on two of three of my machines.  On one where I went ahead with the world upgrade, the upgrade went smoothly, though a subsequent 'emerge -puvDU @world' now wants to rebuild those too-early packages again.

On the remaining machine, disabling dynamic deps and adding --changed-deps=y doesn't change the build plan.  Portage reports that libxml2 can't be updated due to dependency constraints, not sure if that's related.  I'm happy to post the compressed 'emerge --debug' log if that'll help, it's 1.7M.

Or maybe this is just a corner case that Portage is handling correctly?

Thanks!
Comment 1 Khumba 2021-06-03 03:18:39 UTC
Created attachment 713379 [details]
emerge --info
Comment 2 Khumba 2021-06-03 03:18:59 UTC
Created attachment 713382 [details]
emerge -puvDU @world
Comment 3 Zac Medico gentoo-dev 2021-06-07 23:48:43 UTC
Things like this are triggered by bug 756199.
Comment 4 Larry the Git Cow gentoo-dev 2023-06-16 03:34:52 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=224207c7d1988a354d004507bb7ecfb90b4ef097

commit 224207c7d1988a354d004507bb7ecfb90b4ef097
Author:     YiFei Zhu <zhuyifei1999@gmail.com>
AuthorDate: 2023-06-13 00:47:52 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-06-16 03:34:46 +0000

    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>

 lib/_emerge/depgraph.py                             | 18 ++++++++++++++++++
 lib/portage/tests/resolver/test_perl_rebuild_bug.py |  4 ++--
 2 files changed, 20 insertions(+), 2 deletions(-)

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

commit ff457f742b513a65e6609054e5310f8beee488ec
Author:     YiFei Zhu <zhuyifei1999@gmail.com>
AuthorDate: 2023-06-13 08:08:51 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-06-16 03:34:46 +0000

    tests: resolver: Test the broken behavior of Perl rebuild bug
    
    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>
    Signed-off-by: Sam James <sam@gentoo.org>

 .../tests/resolver/test_perl_rebuild_bug.py        | 121 +++++++++++++++++++++
 1 file changed, 121 insertions(+)
Comment 5 Larry the Git Cow gentoo-dev 2023-06-21 19:12:57 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9502761c5bef818dbec90f062909d46dc22289df

commit 9502761c5bef818dbec90f062909d46dc22289df
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-06-21 19:09:31 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-06-21 19:11:05 +0000

    sys-apps/portage: add 3.0.49
    
    Closes: https://bugs.gentoo.org/485100
    Cloess: https://bugs.gentoo.org/592880
    Closes: https://bugs.gentoo.org/596664
    Closes: https://bugs.gentoo.org/631490
    Closes: https://bugs.gentoo.org/764365
    Closes: https://bugs.gentoo.org/793992
    Closes: https://bugs.gentoo.org/890812
    Closes: https://bugs.gentoo.org/905660
    Closes: https://bugs.gentoo.org/907949
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-3.0.49.ebuild | 296 +++++++++++++++++++++++++++++++++
 2 files changed, 297 insertions(+)