diff mbox

[pacman-dev] Add lz4 compression support to makepkg

Message ID 20180531133118.7209-1-alexheretic@gmail.com
State Accepted, archived
Headers show

Commit Message

Alex Butler May 31, 2018, 1:31 p.m. UTC
Adds opt-in lz4 compression of *pkg.tar files with makepkg.
This is nice to have as an option for very fast compression
and is already installed with libarchive.

Signed-off-by: Alex Butler<alexheretic@gmail.com>
---
 doc/makepkg.conf.5.asciidoc            | 3 ++-
 etc/makepkg.conf.in                    | 1 +
 scripts/libmakepkg/util/compress.sh.in | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

Comments

Allan McRae June 4, 2018, 7:48 a.m. UTC | #1
On 31/05/18 23:31, Alex Butler wrote:
> Adds opt-in lz4 compression of *pkg.tar files with makepkg.
> This is nice to have as an option for very fast compression
> and is already installed with libarchive.
> 
> Signed-off-by: Alex Butler<alexheretic@gmail.com>
> ---

This patch is fine in principle.  But I think we need to figure out what
to do with all the COMPRESS* options.  This will make seven of them and
we have a request for another compression method too.  There has to be a
more efficient way of overriding the range of compression options.

>  doc/makepkg.conf.5.asciidoc            | 3 ++-
>  etc/makepkg.conf.in                    | 1 +
>  scripts/libmakepkg/util/compress.sh.in | 1 +
>  3 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/makepkg.conf.5.asciidoc b/doc/makepkg.conf.5.asciidoc
> index 3b596a91..7fd75a1d 100644
> --- a/doc/makepkg.conf.5.asciidoc
> +++ b/doc/makepkg.conf.5.asciidoc
> @@ -251,6 +251,7 @@ Options
>  **COMPRESSXZ=**"(xz -c -z -)"::
>  **COMPRESSLZO**"(lzop -q)"::
>  **COMPRESSLRZ=**"(lrzip -q)"::
> +**COMPRESSLZ4=**"(lz4 -q)"::
>  **COMPRESSZ=**"(compress -c -f)"::
>  	Sets the command and options used when compressing compiled or source
>  	packages in the named format.
> @@ -258,7 +259,7 @@ Options
>  **PKGEXT=**".pkg.tar.gz", **SRCEXT=**".src.tar.gz"::
>  	Sets the compression used when making compiled or source packages.
>  	Valid suffixes are `.tar`, `.tar.gz`, `.tar.bz2`, `.tar.xz`,
> -	`.tar.lzo`, `.tar.lrz`, and `.tar.Z`.
> +	`.tar.lzo`, `.tar.lrz`, `.tar.lz4`, and `.tar.Z`.
>  	Do not touch these unless you know what you are doing.
>  
>  
> diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in
> index 1cf79664..01f8df2c 100644
> --- a/etc/makepkg.conf.in
> +++ b/etc/makepkg.conf.in
> @@ -133,6 +133,7 @@ COMPRESSXZ=(xz -c -z -)
>  COMPRESSLRZ=(lrzip -q)
>  COMPRESSLZO=(lzop -q)
>  COMPRESSZ=(compress -c -f)
> +COMPRESSLZ4=(lz4 -q)
>  
>  #########################################################################
>  # EXTENSION DEFAULTS
> diff --git a/scripts/libmakepkg/util/compress.sh.in b/scripts/libmakepkg/util/compress.sh.in
> index 3a332817..4d8cd46a 100644
> --- a/scripts/libmakepkg/util/compress.sh.in
> +++ b/scripts/libmakepkg/util/compress.sh.in
> @@ -40,6 +40,7 @@ compress_as() {
>  		*tar.lrz) ${COMPRESSLRZ[@]:-lrzip -q} ;;
>  		*tar.lzo) ${COMPRESSLZO[@]:-lzop -q} ;;
>  		*tar.Z)   ${COMPRESSZ[@]:-compress -c -f} ;;
> +		*tar.lz4) ${COMPRESSLZ4[@]:-lz4 -q} ;;
>  		*tar)     cat ;;
>  		*) warning "$(gettext "'%s' is not a valid archive extension.")" \
>  			"$ext"; cat ;;
>
Alex Butler June 4, 2018, 9:24 a.m. UTC | #2
On 4 June 2018 at 08:48, Allan McRae <allan@archlinux.org> wrote:

> On 31/05/18 23:31, Alex Butler wrote:
> > Adds opt-in lz4 compression of *pkg.tar files with makepkg.
> > This is nice to have as an option for very fast compression
> > and is already installed with libarchive.
> >
> > Signed-off-by: Alex Butler<alexheretic@gmail.com>
> > ---
>
> This patch is fine in principle.  But I think we need to figure out what
> to do with all the COMPRESS* options.  This will make seven of them and
> we have a request for another compression method too.  There has to be a
> more efficient way of overriding the range of compression options.
>
>
Perhaps. Though adding a new libarchive-supported compression option
currently costs 1 line of code, 1 line of conf & 1 line of docs. I'd say
that
was pretty good.

I also don't see that this patch particularly complicates any future
efforts
to improve the compression handling.
diff mbox

Patch

diff --git a/doc/makepkg.conf.5.asciidoc b/doc/makepkg.conf.5.asciidoc
index 3b596a91..7fd75a1d 100644
--- a/doc/makepkg.conf.5.asciidoc
+++ b/doc/makepkg.conf.5.asciidoc
@@ -251,6 +251,7 @@  Options
 **COMPRESSXZ=**"(xz -c -z -)"::
 **COMPRESSLZO**"(lzop -q)"::
 **COMPRESSLRZ=**"(lrzip -q)"::
+**COMPRESSLZ4=**"(lz4 -q)"::
 **COMPRESSZ=**"(compress -c -f)"::
 	Sets the command and options used when compressing compiled or source
 	packages in the named format.
@@ -258,7 +259,7 @@  Options
 **PKGEXT=**".pkg.tar.gz", **SRCEXT=**".src.tar.gz"::
 	Sets the compression used when making compiled or source packages.
 	Valid suffixes are `.tar`, `.tar.gz`, `.tar.bz2`, `.tar.xz`,
-	`.tar.lzo`, `.tar.lrz`, and `.tar.Z`.
+	`.tar.lzo`, `.tar.lrz`, `.tar.lz4`, and `.tar.Z`.
 	Do not touch these unless you know what you are doing.
 
 
diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in
index 1cf79664..01f8df2c 100644
--- a/etc/makepkg.conf.in
+++ b/etc/makepkg.conf.in
@@ -133,6 +133,7 @@  COMPRESSXZ=(xz -c -z -)
 COMPRESSLRZ=(lrzip -q)
 COMPRESSLZO=(lzop -q)
 COMPRESSZ=(compress -c -f)
+COMPRESSLZ4=(lz4 -q)
 
 #########################################################################
 # EXTENSION DEFAULTS
diff --git a/scripts/libmakepkg/util/compress.sh.in b/scripts/libmakepkg/util/compress.sh.in
index 3a332817..4d8cd46a 100644
--- a/scripts/libmakepkg/util/compress.sh.in
+++ b/scripts/libmakepkg/util/compress.sh.in
@@ -40,6 +40,7 @@  compress_as() {
 		*tar.lrz) ${COMPRESSLRZ[@]:-lrzip -q} ;;
 		*tar.lzo) ${COMPRESSLZO[@]:-lzop -q} ;;
 		*tar.Z)   ${COMPRESSZ[@]:-compress -c -f} ;;
+		*tar.lz4) ${COMPRESSLZ4[@]:-lz4 -q} ;;
 		*tar)     cat ;;
 		*) warning "$(gettext "'%s' is not a valid archive extension.")" \
 			"$ext"; cat ;;