]> git.proxmox.com Git - ceph.git/blame - ceph/make-dist
import Ceph Pacific 16.2.4
[ceph.git] / ceph / make-dist
CommitLineData
9f95a23c 1#!/bin/bash -e
7c673cae
FG
2
3if [ ! -d .git ]; then
4 echo "no .git present. run this from the base dir of the git checkout."
5 exit 1
6fi
7
8version=$1
9f95a23c
TL
9[ -z "$version" ] && version=$(git describe --long --match 'v*' | sed 's/^v//')
10if 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/-/./')
13else
14 rpm_version=$version
15 rpm_release=0
16fi
7c673cae 17
9f95a23c 18outfile="ceph-$version"
7c673cae
FG
19echo "version $version"
20
21# update submodules
22echo "updating submodules..."
23force=$(if git submodule usage 2>&1 | grep --quiet 'update.*--force'; then echo --force ; fi)
24if ! 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
28fi
29
f67539c2
TL
30download_from() {
31 fname=$1
b32b8144 32 shift
f67539c2 33 sha256=$1
b32b8144 34 shift
b32b8144
FG
35 set +e
36 while true; do
37 url_base=$1
38 shift
39 if [ -z $url_base ]; then
f67539c2 40 echo "Error: failed to download $name."
b32b8144
FG
41 exit
42 fi
f67539c2
TL
43 url=$url_base/$fname
44 wget -c --no-verbose -O $fname $url
45 if [ $? != 0 -o ! -e $fname ]; then
b32b8144 46 echo "Download of $url failed"
f67539c2
TL
47 elif [ $(sha256sum $fname | awk '{print $1}') != $sha256 ]; then
48 echo "Error: failed to download $name: SHA256 mismatch."
b32b8144
FG
49 else
50 break
51 fi
52 done
53 set -e
f67539c2
TL
54}
55
56download_boost() {
57 boost_version=$1
58 shift
59 boost_sha256=$1
60 shift
61 boost_version_underscore=$(echo $boost_version | sed 's/\./_/g')
62 boost_fname=boost_${boost_version_underscore}.tar.bz2
63 download_from $boost_fname $boost_sha256 $*
b32b8144
FG
64 tar xjf $boost_fname -C src \
65 --exclude="$boost_version_underscore/libs/*/doc" \
66 --exclude="$boost_version_underscore/libs/*/example" \
67 --exclude="$boost_version_underscore/libs/*/examples" \
68 --exclude="$boost_version_underscore/libs/*/meta" \
69 --exclude="$boost_version_underscore/libs/*/test" \
70 --exclude="$boost_version_underscore/tools/boostbook" \
71 --exclude="$boost_version_underscore/tools/quickbook" \
72 --exclude="$boost_version_underscore/tools/auto_index" \
73 --exclude='doc' --exclude='more' --exclude='status'
74 mv src/boost_${boost_version_underscore} src/boost
75 tar cf ${outfile}.boost.tar ${outfile}/src/boost
76 rm -rf src/boost
77}
78
f67539c2
TL
79download_liburing() {
80 liburing_version=$1
81 shift
82 liburing_sha256=$1
83 shift
84 liburing_fname=liburing-${liburing_version}.tar.gz
85 download_from $liburing_fname $liburing_sha256 $*
86 tar xzf $liburing_fname -C src \
87 --exclude=debian \
88 --exclude=examples \
89 --exclude=man \
90 --exclude=test
91 # normalize the names, liburing-0.7 if downloaded from git.kernel.dk,
92 # liburing-liburing-0.7 from github.com
93 mv src/liburing-* src/liburing
94 tar cf ${outfile}.liburing.tar ${outfile}/src/liburing
95 rm -rf src/liburing
96}
97
11fdf7f2
TL
98build_dashboard_frontend() {
99 CURR_DIR=`pwd`
100 TEMP_DIR=`mktemp -d`
eafe8130 101
92f5a8d4 102 $CURR_DIR/src/tools/setup-virtualenv.sh $TEMP_DIR
11fdf7f2 103 $TEMP_DIR/bin/pip install nodeenv
f67539c2 104 $TEMP_DIR/bin/nodeenv --verbose -p --node=12.18.2
11fdf7f2 105 cd src/pybind/mgr/dashboard/frontend
eafe8130 106
11fdf7f2 107 . $TEMP_DIR/bin/activate
f67539c2
TL
108 NG_CLI_ANALYTICS=false timeout 1h npm ci
109 echo "Building ceph-dashboard frontend with build:localize script";
110 # we need to use "--" because so that "--prod" survives accross all
eafe8130 111 # scripts redirections inside package.json
f67539c2 112 npm run build:localize -- --prod
11fdf7f2
TL
113 deactivate
114 cd $CURR_DIR
115 rm -rf $TEMP_DIR
116 tar cf dashboard_frontend.tar $outfile/src/pybind/mgr/dashboard/frontend/dist
117}
118
9f95a23c
TL
119generate_rook_ceph_client() {
120 $outfile/src/pybind/mgr/rook/generate_rook_ceph_client.sh
121 tar cf rook_ceph_client.tar $outfile/src/pybind/mgr/rook/rook_client/*.py
122}
123
7c673cae
FG
124# clean out old cruft...
125echo "cleanup..."
126rm -f $outfile*
127
128# build new tarball
129echo "building tarball..."
130bin/git-archive-all.sh --prefix ceph-$version/ \
131 --verbose \
132 --ignore corpus \
133 $outfile.tar
134
135# populate files with version strings
136echo "including src/.git_version, ceph.spec"
137
9f95a23c 138(git rev-parse HEAD ; echo $version) 2> /dev/null > src/.git_version
7c673cae 139
f67539c2 140for spec in ceph.spec.in; do
7c673cae 141 cat $spec |
9f95a23c 142 sed "s/@PROJECT_VERSION@/$rpm_version/g" |
7c673cae
FG
143 sed "s/@RPM_RELEASE@/$rpm_release/g" |
144 sed "s/@TARBALL_BASENAME@/ceph-$version/g" > `echo $spec | sed 's/.in$//'`
145done
146ln -s . $outfile
f67539c2 147tar cvf $outfile.version.tar $outfile/src/.git_version $outfile/ceph.spec
b32b8144
FG
148# NOTE: If you change this version number make sure the package is available
149# at the three URLs referenced below (may involve uploading to download.ceph.com)
f67539c2
TL
150boost_version=1.73.0
151download_boost $boost_version 4eb3b8d442b426dc35346235c8733b5ae35ba431690e38c6a8263dce9fcbb402 \
b32b8144
FG
152 https://dl.bintray.com/boostorg/release/$boost_version/source \
153 https://downloads.sourceforge.net/project/boost/boost/$boost_version \
154 https://download.ceph.com/qa
f67539c2
TL
155download_liburing 0.7 8e2842cfe947f3a443af301bdd6d034455536c38a455c7a700d0c1ad165a7543 \
156 https://github.com/axboe/liburing/archive \
157 https://git.kernel.dk/cgit/liburing/snapshot
11fdf7f2 158build_dashboard_frontend
9f95a23c 159generate_rook_ceph_client
f67539c2
TL
160for tarball in $outfile.version \
161 $outfile.boost \
162 $outfile.liburing \
163 dashboard_frontend \
164 rook_ceph_client \
165 $outfile; do
166 tar --concatenate -f $outfile.all.tar $tarball.tar
167 rm $tarball.tar
168done
b32b8144 169mv $outfile.all.tar $outfile.tar
7c673cae 170rm $outfile
7c673cae
FG
171
172echo "compressing..."
173bzip2 -9 $outfile.tar
174
175echo "done."