Skip to content

Commit ba0d41a

Browse files
committed
ENH: Use minimum system zstd in Linux scripts
Changes: - Add `--long=31` option for improved Linux build archive compression - Verify that zstd is at least v1.3.2 where `--long` is introduced - Remove zstd v1.2.0 download option
1 parent f38144a commit ba0d41a

File tree

2 files changed

+39
-11
lines changed

2 files changed

+39
-11
lines changed

scripts/dockcross-manylinux-build-tarball.sh

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,44 @@
77
if test -d /home/kitware/Packaging; then
88
cd /home/kitware/Packaging
99
fi
10-
zstd_exe=zstd
11-
if test -e /home/kitware/Support/zstd-build/programs/zstd; then
10+
11+
# -----------------------------------------------------------------------
12+
13+
zstd_exe=`(which zstd)`
14+
if [[ -z ${zstd_exe} && -e /home/kitware/Support/zstd-build/programs/zstd ]]; then
1215
zstd_exe=/home/kitware/Support/zstd-build/programs/zstd
1316
fi
17+
18+
# Find an appropriately versioned zstd.
19+
#
20+
# "--long" is introduced in zstd==v1.3.2
21+
# https://github.com/facebook/zstd/releases/tag/v1.3.2
22+
#
23+
# Sample --version output:
24+
# *** zstd command line interface 64-bits v1.4.4, by Yann Collet *** #
25+
ZSTD_MIN_VERSION="1.3.2"
26+
27+
if [[ -n `(which dpkg)` && `(${zstd_exe} --version)` =~ v([0-9]+.[0-9]+.[0-9]+) ]]; then
28+
if $(dpkg --compare-versions ${BASH_REMATCH[1]} "ge" ${ZSTD_MIN_VERSION} ); then
29+
echo "Found zstd v${BASH_REMATCH[1]} at ${zstd_exe}"
30+
else
31+
echo "Expected zstd v${ZSTD_MIN_VERSION} or higher but found v${BASH_REMATCH[1]} at ${zstd_exe}"
32+
exit 255
33+
fi
34+
else
35+
# dpkg not available for version comparison so simply print version
36+
${zstd_exe} --version
37+
fi
38+
39+
# -----------------------------------------------------------------------
40+
1441
tar -c --to-stdout \
1542
ITKPythonPackage/ITK-* \
1643
ITKPythonPackage/oneTBB* \
1744
ITKPythonPackage/scripts > ITKPythonBuilds-linux.tar
1845
$zstd_exe -f \
1946
-10 \
2047
-T6 \
48+
--long=31 \
2149
./ITKPythonBuilds-linux.tar \
2250
-o ./ITKPythonBuilds-linux.tar.zst

scripts/dockcross-manylinux-download-cache-and-build-module-wheels.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ do
3535
done
3636
# -----------------------------------------------------------------------
3737

38-
# Packages distributed by github are in zstd format, so we need to download that binary to uncompress
39-
if [[ ! -f zstd-1.2.0-linux.tar.gz ]]; then
40-
curl https://data.kitware.com/api/v1/file/592dd8068d777f16d01e1a92/download -o zstd-1.2.0-linux.tar.gz
41-
gunzip -d zstd-1.2.0-linux.tar.gz
42-
tar xf zstd-1.2.0-linux.tar
43-
fi
44-
if [[ ! -f ./zstd-1.2.0-linux/bin/unzstd ]]; then
45-
echo "ERROR: can not find required binary './zstd-1.2.0-linux/bin/unzstd'"
38+
# Verifies that unzstd binary is available to decompress ITK build archives.
39+
unzstd_exe=`(which unzstd)`
40+
41+
if [[ -z ${unzstd_exe} ]]; then
42+
echo "ERROR: can not find required binary 'unzstd' "
4643
exit 255
4744
fi
4845

46+
# Expect unzstd > v1.3.2, see discussion in `dockcross-manylinux-build-tarball.sh`
47+
${unzstd_exe} --version
48+
4949
TARBALL_NAME="ITKPythonBuilds-linux${TARBALL_SPECIALIZATION}.tar"
5050

5151
if [[ ! -f ${TARBALL_NAME}.zst ]]; then
@@ -55,7 +55,7 @@ if [[ ! -f ./${TARBALL_NAME}.zst ]]; then
5555
echo "ERROR: can not find required binary './${TARBALL_NAME}.zst'"
5656
exit 255
5757
fi
58-
./zstd-1.2.0-linux/bin/unzstd ./${TARBALL_NAME}.zst -o ${TARBALL_NAME}
58+
${unzstd_exe} --long=31 ./${TARBALL_NAME}.zst -o ${TARBALL_NAME}
5959
if [ "$#" -lt 1 ]; then
6060
echo "Extracting all files";
6161
tar xf ${TARBALL_NAME}

0 commit comments

Comments
 (0)