Skip to content

Add PORTAGE_LOG_FILE_SEP option #1431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ portage-3.0.68 (UNRELEASED)
Features:
* Allow "portageq envvar" to treat a trailing * as a wildcard, matching multiple
variables. Useful for multilib.
* Introduce PORTAGE_LOG_FILE_SEP, allowing to configure the separator between
the components of the log files produced by portage.

portage-3.0.67 (2025-01-22)
--------------
Expand Down
7 changes: 6 additions & 1 deletion cnf/make.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,17 @@
#
# PORTAGE_LOGDIR is the location where portage will store all the logs it
# creates from each individual merge. They are stored as
# ${CATEGORY}:${PF}:YYYYMMDD-HHMMSS.log in the directory specified.
# ${CATEGORY}<sep>${PF}<sep>YYYYMMDD-HHMMSS.log in the directory specified,
# where <sep> is specified via PORTAGE_LOG_FILE_SEP, which defaults to ':'.
# If the directory does not exist, it will be created automatically and
# group permissions will be applied to it. If the directory already
# exists, portage will not modify its permissions.
#PORTAGE_LOGDIR=""
#
# PORTAGE_LOG_FILE_SEP specifies the separator between the components of the
# log files in PORTAGE_LOGDIR.
#PORTAGE_LOG_FILE_SEP=":"
#
# PORTDIR_OVERLAY is a directory where local ebuilds may be stored without
# concern that they will be deleted by rsync updates. Default is not
# defined.
Expand Down
13 changes: 5 additions & 8 deletions lib/portage/package/ebuild/prepare_build_dirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,23 +411,20 @@ def _prepare_workdir(mysettings):
errors="replace",
)

# The separator used between the individual name components of the log file.
sep = mysettings.get("PORTAGE_LOG_FILE_SEP", ":")

if "split-log" in mysettings.features:
log_subdir = os.path.join(logdir, "build", mysettings["CATEGORY"])
mysettings["PORTAGE_LOG_FILE"] = os.path.join(
log_subdir,
f"{mysettings['PF']}:{logid_time}.log{compress_log_ext}",
f"{mysettings['PF']}{sep}{logid_time}.log{compress_log_ext}",
)
else:
log_subdir = logdir
mysettings["PORTAGE_LOG_FILE"] = os.path.join(
logdir,
"%s:%s:%s.log%s"
% (
mysettings["CATEGORY"],
mysettings["PF"],
logid_time,
compress_log_ext,
),
f"{mysettings['CATEGORY']}{sep}{mysettings['PF']}{sep}{logid_time}.log{compress_log_ext}",
)

if log_subdir is logdir:
Expand Down
9 changes: 7 additions & 2 deletions man/make.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -1187,11 +1187,16 @@ PORTAGE_LOG_FILTER_FILE_CMD="bash -c \\"ansifilter; exec cat\\""
.B PORTAGE_LOGDIR
This variable defines the directory in which per\-ebuild logs are kept.
Logs are created only when this is set. They are stored as
${CATEGORY}:${PF}:YYYYMMDD\-HHMMSS.log in the directory specified. If the
directory does not exist, it will be created automatically and group
${CATEGORY}<sep>${PF}<sep>YYYYMMDD\-HHMMSS.log in the directory specified,
where <sep> is specified via PORTAGE_LOG_FILE_SEP, which defaults to ':'.
If the directory does not exist, it will be created automatically and group
permissions will be applied to it. If the directory already exists, portage
will not modify its permissions.
.TP
.B PORTAGE_LOG_FILE_SEP
This variable defines the separator used between the components of the log
files in PORTAGE_LOGDIR. Defaults to ':'.
.TP
.B PORTAGE_LOGDIR_CLEAN
This variable should contain a command for portage to call in order
to clean PORTAGE_LOGDIR. The command string should contain a
Expand Down