[pacman-dev] [PATCH] makepkg: allow specifying compression options
From: Christian Hesse <mail@earthworm.de> Adds the ability to override the commands used to compressing compiled and source packages. This is useful for those wanting to use alternative implementations of the compression tools or non-default compression options. Allan: documented options in man page Signed-off-by: Allan McRae <allan@archlinux.org> --- Adjust patch from FS#27430. Sending to list for final comments. doc/makepkg.conf.5.txt | 4 ++++ etc/makepkg.conf.in | 10 ++++++++++ scripts/makepkg.sh.in | 8 ++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt index db1e6d5..5970946 100644 --- a/doc/makepkg.conf.5.txt +++ b/doc/makepkg.conf.5.txt @@ -213,6 +213,10 @@ Options This value is used when querying a package to see who was the builder. It is recommended you change this to your name and email address. +**COMPRESSGZ=**"(gzip -c -f -n)", **COMPRESSBZ2=**"(bzip2 -c -f)", **COMPRESSXZ=**"(xz -c -z -)", **COMPRESSZ=**"(compress -c -f)":: + Sets the command and options used when compressing compiled or source + packages in the named format. + **PKGEXT=**".pkg.tar.gz", **SRCEXT=**".src.tar.gz":: Sets the compression used when making compiled or source packages. The current valid suffixes are `.tar`, `.tar.gz`, `.tar.bz2`, `.tar.xz`, and diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index e9152c8..6c87ea4 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -107,6 +107,16 @@ PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod) #GPGKEY="" ######################################################################### +# COMPRESSION DEFAULTS +######################################################################### +# +COMPRESSGZ=(gzip -c -f -n) +COMPRESSBZ2=(bzip2 -c -f) +COMPRESSXZ=(xz -c -z -) +COMPRESSZ=(compress -c -f) + + +######################################################################### # EXTENSION DEFAULTS ######################################################################### # diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index aa98cfa..0fab2a1 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1292,10 +1292,10 @@ create_package() { # Disable bsdtar compression and use gzip -n for now. bsdtar -cf - $comp_files * | case "$PKGEXT" in - *tar.gz) gzip -c -f -n ;; - *tar.bz2) bzip2 -c -f ;; - *tar.xz) xz -c -z - ;; - *tar.Z) compress -c -f ;; + *tar.gz) "${COMPRESSGZ[@]:-gzip -c -f -n}" ;; + *tar.bz2) "${COMPRESSBZ2[@]:-bzip2 -c -f}" ;; + *tar.xz) "${COMPRESSXZ[@]:-xz -c -z -}" ;; + *tar.Z) "${COMPRESSZ[@]:-compress -c -f}" ;; *tar) cat ;; *) warning "$(gettext "'%s' is not a valid archive extension.")" \ "$PKGEXT"; cat ;; -- 1.7.9
On 11.02.2012 10:56, Allan McRae wrote:
From: Christian Hesse <mail@earthworm.de>
Adds the ability to override the commands used to compressing compiled and source packages. This is useful for those wanting to use alternative implementations of the compression tools or non-default compression options.
There is really no need to do that as gzip already has the GZIP environment variable, xz has XZ_DEFAULTS and XZ_OPT, bzip2 has BZIP2 and BZIP. compress doesn't have something like that afaict. These variables can contain command line options which will be parsed before the real command line options. (Refer to the gzip, bzip2, xz manpages for more info) You can test this by adding 'export XZ_OPT=-h"' to package() and xz will then output the help msg to the package file. (bsdtar will also print an error, but that's expected) -- Florian Pritz
On 11/02/12 19:56, Florian Pritz wrote:
On 11.02.2012 10:56, Allan McRae wrote:
From: Christian Hesse <mail@earthworm.de>
Adds the ability to override the commands used to compressing compiled and source packages. This is useful for those wanting to use alternative implementations of the compression tools or non-default compression options.
There is really no need to do that as gzip already has the GZIP environment variable, xz has XZ_DEFAULTS and XZ_OPT, bzip2 has BZIP2 and BZIP. compress doesn't have something like that afaict.
These variables can contain command line options which will be parsed before the real command line options. (Refer to the gzip, bzip2, xz manpages for more info)
You can test this by adding 'export XZ_OPT=-h"' to package() and xz will then output the help msg to the package file. (bsdtar will also print an error, but that's expected)
And how do you specify using pgzip that way?
On 11.02.2012 11:14, Allan McRae wrote:
On 11/02/12 19:56, Florian Pritz wrote:
On 11.02.2012 10:56, Allan McRae wrote:
From: Christian Hesse <mail@earthworm.de>
Adds the ability to override the commands used to compressing compiled and source packages. This is useful for those wanting to use alternative implementations of the compression tools or non-default compression options.
There is really no need to do that as gzip already has the GZIP environment variable, xz has XZ_DEFAULTS and XZ_OPT, bzip2 has BZIP2 and BZIP. compress doesn't have something like that afaict.
These variables can contain command line options which will be parsed before the real command line options. (Refer to the gzip, bzip2, xz manpages for more info)
You can test this by adding 'export XZ_OPT=-h"' to package() and xz will then output the help msg to the package file. (bsdtar will also print an error, but that's expected)
And how do you specify using pgzip that way?
Valid point I guess. -- Florian Pritz
participants (2)
-
Allan McRae
-
Florian Pritz