]>
git.proxmox.com Git - ceph.git/blob - ceph/src/script/cpatch
3 SCRIPT
=$
(readlink
-f "$0")
4 SCRIPTPATH
=$
(dirname "$SCRIPT")
7 if [ ! -e Makefile
] && [ ! -e build.ninja
] ||
[ ! -e ..
/do_cmake.sh
]; then
8 echo "must run from cmake build dir"
12 base
="quay.ceph.io/ceph-ci/ceph:master"
27 echo "usage: $SCRIPT [options]"
28 echo " --base <image> base container image [$base]"
29 echo " --target <image> target image (required)"
30 echo " --push push when done"
31 echo " --strip strip binaries"
32 echo " --root-build build image as root"
34 echo " --py python components (python-common, mgr)"
35 echo " --dashboard dashboard"
36 echo " --core mon, mgr, osd, mds, bins and libraries"
37 echo " --rgw radosgw, radosgw-admin"
85 echo "unrecognized option $1"
92 if [ -z "$target" ]; then
93 echo "must specify --target <image>"
97 if [ -x /usr
/bin
/podman
]; then
99 elif [ -x /usr
/bin
/docker
]; then
102 echo "cannot find podman or docker in PATH"
106 TMP
="$BUILDPATH/tmp.cpatch"
107 if [ -d $TMP ]; then rm -rf $TMP ; fi
110 if [ $all -eq 1 ]; then
111 echo "consider --py, --core, and/or --rgw for an abbreviated (faster) build."
114 dockerfile
="FROM $base"$
'\n'
116 if [ $py -eq 1 ] ||
[ $all -eq 1 ]; then
117 pushd ..
/src
/pybind
/mgr
> /dev
/null
118 find .
/ -name "*.pyc" -exec rm -f {} \
;
119 if [ $dashboard -eq 1 ] ||
[ $all -eq 1 ]; then
120 echo "py + dashboard"
124 # Exclude node_modules because it's the huge sources in
126 exclude
="--exclude=node_modules"
128 tar $exclude --exclude=tests
--exclude-backups -cf $TMP/mgr_plugins.
tar *
130 dockerfile
+=$
'ADD mgr_plugins.tar /usr/share/ceph/mgr\n'
132 pushd ..
/src
/python-common
> /dev
/null
133 find .
/ -name "*.pyc" -exec rm -f {} \
;
134 # Exclude node_modules because it's the huge sources in dashboard/frontend
135 tar --exclude=node_modules
--exclude=tests
--exclude-backups -cf $TMP/python_common.
tar *
137 dockerfile
+=$
'ADD python_common.tar /usr/lib/python3.8/site-packages\n'
139 pushd lib
/cython_modules
/lib
.3
140 CYTHONLIBS
="*.cpython-3*.so"
141 mkdir
-p $TMP/cythonlib
142 for f
in $CYTHONLIBS; do cp $f $TMP/cythonlib
; done
143 [ $strip -eq 1 ] && strip
$TMP/cythonlib
/*
145 dockerfile
+=$
'ADD cythonlib /usr/lib64/python3.8/site-packages\n'
148 pushd ..
/src
/cephadm
> /dev
/null
149 cp cephadm
$TMP/cephadm
150 dockerfile
+=$
'ADD cephadm /usr/sbin/cephadm\n'
154 if [ $core -eq 1 ] ||
[ $all -eq 1 ]; then
155 # binaries are annoying because the ceph version is embedded all over
156 # the place, so we have to include everything but the kitchen sink.
159 BINS
="ceph-mgr ceph-mon ceph-osd rados"
161 for f
in $BINS; do cp bin
/$f $TMP/bin
; done
162 [ $strip -eq 1 ] && strip
$TMP/bin
/*
163 dockerfile
+=$
'ADD bin /usr/bin\n'
165 # We need ceph-common to support the binaries
166 # We need librados/rbd to support mgr modules
167 # that import the python bindings
168 LIBS
="libceph-common.so.2 libceph-common.so librados.so.2 librados.so librados.so.2.0.0"
170 for f
in $LIBS; do cp lib
/$f $TMP/lib
; done
171 [ $strip -eq 1 ] && strip
$TMP/lib
/*
172 dockerfile
+=$
'ADD lib /usr/lib64\n'
176 for f
in lib
/$ECLIBS; do cp $f $TMP/eclib
; done
177 [ $strip -eq 1 ] && strip
$TMP/eclib
/*
178 dockerfile
+=$
'ADD eclib /usr/lib64/ceph/erasure-code\n'
180 CLSLIBS
="libcls_*.so*"
182 for f
in lib
/$CLSLIBS; do cp $f $TMP/clslib
; done
183 [ $strip -eq 1 ] && strip
$TMP/clslib
/*
184 dockerfile
+=$
'ADD clslib /usr/lib64/rados-classes\n'
186 # by default locally built binaries assume /usr/local
187 dockerfile
+=$
'RUN rm -rf /usr/local/lib64 ; ln -s /usr/lib64 /usr/local ; ln -s /usr/share/ceph /usr/local/share\n'
190 if [ $rgw -eq 1 ] ||
[ $all -eq 1 ]; then
192 RGW
="radosgw radosgw-admin"
194 for f
in $RGW; do cp bin
/$f $TMP/rgw
; done
195 [ $strip -eq 1 ] && strip
$TMP/rgw
/*
196 dockerfile
+=$
'ADD rgw /usr/bin\n'
198 RGWLIBS
="libradosgw.so*"
200 for f
in lib
/$RGWLIBS; do cp $f $TMP/rgwlib
; done
201 [ $strip -eq 1 ] && strip
$TMP/rgwlib
/*
202 dockerfile
+=$
'ADD rgwlib /usr/lib64\n'
205 if [ $cephfs -eq 1 ] ||
[ $all -eq 1 ]; then
209 for f
in $FS; do cp bin
/$f $TMP/fs
; done
210 [ $strip -eq 1 ] && strip
$TMP/fs
/*
211 dockerfile
+=$
'ADD fs /usr/bin\n'
213 FSLIBS
="libcephfs.so*"
215 for f
in lib
/$FSLIBS; do cp $f $TMP/fslib
; done
216 [ $strip -eq 1 ] && strip
$TMP/fslib
/*
217 dockerfile
+=$
'ADD fslib /usr/lib64\n'
220 if [ $rbd -eq 1 ] ||
[ $all -eq 1 ]; then
224 for f
in $RBD; do cp bin
/$f $TMP/rbd
; done
225 [ $strip -eq 1 ] && strip
$TMP/rbd
/*
226 dockerfile
+=$
'ADD rbd /usr/bin\n'
230 for f
in lib
/$RBDLIBS; do cp $f $TMP/rbdlib
; done
231 [ $strip -eq 1 ] && strip
$TMP/rbdlib
/*
232 dockerfile
+=$
'ADD rbdlib /usr/lib64\n'
236 pushd $TMP > /dev
/null
237 echo "$dockerfile" > Dockerfile
238 $asroot $runtime build
-t $target .
241 if [ $push -eq 1 ]; then
243 $asroot $runtime push
$target