Skip to content

Commit

Permalink
Merge branch 'gentoo:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
duxsco authored Jan 21, 2025
2 parents 1e9023c + 153a7e8 commit fbc24ab
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 35 deletions.
27 changes: 25 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,27 @@ Release notes take the form of the following optional categories:
* Bug fixes
* Cleanups

portage-3.0.67 (UNRELEASED)
--------------

Breaking changes:
* eend: Missing argument is now an error (bug #703520).

* ebuild.sh: A colon in sandbox function args is now an error (bug #920654).

Security:
* make.globals: disable FEATURES="sfperms" by default (bug #938164).

Features:
* New 'home-dir-template-copy' FEATURE (bug #947822).

If enabled, as part of the ebuild environment setup, copies the PORTAGE_USERNAME
home directory into the build environment HOME directory. Useful predominantly
for ebuilds that use the git-r3 eclass, to give a place to put SSH keys and user-
specific git configuration files used during the build.

* Flush the merge-wait queue on SIGUSR2.

Bug fixes:
* depgraph: Ignore blockers when computing virtual deps visibility (PR #1387).

Expand All @@ -21,8 +39,6 @@ Bug fixes:

* save-ebuild-env.sh: Add functions from newer EAPIs to filter list

* eend: Missing argument is now an error (bug #703520).

* Support cross-root package moves (bug #946326).

* Process elog messages for emerge --config (bug #904702).
Expand All @@ -35,6 +51,13 @@ Bug fixes:

* ebuild.sh: Allow CC and CXX to be changed in profile.bashrc.

* Preserve PORTAGE_BZIP2_COMMAND in environment.bz2 (bug #948067).

* config: Initialize default PORTAGE_USERNAME and PORTAGE_GRPNAME (bug #941977).

* rust-rebuild: Update for recent changes in ::gentoo (bug #906044).

Cleanups:
* eapi.sh: Remove support for unofficial 4-slot-abi EAPI.

portage-3.0.66.1 (2024-09-18)
Expand Down
7 changes: 5 additions & 2 deletions bin/phase-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE EBUILD_PHASE_FUNC \
PORTAGE_ACTUAL_DISTDIR PORTAGE_ARCHLIST PORTAGE_BASHRC \
PORTAGE_BINPKG_FILE PORTAGE_BINPKG_TAR_OPTS PORTAGE_BINPKG_TMPFILE \
PORTAGE_BIN_PATH PORTAGE_BUILDDIR PORTAGE_BUILD_GROUP \
PORTAGE_BUILD_USER PORTAGE_BUNZIP2_COMMAND \
PORTAGE_BZIP2_COMMAND PORTAGE_COLORMAP PORTAGE_CONFIGROOT \
PORTAGE_BUILD_USER \
PORTAGE_COLORMAP PORTAGE_CONFIGROOT \
PORTAGE_DEBUG PORTAGE_DEPCACHEDIR PORTAGE_EBUILD_EXIT_FILE \
PORTAGE_ECLASS_LOCATIONS PORTAGE_EXPLICIT_INHERIT \
PORTAGE_GID PORTAGE_GRPNAME PORTAGE_INST_GID PORTAGE_INST_UID \
Expand Down Expand Up @@ -191,6 +191,9 @@ __preprocess_ebuild_env() {
# because it's already filtered above.
source "${PORTAGE_BIN_PATH}/save-ebuild-env.sh" || exit $?

# Prefer latest make.conf values of these.
unset PORTAGE_BZIP2_COMMAND PORTAGE_BUNZIP2_COMMAND

# Rely on __save_ebuild_env() to filter out any remaining variables
# and functions that could interfere with the current environment.
__save_ebuild_env || exit $?
Expand Down
23 changes: 19 additions & 4 deletions lib/_emerge/Scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ def __init__(
# empty.
self._merge_wait_scheduled = []

self._flush_merge_wait_queue = False

# Holds system packages and their deep runtime dependencies. Before
# being merged, these packages go to merge_wait_queue, to be merged
# when no other packages are building.
Expand Down Expand Up @@ -1170,12 +1172,16 @@ def sighandler(signum, frame):
self.terminate()
received_signal.append(128 + signum)

def sigusr2handler(signum, frame):
self._flush_merge_wait_queue = True

earlier_sigint_handler = signal.signal(signal.SIGINT, sighandler)
earlier_sigterm_handler = signal.signal(signal.SIGTERM, sighandler)
earlier_sigcont_handler = signal.signal(
signal.SIGCONT, self._sigcont_handler
)
signal.siginterrupt(signal.SIGCONT, False)
earlier_sigusr2_handler = signal.signal(signal.SIGUSR2, sigusr2handler)

earlier_sigwinch_handler = signal.signal(
signal.SIGWINCH, self._sigwinch_handler
Expand All @@ -1196,6 +1202,10 @@ def sighandler(signum, frame):
signal.signal(signal.SIGCONT, earlier_sigcont_handler)
else:
signal.signal(signal.SIGCONT, signal.SIG_DFL)
if earlier_sigusr2_handler is not None:
signal.signal(signal.SIGUSR2, earlier_sigusr2_handler)
else:
signal.signal(signal.SIGUSR2, signal.SIG_DFL)

if earlier_sigwinch_handler is not None:
signal.signal(signal.SIGWINCH, earlier_sigwinch_handler)
Expand Down Expand Up @@ -1817,11 +1827,16 @@ def _schedule_tasks(self):
# special packages and we want to ensure that
# parallel-install does not cause more than one of
# them to install at the same time.
if (
self._merge_wait_queue
and not self._jobs
and not self._task_queues.merge
if self._merge_wait_queue and (
(not self._jobs and not self._task_queues.merge)
or self._flush_merge_wait_queue
):
if self._flush_merge_wait_queue:
self._status_msg(
"Manual flush of the merge-wait queue requested (e.g., via SIGUSR2)"
)
self._flush_merge_wait_queue = False

while self._merge_wait_queue:
# If we added non-system packages to the merge queue in a
# previous iteration of this loop, then for system packages we
Expand Down
1 change: 1 addition & 0 deletions lib/portage/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"force-mirror",
"getbinpkg",
"gpg-keepalive",
"home-dir-template-copy",
"icecream",
"installsources",
"ipc-sandbox",
Expand Down
22 changes: 22 additions & 0 deletions lib/portage/package/ebuild/prepare_build_dirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import gzip
import stat
import time
import pwd

import portage
from portage import os, shutil, _encodings, _unicode_encode, _unicode_decode
Expand Down Expand Up @@ -133,6 +134,27 @@ def makedirs(dir_path):
# Avoid spurious permissions adjustments when fetching with
# a temporary PORTAGE_TMPDIR setting (for fetchonly).
_prepare_features_dirs(mysettings)
# Support for home-dir-template-copy FEATURE:
if "home-dir-template-copy" in settings.features:
portage_username = mysettings.get("PORTAGE_USERNAME", "portage")
home_template_dir = pwd.getpwnam(portage_username).pw_dir
build_env_home_dir = mysettings["HOME"]
# Sanity checks on above values.
if not os.path.exists(home_template_dir):
writemsg(
f"FEATURES home-dir-template-copy enabled but specified Linux home directory {home_template_dir} does not exist.",
noiselevel=-1,
)
return 1
if not os.path.exists(build_env_home_dir):
writemsg(
f"FEATURES home-dir-template-copy enabled but build HOME directory {build_env_home_dir} does not exist.",
noiselevel=-1,
)
return 1
shutil.copytree(
home_template_dir, build_env_home_dir, symlinks=True, dirs_exist_ok=True
)


def _adjust_perms_msg(settings, msg):
Expand Down
1 change: 0 additions & 1 deletion lib/portage/tests/util/futures/asyncio/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ py.install_sources(
[
'test_event_loop_in_fork.py',
'test_pipe_closed.py',
'test_policy_wrapper_recursion.py',
'test_run_until_complete.py',
'test_subprocess_exec.py',
'test_wakeup_fd_sigchld.py',
Expand Down

This file was deleted.

3 changes: 1 addition & 2 deletions lib/portage/util/futures/unix_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
__all__ = ("DefaultEventLoopPolicy",)

import asyncio as _real_asyncio
from asyncio import events

import fcntl
import os
Expand All @@ -27,7 +26,7 @@ def _set_nonblocking(fd):
fcntl.fcntl(fd, fcntl.F_SETFL, flags)


class _PortageEventLoopPolicy(events.AbstractEventLoopPolicy):
class _PortageEventLoopPolicy:
"""
Implementation of asyncio.AbstractEventLoopPolicy based on portage's
internal event loop. This supports running event loops in forks,
Expand Down
17 changes: 17 additions & 0 deletions man/make.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,23 @@ Force emerges to always try to fetch files from the \fIPORTAGE_BINHOST\fR. See
.B gpg-keepalive
Run GPG unlock command every 5 mins to avoid the passphrase expired.
If your GPG is auto unlocked on login, you do not need this.
.TP
.B home\-dir\-template\-copy
As part of the ebuild environment setup, copy the PORTAGE_USERNAME (default
"portage") home directory (currently /var/lib/portage/home) into the build environment
HOME directory. By default, Portage uses an empty home directory for each new build.

This is useful, for example, if the git-r3 eclass is being used to access a repository
via ssh where keys and known_hosts values need to be specified in the ~/.ssh
directory.

It's also useful for adressing git's "fatal: detected dubious ownership in
repository at..." error, which can occur when the ebuild is fetching from a
local filesystem-resident repo. Running git to create an "--add safe.directory"
exception \fInarrowly\fR to apply only to the portage user can be done as follows:

sudo -u portage git config --global --add safe.directory ...

.TP
.B icecream
Enable portage support for the icecream package.
Expand Down

0 comments on commit fbc24ab

Please sign in to comment.