]>
Commit | Line | Data |
---|---|---|
9f95a23c | 1 | #!/bin/bash -e |
7c673cae FG |
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 | |
9f95a23c TL |
9 | [ -z "$version" ] && version=$(git describe --long --match 'v*' | sed 's/^v//') |
10 | if expr index $version '-' > /dev/null; then | |
11 | rpm_version=$(echo $version | cut -d - -f 1-1) | |
12 | rpm_release=$(echo $version | cut -d - -f 2- | sed 's/-/./') | |
13 | else | |
14 | rpm_version=$version | |
15 | rpm_release=0 | |
16 | fi | |
7c673cae | 17 | |
9f95a23c | 18 | outfile="ceph-$version" |
7c673cae FG |
19 | echo "version $version" |
20 | ||
21 | # update submodules | |
22 | echo "updating submodules..." | |
23 | force=$(if git submodule usage 2>&1 | grep --quiet 'update.*--force'; then echo --force ; fi) | |
24 | if ! git submodule sync || ! git submodule update $force --init --recursive; then | |
25 | echo "Error: could not initialize submodule projects" | |
26 | echo " Network connectivity might be required." | |
27 | exit 1 | |
28 | fi | |
29 | ||
b32b8144 FG |
30 | download_boost() { |
31 | boost_version=$1 | |
32 | shift | |
11fdf7f2 | 33 | boost_sha256=$1 |
b32b8144 FG |
34 | shift |
35 | boost_version_underscore=$(echo $boost_version | sed 's/\./_/g') | |
36 | boost_fname=boost_${boost_version_underscore}.tar.bz2 | |
37 | set +e | |
38 | while true; do | |
39 | url_base=$1 | |
40 | shift | |
41 | if [ -z $url_base ]; then | |
42 | echo "Error: failed to download boost." | |
43 | exit | |
44 | fi | |
45 | url=$url_base/$boost_fname | |
46 | wget -c --no-verbose -O $boost_fname $url | |
47 | if [ $? != 0 -o ! -e $boost_fname ]; then | |
48 | echo "Download of $url failed" | |
11fdf7f2 TL |
49 | elif [ $(sha256sum $boost_fname | awk '{print $1}') != $boost_sha256 ]; then |
50 | echo "Error: failed to download boost: SHA256 mismatch." | |
b32b8144 FG |
51 | else |
52 | break | |
53 | fi | |
54 | done | |
55 | set -e | |
56 | tar xjf $boost_fname -C src \ | |
57 | --exclude="$boost_version_underscore/libs/*/doc" \ | |
58 | --exclude="$boost_version_underscore/libs/*/example" \ | |
59 | --exclude="$boost_version_underscore/libs/*/examples" \ | |
60 | --exclude="$boost_version_underscore/libs/*/meta" \ | |
61 | --exclude="$boost_version_underscore/libs/*/test" \ | |
62 | --exclude="$boost_version_underscore/tools/boostbook" \ | |
63 | --exclude="$boost_version_underscore/tools/quickbook" \ | |
64 | --exclude="$boost_version_underscore/tools/auto_index" \ | |
65 | --exclude='doc' --exclude='more' --exclude='status' | |
66 | mv src/boost_${boost_version_underscore} src/boost | |
67 | tar cf ${outfile}.boost.tar ${outfile}/src/boost | |
68 | rm -rf src/boost | |
69 | } | |
70 | ||
11fdf7f2 TL |
71 | build_dashboard_frontend() { |
72 | CURR_DIR=`pwd` | |
73 | TEMP_DIR=`mktemp -d` | |
eafe8130 | 74 | |
92f5a8d4 | 75 | $CURR_DIR/src/tools/setup-virtualenv.sh $TEMP_DIR |
11fdf7f2 | 76 | $TEMP_DIR/bin/pip install nodeenv |
9f95a23c | 77 | $TEMP_DIR/bin/nodeenv -p --node=10.18.1 |
11fdf7f2 | 78 | cd src/pybind/mgr/dashboard/frontend |
eafe8130 TL |
79 | |
80 | DEFAULT_LANG=`jq -r .config.locale package.json` | |
81 | if [ -z "$DASHBOARD_FRONTEND_LANGS" ]; then | |
82 | BUILD_TARGET=":${DEFAULT_LANG}" | |
83 | else | |
84 | if [ "$DASHBOARD_FRONTEND_LANGS" == "ALL" ]; then | |
85 | BUILD_TARGET=":*" | |
86 | else | |
87 | DASHBOARD_FRONTEND_LANGS_LIST=`echo "$DASHBOARD_FRONTEND_LANGS" | sed 's/ /,/g'` | |
88 | if [[ $DASHBOARD_FRONTEND_LANGS_LIST != *"${DEFAULT_LANG}"* ]]; then | |
89 | # default language must be always built | |
90 | DASHBOARD_FRONTEND_LANGS_LIST="${DASHBOARD_FRONTEND_LANGS},${DEFAULT_LANG}" | |
91 | fi | |
92 | BUILD_TARGET=":{${DASHBOARD_FRONTEND_LANGS_LIST}}" | |
93 | fi | |
94 | fi | |
9f95a23c TL |
95 | # number of frontend languages to build in parallel - default to 1 to work |
96 | # around https://tracker.ceph.com/issues/43152 | |
97 | [ -z "$MAX_DASHBOARD_PARALLEL_BUILDS" ] && MAX_DASHBOARD_PARALLEL_BUILDS=1 | |
eafe8130 | 98 | |
11fdf7f2 | 99 | . $TEMP_DIR/bin/activate |
9f95a23c | 100 | NG_CLI_ANALYTICS="false" timeout 1h npm ci |
eafe8130 TL |
101 | echo "Building ceph-dashboard frontend with build${BUILD_TARGET} script"; |
102 | # we need to use "-- --" because so that "--prod" survives accross all | |
103 | # scripts redirections inside package.json | |
104 | npx npm-run-all --print-label --parallel --max-parallel $MAX_DASHBOARD_PARALLEL_BUILDS "build${BUILD_TARGET} -- -- --prod" | |
11fdf7f2 TL |
105 | deactivate |
106 | cd $CURR_DIR | |
107 | rm -rf $TEMP_DIR | |
108 | tar cf dashboard_frontend.tar $outfile/src/pybind/mgr/dashboard/frontend/dist | |
109 | } | |
110 | ||
9f95a23c TL |
111 | generate_rook_ceph_client() { |
112 | $outfile/src/pybind/mgr/rook/generate_rook_ceph_client.sh | |
113 | tar cf rook_ceph_client.tar $outfile/src/pybind/mgr/rook/rook_client/*.py | |
114 | } | |
115 | ||
7c673cae FG |
116 | # clean out old cruft... |
117 | echo "cleanup..." | |
118 | rm -f $outfile* | |
119 | ||
120 | # build new tarball | |
121 | echo "building tarball..." | |
122 | bin/git-archive-all.sh --prefix ceph-$version/ \ | |
123 | --verbose \ | |
124 | --ignore corpus \ | |
125 | $outfile.tar | |
126 | ||
127 | # populate files with version strings | |
128 | echo "including src/.git_version, ceph.spec" | |
129 | ||
9f95a23c | 130 | (git rev-parse HEAD ; echo $version) 2> /dev/null > src/.git_version |
7c673cae | 131 | |
7c673cae FG |
132 | for spec in ceph.spec.in alpine/APKBUILD.in; do |
133 | cat $spec | | |
9f95a23c | 134 | sed "s/@PROJECT_VERSION@/$rpm_version/g" | |
7c673cae FG |
135 | sed "s/@RPM_RELEASE@/$rpm_release/g" | |
136 | sed "s/@TARBALL_BASENAME@/ceph-$version/g" > `echo $spec | sed 's/.in$//'` | |
137 | done | |
138 | ln -s . $outfile | |
139 | tar cvf $outfile.version.tar $outfile/src/.git_version $outfile/ceph.spec $outfile/alpine/APKBUILD | |
b32b8144 FG |
140 | # NOTE: If you change this version number make sure the package is available |
141 | # at the three URLs referenced below (may involve uploading to download.ceph.com) | |
92f5a8d4 TL |
142 | boost_version=1.72.0 |
143 | download_boost $boost_version 59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722 \ | |
b32b8144 FG |
144 | https://dl.bintray.com/boostorg/release/$boost_version/source \ |
145 | https://downloads.sourceforge.net/project/boost/boost/$boost_version \ | |
146 | https://download.ceph.com/qa | |
eafe8130 | 147 | |
11fdf7f2 | 148 | build_dashboard_frontend |
9f95a23c | 149 | generate_rook_ceph_client |
b32b8144 FG |
150 | tar --concatenate -f $outfile.all.tar $outfile.version.tar |
151 | tar --concatenate -f $outfile.all.tar $outfile.boost.tar | |
152 | tar --concatenate -f $outfile.all.tar $outfile.tar | |
11fdf7f2 | 153 | tar --concatenate -f $outfile.all.tar dashboard_frontend.tar |
9f95a23c | 154 | tar --concatenate -f $outfile.all.tar rook_ceph_client.tar |
b32b8144 | 155 | mv $outfile.all.tar $outfile.tar |
7c673cae FG |
156 | rm $outfile |
157 | rm -f $outfile.version.tar | |
b32b8144 | 158 | rm -f $outfile.boost.tar |
7c673cae FG |
159 | |
160 | echo "compressing..." | |
161 | bzip2 -9 $outfile.tar | |
162 | ||
163 | echo "done." |