forked from pythongssapi/python-gssapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-release-tar.sh
executable file
·72 lines (54 loc) · 1.48 KB
/
create-release-tar.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash -ex
source ./ci/lib.sh
lib::setup::install
yum -y install tar git
# Git complains if this isn't owned by the user which is the case when running
# through the run-on-linux.sh
if [ -f /.dockerenv ]; then
git config --global --add safe.directory "${PWD}"
fi
# build the docs
lib::deploy::build_docs
# Save the sdist and venv dirs before the clean
mv dist dist_saved
mv .venv /tmp/.venv
# for the tarball upload
# clean up
git clean -Xdf
# restore the saved "dist"/".venv" directory
mv dist_saved dist
mv /tmp/.venv .venv
# make the dir
rm -rf ./tag_build || true
mkdir ./tag_build
# create and checksum the tarball
set +e
tag=$(git describe --tags)
if [ "${?}" -ne 0 ]; then
tag=$(git rev-parse --short HEAD)
fi
set -e
if [ x"${tag#v[0-9]}" = "x${tag}" ]; then
PYTHON_GSSAPI_VERSION=${tag}
else
PYTHON_GSSAPI_VERSION=${tag#v}
fi
PKG_NAME_VER="python-gssapi-${PYTHON_GSSAPI_VERSION}"
tar -cvf ./tag_build/${PKG_NAME_VER}.tar \
--exclude='dist' \
--exclude='tag_build' \
--exclude='.git' \
--exclude='ci_docs_build' \
--exclude='.venv' \
--exclude='README.rst' \
--transform="s,^\.,${PKG_NAME_VER}," .
# --transform clobbers symlink so add it last using Python
python - << EOF
import tarfile
with tarfile.open("tag_build/${PKG_NAME_VER}.tar", mode="a:") as tf:
tf.add("README.rst", arcname="${PKG_NAME_VER}/README.rst")
EOF
pushd ./tag_build
gzip ${PKG_NAME_VER}.tar
sha512sum --binary ${PKG_NAME_VER}.tar.gz > ${PKG_NAME_VER}.sha512sum
popd