]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/bin/sh -e |
2 | ||
3 | if [ ! -d .git ]; then | |
4 | echo "no .git present. run this from the base dir of the git checkout." | |
5 | exit 1 | |
6 | fi | |
7 | ||
8 | version=$1 | |
9 | [ -z "$version" ] && version=`git describe --match 'v*' | sed 's/^v//'` | |
10 | outfile="ceph-$version" | |
11 | ||
12 | echo "version $version" | |
13 | ||
14 | # update submodules | |
15 | echo "updating submodules..." | |
16 | force=$(if git submodule usage 2>&1 | grep --quiet 'update.*--force'; then echo --force ; fi) | |
17 | if ! git submodule sync || ! git submodule update $force --init --recursive; then | |
18 | echo "Error: could not initialize submodule projects" | |
19 | echo " Network connectivity might be required." | |
20 | exit 1 | |
21 | fi | |
22 | ||
23 | # clean out old cruft... | |
24 | echo "cleanup..." | |
25 | rm -f $outfile* | |
26 | ||
27 | # build new tarball | |
28 | echo "building tarball..." | |
29 | bin/git-archive-all.sh --prefix ceph-$version/ \ | |
30 | --verbose \ | |
31 | --ignore corpus \ | |
32 | $outfile.tar | |
33 | ||
34 | # populate files with version strings | |
35 | echo "including src/.git_version, ceph.spec" | |
36 | ||
37 | (git rev-parse HEAD ; git describe) 2> /dev/null > src/.git_version | |
38 | ||
39 | # if the version has '-' in it, it has a 'release' part, | |
40 | # like vX.Y.Z-N-g<shortsha1>. If it doesn't, it's just | |
41 | # vX.Y.Z. Handle both, and translate - to . for rpm | |
42 | # naming rules (the - separates version and release). | |
43 | ||
44 | if expr index $version '-' > /dev/null; then | |
45 | rpm_version=`echo $version | cut -d - -f 1-1` | |
46 | rpm_release=`echo $version | cut -d - -f 2- | sed 's/-/./'` | |
47 | else | |
48 | rpm_version=$version | |
49 | rpm_release=0 | |
50 | fi | |
51 | ||
52 | ||
53 | for spec in ceph.spec.in alpine/APKBUILD.in; do | |
54 | cat $spec | | |
55 | sed "s/@VERSION@/$rpm_version/g" | | |
56 | sed "s/@RPM_RELEASE@/$rpm_release/g" | | |
57 | sed "s/@TARBALL_BASENAME@/ceph-$version/g" > `echo $spec | sed 's/.in$//'` | |
58 | done | |
59 | ln -s . $outfile | |
60 | tar cvf $outfile.version.tar $outfile/src/.git_version $outfile/ceph.spec $outfile/alpine/APKBUILD | |
61 | tar --concatenate -f $outfile.both.tar $outfile.version.tar | |
62 | tar --concatenate -f $outfile.both.tar $outfile.tar | |
63 | mv $outfile.both.tar $outfile.tar | |
64 | rm $outfile | |
65 | rm -f $outfile.version.tar | |
66 | ||
67 | echo "compressing..." | |
68 | bzip2 -9 $outfile.tar | |
69 | ||
70 | echo "done." |