From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: man/, lib/portage/, lib/portage/package/ebuild/, bin/
Date: Tue, 18 Oct 2022 00:37:53 +0000 (UTC) [thread overview]
Message-ID: <1666053390.e261ba845df7342eb72ee0ffb1ad84dabdd154a9.sam@gentoo> (raw)
commit: e261ba845df7342eb72ee0ffb1ad84dabdd154a9
Author: Sheng Yu <syu.os <AT> protonmail <DOT> com>
AuthorDate: Sat Oct 15 04:09:01 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct 18 00:36:30 2022 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=e261ba84
Add per format compression flags for binpkg
This added new config BINPKG_COMPRESS_FLAGS_[format] to be used
for different compression method. General BINPKG_COMPRESS_FLAGS
will be ignored if current method had specified BINPKG_COMPRESS_FLAGS_[format]
e.g. BINPKG_COMPRESS_FLAGS_ZSTD="-9"
Bug: https://bugs.gentoo.org/871573
Signed-off-by: Sheng Yu <syu.os <AT> protonmail.com>
Closes: https://github.com/gentoo/portage/pull/909
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/quickpkg | 12 ++++++++++++
lib/portage/gpkg.py | 12 ++++++++++--
lib/portage/package/ebuild/config.py | 11 +++++++++++
lib/portage/package/ebuild/doebuild.py | 19 +++++++++++++++----
man/make.conf.5 | 12 ++++++++++++
5 files changed, 60 insertions(+), 6 deletions(-)
diff --git a/bin/quickpkg b/bin/quickpkg
index 9ff8d7b5a..44e3a7123 100755
--- a/bin/quickpkg
+++ b/bin/quickpkg
@@ -153,6 +153,18 @@ def quickpkg_atom(options, infos, arg, eout):
"compress": "cat",
"package": "sys-apps/coreutils",
}
+
+ if (
+ settings.get(
+ f"BINPKG_COMPRESS_FLAGS_{binpkg_compression.upper()}", None
+ )
+ is not None
+ ):
+ compression["compress"] = compression["compress"].replace(
+ "${BINPKG_COMPRESS_FLAGS}",
+ f"${{BINPKG_COMPRESS_FLAGS_{binpkg_compression.upper()}}}",
+ )
+
try:
compression_binary = shlex_split(
varexpand(compression["compress"], mydict=settings)
diff --git a/lib/portage/gpkg.py b/lib/portage/gpkg.py
index 1f8fa1fd3..42e1c60fd 100644
--- a/lib/portage/gpkg.py
+++ b/lib/portage/gpkg.py
@@ -1788,8 +1788,16 @@ class gpkg:
if mode not in compressor:
raise InvalidCompressionMethod("{}: {}".format(compression, mode))
- cmd = compressor[mode]
- cmd = cmd.replace(
+ if mode == "compress" and (
+ self.settings.get(f"BINPKG_COMPRESS_FLAGS_{compression.upper()}", None)
+ is not None
+ ):
+ compressor["compress"] = compressor["compress"].replace(
+ "${BINPKG_COMPRESS_FLAGS}",
+ f"${{BINPKG_COMPRESS_FLAGS_{compression.upper()}}}",
+ )
+
+ cmd = compressor[mode].replace(
"{JOBS}", str(makeopts_to_job_count(self.settings.get("MAKEOPTS", "1")))
)
cmd = shlex_split(varexpand(cmd, mydict=self.settings))
diff --git a/lib/portage/package/ebuild/config.py b/lib/portage/package/ebuild/config.py
index 2530c9d31..74f7ab371 100644
--- a/lib/portage/package/ebuild/config.py
+++ b/lib/portage/package/ebuild/config.py
@@ -1573,6 +1573,17 @@ class config:
noiselevel=-1,
)
else:
+ if (
+ self.get(
+ f"BINPKG_COMPRESS_FLAGS_{binpkg_compression.upper()}", None
+ )
+ is not None
+ ):
+ compression["compress"] = compression["compress"].replace(
+ "${BINPKG_COMPRESS_FLAGS}",
+ f"${{BINPKG_COMPRESS_FLAGS_{binpkg_compression.upper()}}}",
+ )
+
try:
compression_binary = shlex_split(
portage.util.varexpand(compression["compress"], mydict=self)
diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py
index 4f7049c21..e9f172d22 100644
--- a/lib/portage/package/ebuild/doebuild.py
+++ b/lib/portage/package/ebuild/doebuild.py
@@ -255,7 +255,7 @@ def _spawn_phase(
actionmap=actionmap,
returnpid=returnpid,
logfile=logfile,
- **kwargs
+ **kwargs,
)
# The logfile argument is unused here, since EbuildPhase uses
@@ -266,7 +266,7 @@ def _spawn_phase(
phase=phase,
scheduler=SchedulerInterface(asyncio._safe_loop()),
settings=settings,
- **kwargs
+ **kwargs,
)
ebuild_phase.start()
@@ -666,6 +666,17 @@ def doebuild_environment(
# Empty BINPKG_COMPRESS disables compression.
mysettings["PORTAGE_COMPRESSION_COMMAND"] = "cat"
else:
+ if (
+ settings.get(
+ f"BINPKG_COMPRESS_FLAGS_{binpkg_compression.upper()}", None
+ )
+ is not None
+ ):
+ compression["compress"] = compression["compress"].replace(
+ "${BINPKG_COMPRESS_FLAGS}",
+ f"${{BINPKG_COMPRESS_FLAGS_{binpkg_compression.upper()}}}",
+ )
+
try:
compression_binary = compression["compress"].replace(
"{JOBS}",
@@ -1908,7 +1919,7 @@ def spawn(
ipc=True,
mountns=False,
pidns=False,
- **keywords
+ **keywords,
):
"""
Spawn a subprocess with extra portage-specific options.
@@ -2116,7 +2127,7 @@ def spawn(
scheduler=SchedulerInterface(asyncio._safe_loop()),
spawn_func=spawn_func,
settings=mysettings,
- **keywords
+ **keywords,
)
proc.start()
diff --git a/man/make.conf.5 b/man/make.conf.5
index 11bcbe238..7f398c28e 100644
--- a/man/make.conf.5
+++ b/man/make.conf.5
@@ -141,6 +141,18 @@ Defaults to "".
BINPKG_COMPRESS_FLAGS="-9"
.fi
.TP
+\fBBINPKG_COMPRESS_FLAGS_[format]\fR = \fI"arguments for [format] compression \
+command"\fR
+This variable is used to add additional arguments only for the specified \
+[format] compression command selected by \fBBINPKG_COMPRESS\fR.
+\fBBINPKG_COMPRESS_FLAGS\fR will be ignored when using [format] compression.
+.br
+.I Example:
+.nf
+# Set only zstd to use compression level 9:
+BINPKG_COMPRESS_FLAGS_ZSTD="-9"
+.fi
+.TP
\fBBINPKG_GPG_SIGNING_BASE_COMMAND\fR = \fI"GPG command and arguments \
[PORTAGE_CONFIG]"\fR
The base command will be used for all signing operations.
reply other threads:[~2022-10-18 0:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1666053390.e261ba845df7342eb72ee0ffb1ad84dabdd154a9.sam@gentoo \
--to=sam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox