]> git.proxmox.com Git - ceph.git/blame - ceph/make-dist
bump version to 18.2.2-pve1
[ceph.git] / ceph / make-dist
CommitLineData
9f95a23c 1#!/bin/bash -e
7c673cae 2
b3b6e05e
TL
3SCRIPTNAME="$(basename "${0}")"
4BASEDIR="$(readlink -f "$(dirname "${0}")")"
5
7c673cae 6if [ ! -d .git ]; then
b3b6e05e
TL
7 echo "$SCRIPTNAME: Full path to the script: $BASEDIR/$SCRIPTNAME"
8 echo "$SCRIPTNAME: No .git present. Run this from the base dir of the git checkout."
9 exit 1
10fi
11
12# Running the script from a directory containing a colon anywhere in the path
13# will expose us to the dreaded "[BUG] npm run [command] failed if the directory
14# path contains colon" bug https://github.com/npm/cli/issues/633
15# (see https://tracker.ceph.com/issues/39556 for details)
16if [[ "$BASEDIR" == *:* ]] ; then
17 echo "$SCRIPTNAME: Full path to the script: $BASEDIR/$SCRIPTNAME"
18 echo "$SCRIPTNAME: The path to the script contains a colon. Their presence has been known to break the script."
7c673cae
FG
19 exit 1
20fi
21
22version=$1
9f95a23c
TL
23[ -z "$version" ] && version=$(git describe --long --match 'v*' | sed 's/^v//')
24if expr index $version '-' > /dev/null; then
25 rpm_version=$(echo $version | cut -d - -f 1-1)
26 rpm_release=$(echo $version | cut -d - -f 2- | sed 's/-/./')
27else
28 rpm_version=$version
29 rpm_release=0
30fi
7c673cae 31
9f95a23c 32outfile="ceph-$version"
7c673cae
FG
33echo "version $version"
34
35# update submodules
36echo "updating submodules..."
37force=$(if git submodule usage 2>&1 | grep --quiet 'update.*--force'; then echo --force ; fi)
38if ! git submodule sync || ! git submodule update $force --init --recursive; then
39 echo "Error: could not initialize submodule projects"
40 echo " Network connectivity might be required."
41 exit 1
42fi
43
f67539c2
TL
44download_from() {
45 fname=$1
b32b8144 46 shift
f67539c2 47 sha256=$1
b32b8144 48 shift
b32b8144
FG
49 set +e
50 while true; do
51 url_base=$1
52 shift
53 if [ -z $url_base ]; then
1e59de90 54 echo "Error: failed to download $fname."
b32b8144
FG
55 exit
56 fi
f67539c2
TL
57 url=$url_base/$fname
58 wget -c --no-verbose -O $fname $url
59 if [ $? != 0 -o ! -e $fname ]; then
b32b8144 60 echo "Download of $url failed"
f67539c2 61 elif [ $(sha256sum $fname | awk '{print $1}') != $sha256 ]; then
1e59de90 62 echo "Error: failed to download $fname: SHA256 mismatch."
b32b8144
FG
63 else
64 break
65 fi
66 done
67 set -e
f67539c2
TL
68}
69
70download_boost() {
71 boost_version=$1
72 shift
73 boost_sha256=$1
74 shift
75 boost_version_underscore=$(echo $boost_version | sed 's/\./_/g')
76 boost_fname=boost_${boost_version_underscore}.tar.bz2
77 download_from $boost_fname $boost_sha256 $*
b32b8144
FG
78 tar xjf $boost_fname -C src \
79 --exclude="$boost_version_underscore/libs/*/doc" \
80 --exclude="$boost_version_underscore/libs/*/example" \
81 --exclude="$boost_version_underscore/libs/*/examples" \
82 --exclude="$boost_version_underscore/libs/*/meta" \
83 --exclude="$boost_version_underscore/libs/*/test" \
84 --exclude="$boost_version_underscore/tools/boostbook" \
85 --exclude="$boost_version_underscore/tools/quickbook" \
86 --exclude="$boost_version_underscore/tools/auto_index" \
87 --exclude='doc' --exclude='more' --exclude='status'
88 mv src/boost_${boost_version_underscore} src/boost
89 tar cf ${outfile}.boost.tar ${outfile}/src/boost
90 rm -rf src/boost
91}
92
f67539c2
TL
93download_liburing() {
94 liburing_version=$1
95 shift
96 liburing_sha256=$1
97 shift
98 liburing_fname=liburing-${liburing_version}.tar.gz
99 download_from $liburing_fname $liburing_sha256 $*
100 tar xzf $liburing_fname -C src \
101 --exclude=debian \
102 --exclude=examples \
103 --exclude=man \
104 --exclude=test
105 # normalize the names, liburing-0.7 if downloaded from git.kernel.dk,
106 # liburing-liburing-0.7 from github.com
107 mv src/liburing-* src/liburing
108 tar cf ${outfile}.liburing.tar ${outfile}/src/liburing
109 rm -rf src/liburing
110}
111
a4b75251
TL
112download_pmdk() {
113 pmdk_version=$1
114 shift
115 pmdk_sha256=$1
116 shift
117 pmdk_fname=pmdk-${pmdk_version}.tar.gz
118 download_from $pmdk_fname $pmdk_sha256 $*
119 tar xzf $pmdk_fname -C src \
120 --exclude="pmdk-${pmdk_version}/doc" \
121 --exclude="pmdk-${pmdk_version}/src/test" \
122 --exclude="pmdk-${pmdk_version}/src/examples" \
123 --exclude="pmdk-${pmdk_version}/src/benchmarks"
124 mv src/pmdk-${pmdk_version} src/pmdk
125 tar cf ${outfile}.pmdk.tar ${outfile}/src/pmdk
126 rm -rf src/pmdk
127}
128
11fdf7f2
TL
129build_dashboard_frontend() {
130 CURR_DIR=`pwd`
131 TEMP_DIR=`mktemp -d`
eafe8130 132
92f5a8d4 133 $CURR_DIR/src/tools/setup-virtualenv.sh $TEMP_DIR
11fdf7f2 134 $TEMP_DIR/bin/pip install nodeenv
aee94f69 135 $TEMP_DIR/bin/nodeenv --verbose -p --node=18.17.0
11fdf7f2 136 cd src/pybind/mgr/dashboard/frontend
eafe8130 137
11fdf7f2 138 . $TEMP_DIR/bin/activate
f67539c2
TL
139 NG_CLI_ANALYTICS=false timeout 1h npm ci
140 echo "Building ceph-dashboard frontend with build:localize script";
1e59de90
TL
141 # we need to use "--" because so that "--configuration production"
142 # survives accross all scripts redirections inside package.json
143 npm run build:localize -- --configuration production
11fdf7f2
TL
144 deactivate
145 cd $CURR_DIR
146 rm -rf $TEMP_DIR
147 tar cf dashboard_frontend.tar $outfile/src/pybind/mgr/dashboard/frontend/dist
148}
149
9f95a23c
TL
150generate_rook_ceph_client() {
151 $outfile/src/pybind/mgr/rook/generate_rook_ceph_client.sh
152 tar cf rook_ceph_client.tar $outfile/src/pybind/mgr/rook/rook_client/*.py
153}
154
7c673cae
FG
155# clean out old cruft...
156echo "cleanup..."
157rm -f $outfile*
158
159# build new tarball
160echo "building tarball..."
161bin/git-archive-all.sh --prefix ceph-$version/ \
162 --verbose \
163 --ignore corpus \
164 $outfile.tar
165
166# populate files with version strings
167echo "including src/.git_version, ceph.spec"
168
9f95a23c 169(git rev-parse HEAD ; echo $version) 2> /dev/null > src/.git_version
7c673cae 170
39ae355f
TL
171if [ -r /etc/os-release ]; then
172 source /etc/os-release
173 case $ID in
174 opensuse*|suse|sles)
175 if [ "x$rpm_release" != "x0" ] ; then
176 rpm_release=$(echo $rpm_release | sed 's/.g/+g/')
177 rpm_version="${rpm_version}.${rpm_release}"
178 rpm_release="0"
179 fi
180 ;;
181 esac
182fi
183
f67539c2 184for spec in ceph.spec.in; do
7c673cae 185 cat $spec |
9f95a23c 186 sed "s/@PROJECT_VERSION@/$rpm_version/g" |
7c673cae
FG
187 sed "s/@RPM_RELEASE@/$rpm_release/g" |
188 sed "s/@TARBALL_BASENAME@/ceph-$version/g" > `echo $spec | sed 's/.in$//'`
189done
190ln -s . $outfile
f67539c2 191tar cvf $outfile.version.tar $outfile/src/.git_version $outfile/ceph.spec
b32b8144
FG
192# NOTE: If you change this version number make sure the package is available
193# at the three URLs referenced below (may involve uploading to download.ceph.com)
1e59de90
TL
194boost_version=1.79.0
195download_boost $boost_version 475d589d51a7f8b3ba2ba4eda022b170e562ca3b760ee922c146b6c65856ef39 \
522d829b 196 https://boostorg.jfrog.io/artifactory/main/release/$boost_version/source \
b32b8144 197 https://download.ceph.com/qa
f67539c2
TL
198download_liburing 0.7 8e2842cfe947f3a443af301bdd6d034455536c38a455c7a700d0c1ad165a7543 \
199 https://github.com/axboe/liburing/archive \
200 https://git.kernel.dk/cgit/liburing/snapshot
a4b75251
TL
201pmdk_version=1.10
202download_pmdk $pmdk_version 08dafcf94db5ac13fac9139c92225d9aa5f3724ea74beee4e6ca19a01a2eb20c \
203 https://github.com/pmem/pmdk/releases/download/$pmdk_version
11fdf7f2 204build_dashboard_frontend
9f95a23c 205generate_rook_ceph_client
f67539c2
TL
206for tarball in $outfile.version \
207 $outfile.boost \
208 $outfile.liburing \
a4b75251 209 $outfile.pmdk \
f67539c2
TL
210 dashboard_frontend \
211 rook_ceph_client \
212 $outfile; do
213 tar --concatenate -f $outfile.all.tar $tarball.tar
214 rm $tarball.tar
215done
b32b8144 216mv $outfile.all.tar $outfile.tar
7c673cae 217rm $outfile
7c673cae
FG
218
219echo "compressing..."
220bzip2 -9 $outfile.tar
221
222echo "done."