Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / debian / rules
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3 export DH_VERBOSE=1
4 export DESTDIR=$(CURDIR)/debian/tmp
5
6 export DEB_HOST_ARCH      ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
7
8 extraopts += -DUSE_CRYPTOPP=OFF -DWITH_OCF=ON -DWITH_LTTNG=ON -DWITH_PYTHON3=ON -DWITH_EMBEDDED=OFF
9 extraopts += -DWITH_CEPHFS_JAVA=ON
10 # assumes that ceph is exmpt from multiarch support, so we override the libdir.
11 extraopts += -DCMAKE_INSTALL_LIBDIR=/usr/lib
12 extraopts += -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib
13 extraopts += -DCMAKE_INSTALL_SYSCONFDIR=/etc
14 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
15   NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
16   extraopts += -DBOOST_J=$(NUMJOBS)
17 endif
18
19 ifeq ($(DEB_HOST_ARCH), armel)
20   # armel supports ARMv4t or above instructions sets.
21   # libatomic-ops is only usable with Ceph for ARMv6 or above.
22   extraopts += -DWITH_ATOMIC_OPS=OFF
23 endif
24
25 ifneq (,$(filter $(DEB_HOST_ARCH), arm armel armhf arm64 i386 amd64 mips mipsel powerpc ppc64))
26   # beast depends on libboost_context which only support the archs above
27   extraopts += -DWITH_RADOSGW_BEAST_FRONTEND=ON
28 else
29   extraopts += -DWITH_RADOSGW_BEAST_FRONTEND=OFF
30 endif
31
32 %:
33         dh $@ --buildsystem=cmake --with javahelper,python2,python3,systemd --parallel
34
35 override_dh_auto_configure:
36         env | sort
37         dh_auto_configure --buildsystem=cmake -- $(extraopts) $(CEPH_EXTRA_CMAKE_ARGS)
38
39 override_dh_auto_build:
40         dh_auto_build --buildsystem=cmake
41         cp src/init-radosgw debian/radosgw.init
42
43 override_dh_auto_clean:
44         dh_auto_clean --buildsystem=cmake
45         rm -f debian/radosgw.init debian/ceph.logrotate
46
47 override_dh_auto_install:
48         dh_auto_install --buildsystem=cmake --destdir=$(DESTDIR)
49         install -D -m 644 udev/50-rbd.rules $(DESTDIR)/lib/udev/rules.d/50-rbd.rules
50         install -D -m 644 udev/95-ceph-osd.rules $(DESTDIR)/lib/udev/rules.d/95-ceph-osd.rules
51         install -D -m 644 udev/60-ceph-by-parttypeuuid.rules $(DESTDIR)/lib/udev/rules.d/60-ceph-by-parttypeuuid.rules
52         install -D -m 644 src/etc-rbdmap $(DESTDIR)/etc/ceph/rbdmap
53         install -D -m 644 src/90-ceph-osd.conf $(DESTDIR)/etc/sysctl.d/30-ceph-osd.conf
54
55 # doc/changelog is a directory, which confuses dh_installchangelogs
56 override_dh_installchangelogs:
57         dh_installchangelogs --exclude doc/changelog
58
59 override_dh_installdocs:
60         dh_installdocs -a --all ChangeLog
61
62 override_dh_installlogrotate:
63         cp src/logrotate.conf debian/ceph-common.logrotate
64         dh_installlogrotate -pceph-common
65
66 override_dh_installinit:
67         # dh_installinit is only set up to handle one upstart script
68         # per package, so do this ourselves
69         install -d -m0755 debian/ceph-base/etc/init
70         install -m0644 src/upstart/ceph-all.conf debian/ceph-base/etc/init
71         install -d -m0755 debian/ceph-osd/etc/init
72         install -m0644 src/upstart/ceph-osd*.conf debian/ceph-osd/etc/init
73         install -m0644 src/upstart/ceph-disk.conf debian/ceph-osd/etc/init
74         install -d -m0755 debian/ceph-mon/etc/init
75         install -m0644 src/upstart/ceph-mon*.conf debian/ceph-mon/etc/init
76         install -d -m0755 debian/ceph-common/etc/init
77         install -m0644 src/upstart/rbdmap.conf debian/ceph-common/etc/init
78         install -d -m0755 debian/ceph-mds/etc/init
79         install -m0644 src/upstart/ceph-mds*.conf debian/ceph-mds/etc/init
80         install -d -m0755 debian/ceph-mgr/etc/init
81         install -m0644 src/upstart/ceph-mgr*.conf debian/ceph-mgr/etc/init
82         install -d -m0755 debian/radosgw/etc/init
83         install -m0644 src/upstart/radosgw*.conf debian/radosgw/etc/init
84         install -d -m0755 debian/rbd-mirror/etc/init
85         install -m0644 src/upstart/ceph-rbd-mirror*.conf debian/rbd-mirror/etc/init
86         # install the systemd stuff manually since we have funny service names
87         install -d -m0755 debian/ceph-common/lib/systemd/system
88         install -m0644 systemd/ceph.target debian/ceph-common/lib/systemd/system
89         install -d -m0755 debian/ceph-common/etc/default
90         install -m0644 etc/default/ceph debian/ceph-common/etc/default/
91         install -d -m0755 debian/ceph-common/usr/lib/tmpfiles.d
92         install -m 0644 -D systemd/ceph.tmpfiles.d debian/ceph-common/usr/lib/tmpfiles.d/ceph.conf
93
94         install -d -m0755 debian/ceph-base/lib/systemd/system
95         install -d -m0755 debian/ceph-mon/lib/systemd/system
96         install -d -m0755 debian/ceph-osd/lib/systemd/system
97         install -m0644 systemd/ceph-mon@.service debian/ceph-mon/lib/systemd/system
98         install -m0644 systemd/ceph-osd@.service debian/ceph-osd/lib/systemd/system
99         install -m0644 systemd/ceph-disk@.service debian/ceph-osd/lib/systemd/system
100         install -m0644 systemd/ceph-volume@.service debian/ceph-osd/lib/systemd/system
101         install -m0644 systemd/rbdmap.service debian/ceph-common/lib/systemd/system
102         sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-mon/lib/systemd/system/ceph-mon@.service
103         sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-osd/lib/systemd/system/ceph-osd@.service
104         sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-osd/lib/systemd/system/ceph-disk@.service
105         sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-osd/lib/systemd/system/ceph-volume@.service
106         install -m0644 systemd/ceph-mon.target debian/ceph-mon/lib/systemd/system
107         install -m0644 systemd/ceph-osd.target debian/ceph-osd/lib/systemd/system
108
109         install -d -m0755 debian/ceph-mds/lib/systemd/system
110         install -m0644 systemd/ceph-mds@.service debian/ceph-mds/lib/systemd/system
111         sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-mds/lib/systemd/system/ceph-mds@.service
112         install -m0644 systemd/ceph-mds.target debian/ceph-mds/lib/systemd/system
113
114         install -d -m0755 debian/ceph-fuse/lib/systemd/system
115         install -m0644 systemd/ceph-fuse@.service debian/ceph-fuse/lib/systemd/system
116         sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-fuse/lib/systemd/system/ceph-fuse@.service
117         install -m0644 systemd/ceph-fuse.target debian/ceph-fuse/lib/systemd/system
118
119         install -d -m0755 debian/ceph-mgr/lib/systemd/system
120         install -m0644 systemd/ceph-mgr@.service debian/ceph-mgr/lib/systemd/system
121         sed -i s./etc/sysconfig/./etc/default/.g debian/ceph-mgr/lib/systemd/system/ceph-mgr@.service
122         install -m0644 systemd/ceph-mgr.target debian/ceph-mgr/lib/systemd/system
123
124         install -d -m0755 debian/radosgw/lib/systemd/system
125         install -m0644 systemd/ceph-radosgw@.service debian/radosgw/lib/systemd/system
126         sed -i s./etc/sysconfig/./etc/default/.g debian/radosgw/lib/systemd/system/ceph-radosgw@.service
127         install -m0644 systemd/ceph-radosgw.target debian/radosgw/lib/systemd/system
128
129         install -d -m0755 debian/rbd-mirror/lib/systemd/system
130         install -m0644 systemd/ceph-rbd-mirror@.service debian/rbd-mirror/lib/systemd/system
131         sed -i s./etc/sysconfig/./etc/default/.g debian/rbd-mirror/lib/systemd/system/ceph-rbd-mirror@.service
132         install -m0644 systemd/ceph-rbd-mirror.target debian/rbd-mirror/lib/systemd/system
133
134         dh_installinit -p ceph-base --name ceph --no-start
135         dh_installinit -p radosgw --no-start
136
137         # NOTE: execute systemd helpers so they pickup dh_install'ed units and targets
138         dh_systemd_enable
139         dh_systemd_start --no-restart-on-upgrade
140
141 override_dh_systemd_enable:
142         # systemd enable done as part of dh_installinit
143
144 override_dh_systemd_start:
145         # systemd start done as part of dh_installinit
146
147 override_dh_strip:
148         dh_strip -pceph-mds --dbg-package=ceph-mds-dbg
149         dh_strip -pceph-fuse --dbg-package=ceph-fuse-dbg
150         dh_strip -pceph-mgr --dbg-package=ceph-mgr-dbg
151         dh_strip -pceph-mon --dbg-package=ceph-mon-dbg
152         dh_strip -pceph-osd --dbg-package=ceph-osd-dbg
153         dh_strip -pceph-fuse --dbg-package=ceph-fuse-dbg
154         dh_strip -prbd-fuse --dbg-package=rbd-fuse-dbg
155         dh_strip -prbd-mirror --dbg-package=rbd-mirror-dbg
156         dh_strip -prbd-nbd --dbg-package=rbd-nbd-dbg
157         dh_strip -pceph-common --dbg-package=ceph-common-dbg
158         dh_strip -plibrados2 --dbg-package=librados2-dbg
159         dh_strip -plibradosstriper1 --dbg-package=libradosstriper1-dbg
160         dh_strip -plibrbd1 --dbg-package=librbd1-dbg
161         dh_strip -plibcephfs2 --dbg-package=libcephfs2-dbg
162         dh_strip -plibrgw2 --dbg-package=librgw2-dbg
163         dh_strip -pradosgw --dbg-package=radosgw-dbg
164         dh_strip -pceph-test --dbg-package=ceph-test-dbg
165
166 override_dh_shlibdeps:
167         dh_shlibdeps -a --exclude=erasure-code --exclude=rados-classes --exclude=compressor
168
169 override_dh_python2:
170         for binding in rados cephfs rbd rgw; do \
171           dh_python2 -p python-$$binding;       \
172         done
173         dh_python2 -p ceph-common
174         dh_python2 -p ceph-base
175         dh_python2 -p ceph-osd
176         dh_python2 -p ceph-mgr
177
178 override_dh_python3:
179         for binding in rados cephfs rbd rgw; do \
180           dh_python3 -p python3-$$binding;      \
181         done
182         dh_python3 -p python3-ceph-argparse
183
184 # do not run tests
185 override_dh_auto_test:
186
187 .PHONY: override_dh_autoreconf override_dh_auto_configure override_dh_auto_build override_dh_auto_clean override_dh_auto_install override_dh_installdocs override_dh_installlogrotate override_dh_installinit override_dh_systemd_start override_dh_strip override_dh_auto_test