forked from xrootd/xrootd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen-tarball.sh
executable file
·39 lines (37 loc) · 991 Bytes
/
gen-tarball.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
#!/bin/bash
# Generate a source tarball including submodules
if [ -z "${1}" ] ; then
echo No tag or branch given
exit 1
fi
ver=${1}
# Remove initial v from tag name for use in filenames
if [ ${ver:0:1} = 'v' ] ; then
fver=${ver:1}
else
fver=${ver}
fi
if [ -r xrootd-${fver}.tar.gz ] ; then
echo xrootd-${fver}.tar.gz already exists
exit 1
fi
curdir=$(pwd)
tdir=$(mktemp -d)
cd ${tdir}
git clone https://github.com/xrootd/xrootd.git
cd xrootd
git checkout ${ver}
if [ $? -ne 0 ] ; then
echo No such tag or branch: ${ver}
cd ${curdir}
rm -rf ${tdir}
exit 1
fi
git archive --prefix xrootd-${fver}/ ${ver} -o ${tdir}/xrootd-${fver}.tar
git submodule update --init
git submodule foreach --recursive "git archive --prefix xrootd-${fver}/\$path/ \$sha1 -o ${tdir}/\$sha1.tar ; tar -A -f ${tdir}/xrootd-${fver}.tar ${tdir}/\$sha1.tar ; rm ${tdir}/\$sha1.tar"
cd ${tdir}
gzip xrootd-${fver}.tar
mv xrootd-${fver}.tar.gz ${curdir}
cd ${curdir}
rm -rf ${tdir}