diff mbox series

[v5,3/5] opkg-build: Add zstandard compressor support

Message ID 20230724204018.352695-3-p.lobacz@welotec.com
State New
Headers show
Series [v5,1/5] opkg-build: make sure destination dir exists | expand

Commit Message

Piotr Ɓobacz July 24, 2023, 8:40 p.m. UTC
From: Henry Kleynhans <hkleynhans@fb.com>

Add ztsd compressor option to support using zstandard for packages.

Zstandard compression offers a significant speed increase at
decompression time over the current default (xz). This is amplified on
less capable hardware as used in embedded devices.  Further more, it
offers a slightly faster compression speed at the highest compression
levels with a slightly lower compression ratio and the ability to
choose your own compromise between fast compression speed with less
compression and slower compression speed with more compression.

Zstandard would therefore be a good solution for package compression when:
* install time matters, especially if you are installing on less capable
  hardware
* disk space is not a concern: lower compression can speed up developer
  builds, especially incremental builds
* disk space is a concern: release builds can make use of the highest
  compression setting to reduce package sizes

Signed-off-by: Henry Kleynhans <hkleynhans@fb.com>
Signed-off-by: Alex Stewart <alex.stewart@ni.com>
---
 opkg-build | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/opkg-build b/opkg-build
index 3333020..a9e45d4 100755
--- a/opkg-build
+++ b/opkg-build
@@ -183,6 +183,9 @@  compressor_ext() {
 	lz4)
 	    echo lz4
 	    ;;
+	zstd)
+	    echo zst
+	    ;;
 
 	*)
 	    echo "*** Error: unsupported compression scheme: $1" >&2
@@ -198,7 +201,7 @@  B<opkg-build> [B<-c>] [B<-C>] [B<-Z> I<compressor>] [B<-a>] [B<-O>] [B<-o> I<own
 
 =cut
 
-usage="Usage: $0 [-c] [-C] [-Z compressor] [-a] [-O] [-o owner] [-g group] <pkg_directory> [<destination_directory>]"
+usage="Usage: $0 [-c] [-C] [-Z compressor] [-a compressor_args] [-O] [-o owner] [-g group] <pkg_directory> [<destination_directory>]"
 while getopts "a:cCg:ho:vOZ:" opt; do
     case $opt in
 	o ) owner=$OPTARG
@@ -364,7 +367,7 @@  Stop with an error if any files ending with B<~> are found. The default behaviou
 
 =item B<-Z> I<compressor>
 
-Specify which compression type to use when building a package. Allowed values are B<gzip>, B<pigz>, B<bzip2>, B<lz4> and B<xz> (default is B<gzip>).
+Specify which compression type to use when building a package. Allowed values are B<gzip>, B<pigz>, B<bzip2>, B<lz4>, B<xz> and B<zstd> (default is B<gzip>).
 
 =item B<-a> I<compressor-args>