This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=c10aeffc6d7198056f716486f6cfdbe70ce182a9 commit c10aeffc6d7198056f716486f6cfdbe70ce182a9 Author: Guillem Jover <[email protected]> AuthorDate: Sun Aug 21 01:49:40 2022 +0200 dpkg-deb: Add support for DPKG_DEB_COMPRESSOR_TYPE/LEVEL Closes: #550475 --- man/dpkg-deb.pod | 12 ++++++++++++ src/deb/main.c | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/man/dpkg-deb.pod b/man/dpkg-deb.pod index 9848d6646..42ac708c3 100644 --- a/man/dpkg-deb.pod +++ b/man/dpkg-deb.pod @@ -356,6 +356,18 @@ multi-threaded operations (since dpkg 1.21.9). The B<--threads-max> option overrides this value. +=item B<DPKG_DEB_COMPRESSOR_TYPE> + +Sets the compressor type to use (since dpkg 1.21.10). + +The B<-Z> option overrides this value. + +=item B<DPKG_DEB_COMPRESSOR_LEVEL> + +Sets the compressor level to use (since dpkg 1.21.10). + +The B<-z> option overrides this value. + =item B<DPKG_COLORS> Sets the color mode (since dpkg 1.18.5). diff --git a/src/deb/main.c b/src/deb/main.c index 5a7b445e7..b4347597a 100644 --- a/src/deb/main.c +++ b/src/deb/main.c @@ -170,6 +170,20 @@ struct compress_params compress_params = { .threads_max = -1, }; +static long +parse_compress_level(const char *str) +{ + long value; + char *end; + + errno = 0; + value = strtol(str, &end, 10); + if (str == end || *end != '\0' || errno != 0) + return 0; + + return value; +} + static void set_compress_level(const struct cmdinfo *cip, const char *value) { @@ -273,6 +287,12 @@ int main(int argc, const char *const *argv) { env = getenv("DPKG_DEB_THREADS_MAX"); if (str_is_set(env)) compress_params.threads_max = parse_threads_max(env); + env = getenv("DPKG_DEB_COMPRESSOR_TYPE"); + if (str_is_set(env)) + compress_params.type = parse_compress_type(env); + env = getenv("DPKG_DEB_COMPRESSOR_LEVEL"); + if (str_is_set(env)) + compress_params.level = parse_compress_level(env); dpkg_options_parse(&argv, cmdinfos, printforhelp); if (!cipaction) badusage(_("need an action option")); -- Dpkg.Org's dpkg

