summaryrefslogtreecommitdiffstats
path: root/external/boost/repack_tarball.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /external/boost/repack_tarball.sh
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'external/boost/repack_tarball.sh')
-rwxr-xr-xexternal/boost/repack_tarball.sh60
1 files changed, 60 insertions, 0 deletions
diff --git a/external/boost/repack_tarball.sh b/external/boost/repack_tarball.sh
new file mode 100755
index 000000000..ed27875f6
--- /dev/null
+++ b/external/boost/repack_tarball.sh
@@ -0,0 +1,60 @@
+#! /bin/sh
+
+# Repack the boost tarball as xz (much faster to unpack) and remove
+# a lot of needless files such as generated html docs.
+
+tarball="$1"
+
+if test -z "$tarball" -o ! -f "$tarball"; then
+ echo "Usage: $0 <tarball>"
+ exit 1
+fi
+
+tmpdir=$(mktemp -d)
+
+if ! test -d "$tmpdir"; then
+ echo mktemp failed
+ exit 1
+fi
+
+echo Unpacking "$tarball" ...
+tar x -C "$tmpdir" -f "$tarball"
+if test $? -ne 0; then
+ echo tar x failed
+ rm -rf "$tmpdir"
+ exit 1
+fi
+
+echo Removing unnecessary files ...
+find "$tmpdir" \( -name doc -o -name test -o -name example \) -type d -prune -print0 | xargs -0 rm -r
+if test $? -ne 0; then
+ echo file removal failed
+ rm -rf "$tmpdir"
+ exit 1
+fi
+
+name="$(basename "$tarball" | sed 's/\.tar.*$//').tar.xz"
+dir=$(ls "$tmpdir")
+
+echo Creating "$name" ...
+# To make the tarball reproducible, use a timestamp of a file inside the tarball (they all seem to have the same mtime).
+if ! test -f "$tmpdir/$dir/README.md"; then
+ echo timestamp retrieval failed, check the script
+ rm -rf "$tmpdir"
+ exit 1
+fi
+# Many of the options are to make the tarball reproducible.
+LC_ALL=C tar c -C "$tmpdir" --xz -f "$(pwd)/$name" --format=gnu --sort=name --owner=0 --group=0 --mode=go=rX,u=rwX --mtime "$tmpdir/$dir/README.md" "$dir"
+if test $? -ne 0; then
+ echo tar c failed
+ rm -rf "$tmpdir"
+ exit 1
+fi
+
+echo Cleaning up ...
+rm -rf "$tmpdir"
+
+sha256sum "$name"
+
+echo Done.
+exit 0