sys-apps/portage: Sync with Gentoo

It's from Gentoo commit 8268e0f97659df9423656980881236013b68c829.

Signed-off-by: Flatcar Buildbot <buildbot@flatcar-linux.org>
This commit is contained in:
Flatcar Buildbot 2026-05-11 08:18:45 +00:00
parent 440dffdd48
commit 71ece8c818
9 changed files with 336 additions and 557 deletions

View File

@ -1,2 +1,2 @@
DIST portage-3.0.72.tar.bz2 1211406 BLAKE2B ccf702bc56bab905d6ec9b99175bb86be95709761d370afeeb8edf9aa563869d8d8c98256224a054697a996a7b97dc9a3dfc8e993760aeec13a0ac4705dc78c5 SHA512 c58f5216b3587e1cfcf1998e719f847e1ba1938b7aeb4fcd9fb4e22e1cba68a9e3b98125c1c1386fc03954fc90559d2647a3a00ae2ab4b74692ee6a1d81eea66
DIST portage-3.0.77.tar.bz2 1222765 BLAKE2B 062b99059582caf323001b14e74d5ad762aeb4ece9750dcd548b4eddacabea60044dbb8006911c458c2550b7f1f86a5e91c5f0f67b37a3c839a1d7bac751376c SHA512 bae4d30d53473402a90c21923c71e81463e0f1afc1300f194d67b1af109eca71bd52ca82a1c17881871b9c30a64d584eb0392daab81b38c622cb2384afd195b7
DIST portage-3.0.78.tar.bz2 1234503 BLAKE2B fecc7def9d2b3cbeb022a1807f9f3db643b4000b1c9674bf2306f6a7b13ef163f7243c9f62e035ef1c0ee5d49f2fdd25b63ff6ae100c9adf59fd3c9352e80410 SHA512 38243d05ad6d253275f19e7c90bc527fe63f6c26a82e7135c603f853612af42c1038ae3269637049ba7212e9caebfe80004d735c02c84882a35fdbc48d3777de

View File

@ -1,77 +0,0 @@
From d7d6fd54f1c936e89c5e4467c6c1f33b217325ca Mon Sep 17 00:00:00 2001
Message-ID: <d7d6fd54f1c936e89c5e4467c6c1f33b217325ca.1766045192.git.sam@gentoo.org>
From: Sam James <sam@gentoo.org>
Date: Tue, 16 Dec 2025 09:36:27 +0000
Subject: [PATCH] bin: emerge, ebuild: don't define signal handlers in global
scope
This breaks when `emerge` is frozen. Do what we do in `egencache`. We
do need to use the same boilerplate in all bin/* though...
Bug: https://bugs.gentoo.org/941956
Bug: https://bugs.gentoo.org/967199
Signed-off-by: Sam James <sam@gentoo.org>
---
bin/ebuild | 10 +++++-----
bin/emerge | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/bin/ebuild b/bin/ebuild
index 0c6369e016..3fc6e334cb 100755
--- a/bin/ebuild
+++ b/bin/ebuild
@@ -22,11 +22,6 @@ def debug_signal(_signum, _frame):
pdb.set_trace()
-# Prevent "[Errno 32] Broken pipe" exceptions when writing to a pipe.
-signal.signal(signal.SIGPIPE, signal.SIG_DFL)
-signal.signal(signal.SIGTERM, signal_interrupt)
-signal.signal(signal.SIGUSR1, debug_signal)
-
import argparse
from os import path as osp
import shlex
@@ -61,6 +56,11 @@ from _emerge.RootConfig import RootConfig
def main():
+ # Prevent "[Errno 32] Broken pipe" exceptions when writing to a pipe.
+ signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+ signal.signal(signal.SIGTERM, signal_interrupt)
+ signal.signal(signal.SIGUSR1, debug_signal)
+
portage.process.sanitize_fds()
description = "See the ebuild(1) man page for more info"
usage = "Usage: ebuild <ebuild file> <command> [command] ..."
diff --git a/bin/emerge b/bin/emerge
index 9e5d59cb04..d4f50fa9a3 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -22,11 +22,6 @@ def debug_signal(_signum, _frame):
pdb.set_trace()
-# Prevent "[Errno 32] Broken pipe" exceptions when writing to a pipe.
-signal.signal(signal.SIGPIPE, signal.SIG_DFL)
-signal.signal(signal.SIGTERM, signal_interrupt)
-signal.signal(signal.SIGUSR1, debug_signal)
-
from os import path as osp
if osp.isfile(
@@ -46,6 +41,11 @@ from _emerge.main import emerge_main
def main():
+ # Prevent "[Errno 32] Broken pipe" exceptions when writing to a pipe.
+ signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+ signal.signal(signal.SIGTERM, signal_interrupt)
+ signal.signal(signal.SIGUSR1, debug_signal)
+
portage.process.sanitize_fds()
try:
retval = emerge_main()
--
2.52.0

View File

@ -0,0 +1,259 @@
From e1322d74de41e989f709e0129ac41e5469b9cc4c Mon Sep 17 00:00:00 2001
Message-ID: <e1322d74de41e989f709e0129ac41e5469b9cc4c.1775418696.git.sam@gentoo.org>
From: Zac Medico <zmedico@gentoo.org>
Date: Fri, 20 Feb 2026 19:05:12 -0800
Subject: [PATCH] Revert "depgraph: earlier slot operator backtracking"
This reverts commit 8ddd35e04bb4c50a85d7cc61edb85d91dd10ce4b.
Bug: https://bugs.gentoo.org/969654
Bug: https://bugs.gentoo.org/964705
Bug: https://bugs.gentoo.org/968228
Signed-off-by: Zac Medico <zmedico@gentoo.org>
---
lib/_emerge/depgraph.py | 152 +++++++++---------
.../test_binpackage_downgrades_slot_dep.py | 3 +
.../tests/resolver/test_missed_update.py | 3 +
3 files changed, 86 insertions(+), 72 deletions(-)
diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index 7ac07ad5e..5d9888229 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -1937,9 +1937,16 @@ class depgraph:
# conflicts (or by blind luck).
raise self._unknown_internal_error()
+ # Both _process_slot_conflict and _slot_operator_trigger_reinstalls
+ # can call _slot_operator_update_probe, which requires that
+ # self._dynamic_config._blocked_pkgs has been initialized by a
+ # call to the _validate_blockers method.
for conflict in self._dynamic_config._package_tracker.slot_conflicts():
self._process_slot_conflict(conflict)
+ if self._dynamic_config._allow_backtracking:
+ self._slot_operator_trigger_reinstalls()
+
def _process_slot_conflict(self, conflict):
"""
Process slot conflict data to identify specific atoms which
@@ -2895,50 +2902,50 @@ class depgraph:
return None
- def _slot_operator_trigger_backtracking(self, dep: Dependency) -> bool:
+ def _slot_operator_trigger_reinstalls(self):
"""
- Trigger backtracking for slot operator issues if needed.
- Return True if this triggers backtracking, and False otherwise.
+ Search for packages with slot-operator deps on older slots, and schedule
+ rebuilds if they can link to a newer slot that's in the graph.
"""
- if not self._dynamic_config._allow_backtracking:
- return False
-
- atom = dep.atom
-
- if not (atom.soname or atom.slot_operator_built):
- new_child_slot = self._slot_change_probe(dep)
- if new_child_slot is not None:
- self._slot_change_backtrack(dep, new_child_slot)
- return True
-
- if not (dep.parent and isinstance(dep.parent, Package) and dep.parent.built):
- return False
rebuild_if_new_slot = (
self._dynamic_config.myparams.get("rebuild_if_new_slot", "y") == "y"
)
- # If the parent is not installed, check if it needs to be
- # rebuilt against an installed instance, since otherwise
- # it could trigger downgrade of an installed instance as
- # in bug #652938.
- want_update_probe = dep.want_update or not dep.parent.installed
-
- # Check for slot update first, since we don't want to
- # trigger reinstall of the child package when a newer
- # slot will be used instead.
- if rebuild_if_new_slot and want_update_probe:
- new_dep = self._slot_operator_update_probe(dep, new_child_slot=True)
- if new_dep is not None:
- self._slot_operator_update_backtrack(dep, new_child_slot=new_dep.child)
- return True
+ for slot_key, slot_info in self._dynamic_config._slot_operator_deps.items():
+ for dep in slot_info:
+ atom = dep.atom
- if want_update_probe:
- if self._slot_operator_update_probe(dep):
- self._slot_operator_update_backtrack(dep)
- return True
+ if not (atom.soname or atom.slot_operator_built):
+ new_child_slot = self._slot_change_probe(dep)
+ if new_child_slot is not None:
+ self._slot_change_backtrack(dep, new_child_slot)
+ continue
- return False
+ if not (
+ dep.parent and isinstance(dep.parent, Package) and dep.parent.built
+ ):
+ continue
+
+ # If the parent is not installed, check if it needs to be
+ # rebuilt against an installed instance, since otherwise
+ # it could trigger downgrade of an installed instance as
+ # in bug #652938.
+ want_update_probe = dep.want_update or not dep.parent.installed
+
+ # Check for slot update first, since we don't want to
+ # trigger reinstall of the child package when a newer
+ # slot will be used instead.
+ if rebuild_if_new_slot and want_update_probe:
+ new_dep = self._slot_operator_update_probe(dep, new_child_slot=True)
+ if new_dep is not None:
+ self._slot_operator_update_backtrack(
+ dep, new_child_slot=new_dep.child
+ )
+
+ if want_update_probe:
+ if self._slot_operator_update_probe(dep):
+ self._slot_operator_update_backtrack(dep)
def _reinstall_for_flags(
self, pkg, forced_flags, orig_use, orig_iuse, cur_use, cur_iuse
@@ -3429,6 +3436,44 @@ class depgraph:
raise
del e
+ # NOTE: REQUIRED_USE checks are delayed until after
+ # package selection, since we want to prompt the user
+ # for USE adjustment rather than have REQUIRED_USE
+ # affect package selection and || dep choices.
+ if (
+ not pkg.built
+ and pkg._metadata.get("REQUIRED_USE")
+ and eapi_has_required_use(pkg.eapi)
+ ):
+ required_use_is_sat = check_required_use(
+ pkg._metadata["REQUIRED_USE"],
+ self._pkg_use_enabled(pkg),
+ pkg.iuse.is_valid_flag,
+ eapi=pkg.eapi,
+ )
+ if not required_use_is_sat:
+ if dep.atom is not None and dep.parent is not None:
+ self._add_parent_atom(pkg, (dep.parent, dep.atom))
+
+ if arg_atoms:
+ for parent_atom in arg_atoms:
+ parent, atom = parent_atom
+ self._add_parent_atom(pkg, parent_atom)
+
+ atom = dep.atom
+ if atom is None:
+ atom = Atom("=" + pkg.cpv)
+ self._dynamic_config._unsatisfied_deps_for_display.append(
+ ((pkg.root, atom), {"myparent": dep.parent, "show_req_use": pkg})
+ )
+ self._dynamic_config._required_use_unsatisfied = True
+ self._dynamic_config._skip_restart = True
+ # Add pkg to digraph in order to enable autounmask messages
+ # for this package, which is useful when autounmask USE
+ # changes have violated REQUIRED_USE.
+ self._dynamic_config.digraph.add(pkg, dep.parent, priority=priority)
+ return 0
+
if not pkg.onlydeps:
existing_node, existing_node_matches = self._check_slot_conflict(
pkg, dep.atom
@@ -3587,43 +3632,6 @@ class depgraph:
and (dep.atom.soname or dep.atom.slot_operator == "=")
):
self._add_slot_operator_dep(dep)
- if self._slot_operator_trigger_backtracking(dep):
- # Drop slot operator deps that trigger backtracking, since
- # they may be irrelevant and therefore we don't want to
- # enforce the REQUIRED_USE check that comes below (bug 964705).
- # Since backtracking has been triggered, the _need_restart flag
- # is set and this depgraph is only useful for collecting
- # backtracking parameters at this point, so it is acceptable to
- # drop dependencies as needed. It would not be acceptable to
- # abort depgraph creation here, since that would not scale well
- # for large numbers of slot operator rebuilds.
- return 1
-
- # NOTE: REQUIRED_USE checks are delayed until after
- # package selection, since we want to prompt the user
- # for USE adjustment rather than have REQUIRED_USE
- # affect package selection and || dep choices.
- if (
- not pkg.built
- and pkg._metadata.get("REQUIRED_USE")
- and eapi_has_required_use(pkg.eapi)
- ):
- required_use_is_sat = check_required_use(
- pkg._metadata["REQUIRED_USE"],
- self._pkg_use_enabled(pkg),
- pkg.iuse.is_valid_flag,
- eapi=pkg.eapi,
- )
- if not required_use_is_sat:
- atom = dep.atom
- if atom is None:
- atom = Atom("=" + pkg.cpv)
- self._dynamic_config._unsatisfied_deps_for_display.append(
- ((pkg.root, atom), {"myparent": dep.parent, "show_req_use": pkg})
- )
- self._dynamic_config._required_use_unsatisfied = True
- self._dynamic_config._skip_restart = True
- return 0
recurse = deep is True or not self._too_deep(self._depth_increment(depth, n=1))
dep_stack = self._dynamic_config._dep_stack
diff --git a/lib/portage/tests/resolver/test_binpackage_downgrades_slot_dep.py b/lib/portage/tests/resolver/test_binpackage_downgrades_slot_dep.py
index b47f73dcb..699cd1c46 100644
--- a/lib/portage/tests/resolver/test_binpackage_downgrades_slot_dep.py
+++ b/lib/portage/tests/resolver/test_binpackage_downgrades_slot_dep.py
@@ -1,6 +1,8 @@
# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+import pytest
+
from portage.tests import TestCase
from portage.tests.resolver.ResolverPlayground import (
ResolverPlayground,
@@ -9,6 +11,7 @@ from portage.tests.resolver.ResolverPlayground import (
class BinpackageDowngradesSlotDepTestCase(TestCase):
+ @pytest.mark.xfail()
def testBinpackageDowngradesSlotDep(self):
python_use = "python_targets_python3_12 +python_targets_python3_13"
python_usedep = "python_targets_python3_12(-)?,python_targets_python3_13(-)?"
diff --git a/lib/portage/tests/resolver/test_missed_update.py b/lib/portage/tests/resolver/test_missed_update.py
index 6813a9172..2c15a16c8 100644
--- a/lib/portage/tests/resolver/test_missed_update.py
+++ b/lib/portage/tests/resolver/test_missed_update.py
@@ -1,6 +1,8 @@
# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+import pytest
+
from portage.tests import TestCase
from portage.tests.resolver.ResolverPlayground import (
ResolverPlayground,
@@ -9,6 +11,7 @@ from portage.tests.resolver.ResolverPlayground import (
class MissedQtUpdateTestCase(TestCase):
+ @pytest.mark.xfail()
def testMissedQtUpdate(self):
"""
Testcase where Portage was unable to upgrade from
--
2.53.0

View File

@ -0,0 +1,58 @@
From c568ef909922c307dd99acfebc1214e6ea88e075 Mon Sep 17 00:00:00 2001
Message-ID: <c568ef909922c307dd99acfebc1214e6ea88e075.1775418711.git.sam@gentoo.org>
From: James Le Cuirot <chewi@gentoo.org>
Date: Fri, 27 Mar 2026 18:34:43 +0000
Subject: [PATCH] estrip: Don't break the debuglink CRC with the salted build
ID
Closes: https://bugs.gentoo.org/971641
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Part-of: https://github.com/gentoo/portage/pull/1568
Closes: https://github.com/gentoo/portage/pull/1568
---
NEWS | 2 ++
bin/estrip | 8 ++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index 923c99a74..94b2f8b98 100644
--- a/NEWS
+++ b/NEWS
@@ -70,6 +70,8 @@ Bug fixes:
* estrip: Silence noise from objcopy when no build ID section exists (bug #968220).
+* estrip: Don't break the debuglink CRC with the salted build ID (bug #971641).
+
portage-3.0.77 (2026-01-23)
--------------
diff --git a/bin/estrip b/bin/estrip
index 526a1f203..166f68087 100755
--- a/bin/estrip
+++ b/bin/estrip
@@ -143,8 +143,7 @@ save_elf_debug() {
if (( has_feature[compressdebug] )); then
objcopy_flags+=( --compress-debug-sections )
fi
- "${name_of[objcopy]}" "${objcopy_flags[@]}" "${src}" "${dst}" \
- && "${name_of[objcopy]}" --add-gnu-debuglink="${dst}" "${src}"
+ "${name_of[objcopy]}" "${objcopy_flags[@]}" "${src}" "${dst}"
fi
# Only do the following if the debug file was
@@ -199,6 +198,11 @@ save_elf_debug() {
__try_symlink "${src_buildid_rel}" "${buildid_file}"
fi
fi
+
+ if [[ -z ${splitdebug} ]] ; then
+ # Add debuglink last to avoid the salted build ID breaking the CRC.
+ "${name_of[objcopy]}" --add-gnu-debuglink="${dst}" "${src}"
+ fi
fi
}
--
2.53.0

View File

@ -1,235 +0,0 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{12..14} )
PYTHON_REQ_USE='bzip2(+),threads(+)'
TMPFILES_OPTIONAL=1
inherit meson linux-info python-r1 tmpfiles
DESCRIPTION="The package management and distribution system for Gentoo"
HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage"
if [[ ${PV} == 9999 ]] ; then
EGIT_REPO_URI="
https://anongit.gentoo.org/git/proj/portage.git
https://github.com/gentoo/portage.git
"
inherit git-r3
else
SRC_URI="https://gitweb.gentoo.org/proj/portage.git/snapshot/${P}.tar.bz2"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
fi
LICENSE="GPL-2"
SLOT="0"
IUSE="apidoc build doc gentoo-dev +ipc +native-extensions +rsync-verify selinux test xattr"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
RESTRICT="!test? ( test )"
BDEPEND="
${PYTHON_DEPS}
>=app-arch/tar-1.27
>=dev-build/meson-1.3.0-r1
>=sys-apps/sed-4.0.5
sys-devel/patch
!build? ( $(python_gen_impl_dep 'ssl(+)') )
apidoc? (
dev-python/sphinx[${PYTHON_USEDEP}]
dev-python/sphinx-epytext[${PYTHON_USEDEP}]
)
doc? (
~app-text/docbook-xml-dtd-4.4
app-text/xmlto
)
test? (
dev-python/pytest-xdist[${PYTHON_USEDEP}]
dev-vcs/git
)
"
# Require sandbox-2.2 for bug #288863.
# For whirlpool hash, require python[ssl] (bug #425046).
RDEPEND="
${PYTHON_DEPS}
acct-user/portage
>=app-arch/tar-1.27
app-arch/zstd
>=app-misc/pax-utils-0.1.17
dev-lang/python-exec:2
>=sys-apps/baselayout-2.9
>=sys-apps/findutils-4.9
!build? (
>=app-admin/eselect-1.2
app-portage/getuto
>=app-shells/bash-5.0:0
>=sec-keys/openpgp-keys-gentoo-release-20240703
>=sys-apps/sed-4.0.5
rsync-verify? (
app-alternatives/gpg[ssl(-)]
>=app-portage/gemato-14.5[${PYTHON_USEDEP}]
)
)
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_musl? ( >=sys-apps/sandbox-2.2 )
kernel_linux? ( sys-apps/util-linux )
selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] )
xattr? ( kernel_linux? (
>=sys-apps/install-xattr-0.3
) )
"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
>=sys-apps/coreutils-6.4
>=sys-apps/file-5.44-r3
)
"
PATCHES=(
"${FILESDIR}"/0001-bin-emerge-ebuild-don-t-define-signal-handlers-in-gl.patch
)
pkg_pretend() {
local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS"
check_extra_config
}
src_prepare() {
default
if use prefix-guest; then
sed -e "s|^\(main-repo = \).*|\\1gentoo_prefix|" \
-e "s|^\\[gentoo\\]|[gentoo_prefix]|" \
-e "s|^\(sync-uri = \).*|\\1rsync://rsync.prefix.bitzolder.nl/gentoo-portage-prefix|" \
-i cnf/repos.conf || die "sed failed"
fi
}
src_configure() {
local code_only=false
python_foreach_impl my_src_configure
}
my_src_configure() {
local emesonargs=(
-Dcode-only=${code_only}
-Deprefix="${EPREFIX}"
-Dportage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}"
-Ddocdir="${EPREFIX}/usr/share/doc/${PF}"
$(meson_use doc)
$(meson_use apidoc)
$(meson_use gentoo-dev)
$(meson_use ipc)
$(meson_use xattr)
)
if use native-extensions && [[ "${EPYTHON}" != pypy3* ]] ; then
emesonargs+=( -Dnative-extensions=true )
else
emesonargs+=( -Dnative-extensions=false )
fi
if use build; then
emesonargs+=( -Drsync-verify=false )
else
emesonargs+=( $(meson_use rsync-verify) )
fi
meson_src_configure
code_only=true
}
src_compile() {
python_foreach_impl meson_src_compile
}
src_test() {
local EPYTEST_XDIST=1
local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
python_foreach_impl epytest
}
src_install() {
python_foreach_impl my_src_install
dotmpfiles "${FILESDIR}"/portage-{ccache,tmpdir}.conf
local scripts
mapfile -t scripts < <(awk '/^#!.*python/ {print FILENAME} {nextfile}' "${ED}"/usr/{bin,sbin}/* || die)
python_replicate_script "${scripts[@]}"
}
my_src_install() {
local pydirs=(
"${D}$(python_get_sitedir)"
"${ED}/usr/lib/portage/${EPYTHON}"
)
meson_src_install
python_fix_shebang "${pydirs[@]}"
python_optimize "${pydirs[@]}"
}
pkg_preinst() {
if ! use build && [[ -z ${ROOT} ]]; then
python_setup
local sitedir=$(python_get_sitedir)
[[ -d ${D}${sitedir} ]] || die "${D}${sitedir}: No such directory"
env -u DISTDIR \
-u PORTAGE_OVERRIDE_EPREFIX \
-u PORTAGE_REPOSITORIES \
-u PORTDIR \
-u PORTDIR_OVERLAY \
PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
ED="${ED}" \
"${PYTHON}" -m portage._compat_upgrade.default_locations || die
env -u BINPKG_COMPRESS -u PORTAGE_REPOSITORIES \
PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
ED="${ED}" \
"${PYTHON}" -m portage._compat_upgrade.binpkg_compression || die
env -u FEATURES -u PORTAGE_REPOSITORIES \
PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
ED="${ED}" \
"${PYTHON}" -m portage._compat_upgrade.binpkg_multi_instance || die
env -u BINPKG_FORMAT \
PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
ED="${ED}" \
"${PYTHON}" -m portage._compat_upgrade.binpkg_format || die
fi
# elog dir must exist to avoid logrotate error for bug #415911.
# This code runs in preinst in order to bypass the mapping of
# portage:portage to root:root which happens after src_install.
keepdir /var/log/portage/elog
# This is allowed to fail if the user/group are invalid for prefix users.
if chown portage:portage "${ED}"/var/log/portage{,/elog} 2>/dev/null ; then
chmod g+s,ug+rwx "${ED}"/var/log/portage{,/elog}
fi
if has_version "<${CATEGORY}/${PN}-2.3.77"; then
elog "The emerge --autounmask option is now disabled by default, except for"
elog "portions of behavior which are controlled by the --autounmask-use and"
elog "--autounmask-license options. For backward compatibility, previous"
elog "behavior of --autounmask=y and --autounmask=n is entirely preserved."
elog "Users can get the old behavior simply by adding --autounmask to the"
elog "make.conf EMERGE_DEFAULT_OPTS variable. For the rationale for this"
elog "change, see https://bugs.gentoo.org/658648."
fi
}
pkg_postinst() {
# Warn about obsolete "enotice" script, bug #867010
local bashrc=${EROOT}/etc/portage/profile/profile.bashrc
if [[ -e ${bashrc} ]] && grep -q enotice "${bashrc}"; then
eerror "Obsolete 'enotice' script detected!"
eerror "Please remove this from ${bashrc} to avoid problems."
eerror "See bug 867010 for more details."
fi
}

View File

@ -1,235 +0,0 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{12..14} )
PYTHON_REQ_USE='bzip2(+),threads(+)'
TMPFILES_OPTIONAL=1
inherit meson linux-info python-r1 tmpfiles
DESCRIPTION="The package management and distribution system for Gentoo"
HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage"
if [[ ${PV} == 9999 ]] ; then
EGIT_REPO_URI="
https://anongit.gentoo.org/git/proj/portage.git
https://github.com/gentoo/portage.git
"
inherit git-r3
else
SRC_URI="https://gitweb.gentoo.org/proj/portage.git/snapshot/${P}.tar.bz2"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
fi
LICENSE="GPL-2"
SLOT="0"
IUSE="apidoc build doc gentoo-dev +ipc +native-extensions +rsync-verify selinux test xattr"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
RESTRICT="!test? ( test )"
BDEPEND="
${PYTHON_DEPS}
>=app-arch/tar-1.27
>=dev-build/meson-1.3.0-r1
>=sys-apps/sed-4.0.5
sys-devel/patch
!build? ( $(python_gen_impl_dep 'ssl(+)') )
apidoc? (
dev-python/sphinx[${PYTHON_USEDEP}]
dev-python/sphinx-epytext[${PYTHON_USEDEP}]
)
doc? (
~app-text/docbook-xml-dtd-4.4
app-text/xmlto
)
test? (
dev-python/pytest-xdist[${PYTHON_USEDEP}]
dev-vcs/git
)
"
# Require sandbox-2.2 for bug #288863.
# For whirlpool hash, require python[ssl] (bug #425046).
RDEPEND="
${PYTHON_DEPS}
>=acct-user/portage-0-r4
>=app-arch/tar-1.27
app-arch/zstd
>=app-misc/pax-utils-0.1.17
dev-lang/python-exec:2
>=sys-apps/baselayout-2.9
>=sys-apps/findutils-4.9
!build? (
>=app-admin/eselect-1.2
app-portage/getuto
>=app-shells/bash-5.3:0
>=sec-keys/openpgp-keys-gentoo-release-20240703
>=sys-apps/sed-4.0.5
rsync-verify? (
app-alternatives/gpg[ssl(-)]
>=app-portage/gemato-14.5[${PYTHON_USEDEP}]
)
)
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_musl? ( >=sys-apps/sandbox-2.2 )
kernel_linux? ( sys-apps/util-linux )
selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] )
xattr? ( kernel_linux? (
>=sys-apps/install-xattr-0.3
) )
"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
>=sys-apps/coreutils-6.4
>=sys-apps/file-5.44-r3
)
"
PATCHES=(
"${FILESDIR}"/0001-estrip-silence-noise-from-objcopy-if-build-ID-sectio.patch
)
pkg_pretend() {
local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS"
check_extra_config
}
src_prepare() {
default
if use prefix-guest; then
sed -e "s|^\(main-repo = \).*|\\1gentoo_prefix|" \
-e "s|^\\[gentoo\\]|[gentoo_prefix]|" \
-e "s|^\(sync-uri = \).*|\\1rsync://rsync.prefix.bitzolder.nl/gentoo-portage-prefix|" \
-i cnf/repos.conf || die "sed failed"
fi
}
src_configure() {
local code_only=false
python_foreach_impl my_src_configure
}
my_src_configure() {
local emesonargs=(
-Dcode-only=${code_only}
-Deprefix="${EPREFIX}"
-Dportage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}"
-Ddocdir="${EPREFIX}/usr/share/doc/${PF}"
$(meson_use doc)
$(meson_use apidoc)
$(meson_use gentoo-dev)
$(meson_use ipc)
$(meson_use xattr)
)
if use native-extensions && [[ "${EPYTHON}" != pypy3* ]] ; then
emesonargs+=( -Dnative-extensions=true )
else
emesonargs+=( -Dnative-extensions=false )
fi
if use build; then
emesonargs+=( -Drsync-verify=false )
else
emesonargs+=( $(meson_use rsync-verify) )
fi
meson_src_configure
code_only=true
}
src_compile() {
python_foreach_impl meson_src_compile
}
src_test() {
local EPYTEST_XDIST=1
local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
python_foreach_impl epytest
}
src_install() {
python_foreach_impl my_src_install
dotmpfiles "${FILESDIR}"/portage-{ccache,tmpdir}.conf
local scripts
mapfile -t scripts < <(awk '/^#!.*python/ {print FILENAME} {nextfile}' "${ED}"/usr/{bin,sbin}/* || die)
python_replicate_script "${scripts[@]}"
}
my_src_install() {
local pydirs=(
"${D}$(python_get_sitedir)"
"${ED}/usr/lib/portage/${EPYTHON}"
)
meson_src_install
python_fix_shebang "${pydirs[@]}"
python_optimize "${pydirs[@]}"
}
pkg_preinst() {
if ! use build && [[ -z ${ROOT} ]]; then
python_setup
local sitedir=$(python_get_sitedir)
[[ -d ${D}${sitedir} ]] || die "${D}${sitedir}: No such directory"
env -u DISTDIR \
-u PORTAGE_OVERRIDE_EPREFIX \
-u PORTAGE_REPOSITORIES \
-u PORTDIR \
-u PORTDIR_OVERLAY \
PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
ED="${ED}" \
"${PYTHON}" -m portage._compat_upgrade.default_locations || die
env -u BINPKG_COMPRESS -u PORTAGE_REPOSITORIES \
PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
ED="${ED}" \
"${PYTHON}" -m portage._compat_upgrade.binpkg_compression || die
env -u FEATURES -u PORTAGE_REPOSITORIES \
PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
ED="${ED}" \
"${PYTHON}" -m portage._compat_upgrade.binpkg_multi_instance || die
env -u BINPKG_FORMAT \
PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
ED="${ED}" \
"${PYTHON}" -m portage._compat_upgrade.binpkg_format || die
fi
# elog dir must exist to avoid logrotate error for bug #415911.
# This code runs in preinst in order to bypass the mapping of
# portage:portage to root:root which happens after src_install.
keepdir /var/log/portage/elog
# This is allowed to fail if the user/group are invalid for prefix users.
if chown portage:portage "${ED}"/var/log/portage{,/elog} 2>/dev/null ; then
chmod g+s,ug+rwx "${ED}"/var/log/portage{,/elog}
fi
if has_version "<${CATEGORY}/${PN}-2.3.77"; then
elog "The emerge --autounmask option is now disabled by default, except for"
elog "portions of behavior which are controlled by the --autounmask-use and"
elog "--autounmask-license options. For backward compatibility, previous"
elog "behavior of --autounmask=y and --autounmask=n is entirely preserved."
elog "Users can get the old behavior simply by adding --autounmask to the"
elog "make.conf EMERGE_DEFAULT_OPTS variable. For the rationale for this"
elog "change, see https://bugs.gentoo.org/658648."
fi
}
pkg_postinst() {
# Warn about obsolete "enotice" script, bug #867010
local bashrc=${EROOT}/etc/portage/profile/profile.bashrc
if [[ -e ${bashrc} ]] && grep -q enotice "${bashrc}"; then
eerror "Obsolete 'enotice' script detected!"
eerror "Please remove this from ${bashrc} to avoid problems."
eerror "See bug 867010 for more details."
fi
}

View File

@ -72,9 +72,11 @@ RDEPEND="
>=app-portage/gemato-14.5[${PYTHON_USEDEP}]
)
)
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_musl? ( >=sys-apps/sandbox-2.2 )
kernel_linux? ( sys-apps/util-linux )
kernel_linux? (
sys-apps/util-linux
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_musl? ( >=sys-apps/sandbox-2.2 )
)
selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] )
xattr? ( kernel_linux? (
>=sys-apps/install-xattr-0.3
@ -92,6 +94,8 @@ PDEPEND="
PATCHES=(
"${FILESDIR}"/0001-estrip-silence-noise-from-objcopy-if-build-ID-sectio.patch
"${FILESDIR}"/0002-Revert-depgraph-earlier-slot-operator-backtracking.patch
"${FILESDIR}"/0003-estrip-Don-t-break-the-debuglink-CRC-with-the-salted.patch
)
pkg_pretend() {

View File

@ -64,6 +64,7 @@ RDEPEND="
>=app-admin/eselect-1.2
app-portage/getuto
>=app-shells/bash-5.3:0
dev-util/debugedit
>=sec-keys/openpgp-keys-gentoo-release-20240703
>=sys-apps/sed-4.0.5
rsync-verify? (
@ -71,9 +72,11 @@ RDEPEND="
>=app-portage/gemato-14.5[${PYTHON_USEDEP}]
)
)
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_musl? ( >=sys-apps/sandbox-2.2 )
kernel_linux? ( sys-apps/util-linux )
kernel_linux? (
sys-apps/util-linux
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_musl? ( >=sys-apps/sandbox-2.2 )
)
selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] )
xattr? ( kernel_linux? (
>=sys-apps/install-xattr-0.3

View File

@ -72,9 +72,11 @@ RDEPEND="
>=app-portage/gemato-14.5[${PYTHON_USEDEP}]
)
)
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_musl? ( >=sys-apps/sandbox-2.2 )
kernel_linux? ( sys-apps/util-linux )
kernel_linux? (
sys-apps/util-linux
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_musl? ( >=sys-apps/sandbox-2.2 )
)
selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] )
xattr? ( kernel_linux? (
>=sys-apps/install-xattr-0.3