From c7d48443867e032edbf0f29e576a46fc1dc03804 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 24 Mar 2023 00:34:40 +0100 Subject: [PATCH] maketgz: add .xz, .bz2, .zip source archive formats (#874) Copied from curl: https://github.com/curl/curl/blob/4528690cd51e5445df74aef8f83470a602683797/maketgz#L174-L222 [ci skip] --- .gitignore | 3 +++ maketgz | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/.gitignore b/.gitignore index f740e528..4292e8d6 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,10 @@ libtool ltmain.sh missing ssh2_sample +libssh2-*.tar.bz2 libssh2-*.tar.gz +libssh2-*.tar.xz +libssh2-*.zip install-sh *.o *.lo diff --git a/maketgz b/maketgz index 0a3da5dd..a53f20d8 100755 --- a/maketgz +++ b/maketgz @@ -99,3 +99,52 @@ git log --pretty=fuller --no-color --date=short --decorate=full -1000 | ./git2ne echo "make dist" targz="libssh2-$version.tar.gz" make -s dist VERSION=$version +res=$? + +if test "$res" != 0; then + echo "make dist failed" + exit 2 +fi + +############################################################################ +# +# Now make a bz2 archive from the tar.gz original +# + +bzip2="libssh2-$version.tar.bz2" +echo "Generating $bzip2" +gzip -dc $targz | bzip2 --best > $bzip2 + +############################################################################ +# +# Now make an xz archive from the tar.gz original +# + +xz="libssh2-$version.tar.xz" +echo "Generating $xz" +gzip -dc $targz | xz -6e - > $xz + +############################################################################ +# +# Now make a zip archive from the tar.gz original +# +makezip() { + rm -rf $tempdir + mkdir $tempdir + cd $tempdir + gzip -dc ../$targz | tar -xf - + find . | zip $zip -@ >/dev/null + mv $zip ../ + cd .. + rm -rf $tempdir +} + +zip="libssh2-$version.zip" +echo "Generating $zip" +tempdir=".builddir" +makezip + +echo "------------------" +echo "maketgz report:" +echo "" +ls -l $targz $bzip2 $zip $xz