]>
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 | ||
b32b8144 FG |
23 | download_boost() { |
24 | boost_version=$1 | |
25 | shift | |
11fdf7f2 | 26 | boost_sha256=$1 |
b32b8144 FG |
27 | shift |
28 | boost_version_underscore=$(echo $boost_version | sed 's/\./_/g') | |
29 | boost_fname=boost_${boost_version_underscore}.tar.bz2 | |
30 | set +e | |
31 | while true; do | |
32 | url_base=$1 | |
33 | shift | |
34 | if [ -z $url_base ]; then | |
35 | echo "Error: failed to download boost." | |
36 | exit | |
37 | fi | |
38 | url=$url_base/$boost_fname | |
39 | wget -c --no-verbose -O $boost_fname $url | |
40 | if [ $? != 0 -o ! -e $boost_fname ]; then | |
41 | echo "Download of $url failed" | |
11fdf7f2 TL |
42 | elif [ $(sha256sum $boost_fname | awk '{print $1}') != $boost_sha256 ]; then |
43 | echo "Error: failed to download boost: SHA256 mismatch." | |
b32b8144 FG |
44 | else |
45 | break | |
46 | fi | |
47 | done | |
48 | set -e | |
49 | tar xjf $boost_fname -C src \ | |
50 | --exclude="$boost_version_underscore/libs/*/doc" \ | |
51 | --exclude="$boost_version_underscore/libs/*/example" \ | |
52 | --exclude="$boost_version_underscore/libs/*/examples" \ | |
53 | --exclude="$boost_version_underscore/libs/*/meta" \ | |
54 | --exclude="$boost_version_underscore/libs/*/test" \ | |
55 | --exclude="$boost_version_underscore/tools/boostbook" \ | |
56 | --exclude="$boost_version_underscore/tools/quickbook" \ | |
57 | --exclude="$boost_version_underscore/tools/auto_index" \ | |
58 | --exclude='doc' --exclude='more' --exclude='status' | |
59 | mv src/boost_${boost_version_underscore} src/boost | |
60 | tar cf ${outfile}.boost.tar ${outfile}/src/boost | |
61 | rm -rf src/boost | |
62 | } | |
63 | ||
11fdf7f2 TL |
64 | _python_autoselect() { |
65 | python_command= | |
66 | for interpreter in python2.7 python3 ; do | |
67 | type $interpreter > /dev/null 2>&1 || continue | |
68 | python_command=$interpreter | |
69 | break | |
70 | done | |
71 | if [ -z "$python_command" ] ; then | |
72 | echo "Could not find a suitable python interpreter! Bailing out." | |
73 | exit 1 | |
74 | fi | |
75 | echo $python_command | |
76 | } | |
77 | ||
78 | build_dashboard_frontend() { | |
79 | CURR_DIR=`pwd` | |
80 | TEMP_DIR=`mktemp -d` | |
81 | $CURR_DIR/src/tools/setup-virtualenv.sh --python=$(_python_autoselect) $TEMP_DIR | |
82 | $TEMP_DIR/bin/pip install nodeenv | |
83 | $TEMP_DIR/bin/nodeenv -p --node=10.13.0 | |
84 | cd src/pybind/mgr/dashboard/frontend | |
85 | . $TEMP_DIR/bin/activate | |
86 | npm ci | |
87 | npm run build -- --prod --progress=false | |
88 | deactivate | |
89 | cd $CURR_DIR | |
90 | rm -rf $TEMP_DIR | |
91 | tar cf dashboard_frontend.tar $outfile/src/pybind/mgr/dashboard/frontend/dist | |
92 | } | |
93 | ||
7c673cae FG |
94 | # clean out old cruft... |
95 | echo "cleanup..." | |
96 | rm -f $outfile* | |
97 | ||
98 | # build new tarball | |
99 | echo "building tarball..." | |
100 | bin/git-archive-all.sh --prefix ceph-$version/ \ | |
101 | --verbose \ | |
102 | --ignore corpus \ | |
103 | $outfile.tar | |
104 | ||
105 | # populate files with version strings | |
106 | echo "including src/.git_version, ceph.spec" | |
107 | ||
108 | (git rev-parse HEAD ; git describe) 2> /dev/null > src/.git_version | |
109 | ||
110 | # if the version has '-' in it, it has a 'release' part, | |
111 | # like vX.Y.Z-N-g<shortsha1>. If it doesn't, it's just | |
112 | # vX.Y.Z. Handle both, and translate - to . for rpm | |
113 | # naming rules (the - separates version and release). | |
114 | ||
115 | if expr index $version '-' > /dev/null; then | |
116 | rpm_version=`echo $version | cut -d - -f 1-1` | |
117 | rpm_release=`echo $version | cut -d - -f 2- | sed 's/-/./'` | |
118 | else | |
119 | rpm_version=$version | |
120 | rpm_release=0 | |
121 | fi | |
122 | ||
7c673cae FG |
123 | for spec in ceph.spec.in alpine/APKBUILD.in; do |
124 | cat $spec | | |
125 | sed "s/@VERSION@/$rpm_version/g" | | |
126 | sed "s/@RPM_RELEASE@/$rpm_release/g" | | |
127 | sed "s/@TARBALL_BASENAME@/ceph-$version/g" > `echo $spec | sed 's/.in$//'` | |
128 | done | |
129 | ln -s . $outfile | |
130 | tar cvf $outfile.version.tar $outfile/src/.git_version $outfile/ceph.spec $outfile/alpine/APKBUILD | |
b32b8144 FG |
131 | # NOTE: If you change this version number make sure the package is available |
132 | # at the three URLs referenced below (may involve uploading to download.ceph.com) | |
11fdf7f2 TL |
133 | boost_version=1.67.0 |
134 | download_boost $boost_version 2684c972994ee57fc5632e03bf044746f6eb45d4920c343937a465fd67a5adba \ | |
b32b8144 FG |
135 | https://dl.bintray.com/boostorg/release/$boost_version/source \ |
136 | https://downloads.sourceforge.net/project/boost/boost/$boost_version \ | |
137 | https://download.ceph.com/qa | |
11fdf7f2 | 138 | build_dashboard_frontend |
b32b8144 FG |
139 | tar --concatenate -f $outfile.all.tar $outfile.version.tar |
140 | tar --concatenate -f $outfile.all.tar $outfile.boost.tar | |
141 | tar --concatenate -f $outfile.all.tar $outfile.tar | |
11fdf7f2 | 142 | tar --concatenate -f $outfile.all.tar dashboard_frontend.tar |
b32b8144 | 143 | mv $outfile.all.tar $outfile.tar |
7c673cae FG |
144 | rm $outfile |
145 | rm -f $outfile.version.tar | |
b32b8144 | 146 | rm -f $outfile.boost.tar |
7c673cae FG |
147 | |
148 | echo "compressing..." | |
149 | bzip2 -9 $outfile.tar | |
150 | ||
151 | echo "done." |