We can sort the --unmerge order for determinism, it's what we do in for determism in various parts of dependency calculation.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=9946517f1e0ee35b2a6eed1ff6c1fd10acf8fd45 commit 9946517f1e0ee35b2a6eed1ff6c1fd10acf8fd45 Author: Felix Bier <flx.bier@gmail.com> AuthorDate: 2021-05-09 23:27:19 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2021-05-24 06:22:30 +0000 Sort emerge --unmerge order for determinism This commit changes the order in which packages are uninstalled with --unmerge to be deterministic. Before this commit, when an atom specified with --unmerge matches multiple versions, these versions were uninstalled in a random order. For example, when some-pkg-1.0.0 and some-pkg-2.0.0 are installed, then running emerge --unmerge some-pkg will unmerge 1.0.0 and 2.0.0 in a random order. With this commit, when an atom matches multiple versions, they are uninstalled in a sorted order. So in the above example, 1.0.0 will be unmerged before 2.0.0. This does not affect the order specified on the command-line, for example when running: emerge --unmerge =some-pkg-2.0.0 =some-pkg-1.0.0 that order is respected, as before this commit. Similarly, when uninstalling multiple different packages, e.g.: emerge --unmerge some-pkg some-other-pkg the sorting only applies to the versions matching each atom, so the versions matching some-pkg are sorted separately from the versions matching some-other-pkg, and since some-pkg is specified before some-other-pkg, its versions will be uninstalled first. Motivation: When a package has a custom pkg_postrm hook, uninstalling multiple versions in a random order can leave the filesystem in a different state depending on which version is uninstalled last. When running emerge as part of a larger build system such as catalyst, this is an obstacle towards reproducible builds. Bug: https://bugs.gentoo.org/782724 Signed-off-by: Felix Bier <felix.bier@rohde-schwarz.com> Signed-off-by: Zac Medico <zmedico@gentoo.org> lib/_emerge/PackageUninstall.py | 2 +- lib/_emerge/unmerge.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cba21902d9a8d1ac07d2ff5b0d932e71fc1fac67 commit cba21902d9a8d1ac07d2ff5b0d932e71fc1fac67 Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2021-05-24 07:47:11 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2021-05-24 09:05:08 +0000 sys-apps/portage: Bump to version 3.0.19 #520378: allow emerge --fetchonly to log to emerge-fetch.log #698244: portage(5) document user patch / eapply_user #781854: Suggest PORTAGE_LOG_FILTER_FILE_CMD cat fallback #782724: sort emerge --unmerge order for determinism #783957: lazily evaluate cnf_* variables in tests #784566: make emerge insensitive to relative order of optional and positional arguments #787545: emerge CTRL C may be ignored when running pkg_pretend #787563: ebuild-ipc could handle KeyboardInterrupt #788967: emerge --jobs= triggers TypeError Bug: https://bugs.gentoo.org/785484 Bug: https://bugs.gentoo.org/788967 Bug: https://bugs.gentoo.org/787563 Bug: https://bugs.gentoo.org/787545 Bug: https://bugs.gentoo.org/784566 Bug: https://bugs.gentoo.org/783957 Bug: https://bugs.gentoo.org/782724 Bug: https://bugs.gentoo.org/781854 Bug: https://bugs.gentoo.org/698244 Bug: https://bugs.gentoo.org/520378 Package-Manager: Portage-3.0.18, Repoman-3.0.3 Signed-off-by: Zac Medico <zmedico@gentoo.org> sys-apps/portage/Manifest | 1 + sys-apps/portage/portage-3.0.19.ebuild | 266 +++++++++++++++++++++++++++++++++ 2 files changed, 267 insertions(+)