1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
VER = $(shell dpkg-parsechangelog -Sversion | sed -r 's/([0-9]+\.[0-9]+)(\..*)/\1/')
VCS_VER = $(shell git describe --abbrev=0 --match="v*" 2>/dev/null | sed -r 's/v([0-9]+\.[0-9]+)(\..*)/\1/')
GNT_USERGROUP_PREFIX="gnt-"
PYTHON := /usr/bin/python
export PYTHON
%:
dh $@ --with python2,sphinxdoc,bash_completion,autoreconf
check-vcs-version:
ifeq ($(VCS_VER),)
$(error Empty VCS version, the target must be run within the packaging git repository)
endif
debian/control: debian/control.in check-vcs-version
sed -s 's/
genfiles: check-vcs-version
for file in debian/templates/*-VER*; do \
fname="$$(echo $$file | sed -e 's#VER#$(VCS_VER)#' -e 's#templates/##')"; \
sed -e 's/@version@/$(VCS_VER)/g' $$file >"$$fname"; \
done
for package in ganeti-haskell-$(VCS_VER) ganeti-htools-$(VCS_VER) ganeti-$(VCS_VER); do \
for file in debian/templates/versioned.*; do \
kind="$$(echo $$file | sed -r 's#.*\.(.*)#\1#')"; \
sed -e "s/@package@/$$package/g" \
-e 's/@version@/$(VCS_VER)/g' \
"$$file" > "debian/$${package}.$${kind}"; \
done; \
done
override_dh_autoreconf:
dh_autoreconf $(CURDIR)/autogen.sh
override_dh_auto_configure:
dpkg-parsechangelog -Sversion > vcs-version
./configure \
--prefix=/usr \
--localstatedir=/var \
--sysconfdir=/etc \
--with-export-dir=/var/lib/ganeti/export \
--with-iallocator-search-path=/usr/local/lib/ganeti/iallocators,/usr/lib/ganeti/iallocators \
--with-os-search-path=/srv/ganeti/os,/usr/local/lib/ganeti/os,/usr/lib/ganeti/os,/usr/share/ganeti/os \
--with-extstorage-search-path=/srv/ganeti/extstorage,/usr/local/lib/ganeti/extstorage,/usr/lib/ganeti/extstorage,/usr/share/ganeti/extstorage \
--docdir=/usr/share/doc/ganeti \
--enable-restricted-commands \
--disable-symlinks \
--with-haskell-flags="-optl -Wl,-z,relro -optl -Wl,--as-needed" \
--with-user-prefix=$(GNT_USERGROUP_PREFIX) \
--with-group-prefix=$(GNT_USERGROUP_PREFIX) \
--with-ssh-initscript="/usr/sbin/invoke-rc.d ssh" \
--with-backup-dir="/var/backups"
override_dh_auto_clean:
[ ! -f Makefile ] || $(MAKE) distclean
rm -f ganeti
rm -f debian/ganeti.init
rm -f debian/ganeti.cron.d
rm -f debian/ganeti.default
rm -f debian/ganeti.postinst
rm -f debian/ganeti.postrm
rm -f vcs-version
dh_auto_clean
override_dh_auto_build:
dh_auto_build
$(CURDIR)/debian/genscript.py postinst "$(CURDIR)" | \
sed -f "$(CURDIR)/autotools/replace_vars.sed" \
-e "s#@VER@#$(VER)#g" >"$(CURDIR)/debian/ganeti.postinst"
$(CURDIR)/debian/genscript.py postrm "$(CURDIR)" >"$(CURDIR)/debian/ganeti.postrm"
override_dh_install-indep:
dh_install --fail-missing -pganeti-$(VER) -Xsbin/ganeti-confd -Xganeti/mon-collector \
-Xganeti/default -Xbin/h -Xman1/h -Xsbin/ganeti-mond -Xsbin/ganeti-luxid -Xhail
dh_install --fail-missing -i -Nganeti-$(VER) -Xganeti/$(VER)
cp $(CURDIR)/doc/examples/ganeti.initd $(CURDIR)/debian/ganeti.init
cp $(CURDIR)/doc/examples/ganeti.cron $(CURDIR)/debian/ganeti.cron.d
sed -e 's/^RAPI_ARGS=.*/RAPI_ARGS="-b 127.0.0.1 --require-authentication"/' \
$(CURDIR)/doc/examples/ganeti.default > $(CURDIR)/debian/ganeti.default
cp $(CURDIR)/debian/tmp/usr/share/ganeti/$(VER)/ganeti/rapi/client.py \
$(CURDIR)/debian/python-ganeti-rapi/usr/share/pyshared/ganeti/rapi/
touch $(CURDIR)/debian/python-ganeti-rapi/usr/share/pyshared/ganeti/__init__.py
touch $(CURDIR)/debian/python-ganeti-rapi/usr/share/pyshared/ganeti/rapi/__init__.py
ln -s ../share/ganeti/default/ganeti-masterd debian/ganeti/usr/sbin/ganeti-masterd
override_dh_python2:
dh_python2
dh_python2 -pganeti-$(VER) usr/share/ganeti/$(VER)
override_dh_installinit:
dh_installinit --error-handler=true --no-restart-on-upgrade -i -- defaults 20 80
override_dh_compress:
dh_compress
for package in ganeti-$(VER) ganeti-htools-$(VER); do \
(cd $(CURDIR)/debian/$$package && \
find usr/share/ganeti/$(VER)/root/usr/share/man -type f) | \
xargs dh_compress -p$$package; \
done
for file in $$(find $(CURDIR)/debian/ganeti/usr/share/man \
$(CURDIR)/debian/ganeti-htools/usr/share/man \
-type l); do \
target=$$(readlink "$$file"); \
rm "$$file"; \
ln -sf "$${target}.gz" "$${file}.gz"; \
done
override_dh_link:
for file in $$(find $(CURDIR)/debian/ganeti-htools/usr -type l); do \
target="$$(readlink "$$file" | sed -r -e 's#/usr/(lib|share)/ganeti/default/#/usr/\1/ganeti/$(VER)/#')"; \
ln -sf "$$target" "$$file"; \
done
dh_link
for script in $$(grep ^complete $(CURDIR)/debian/ganeti/usr/share/bash-completion/completions/ganeti \
| awk '/ +[a-z_-]+$$/ { print $$NF }') ; do \
dh_link -pganeti "usr/share/bash-completion/completions/ganeti" \
"usr/share/bash-completion/completions/$$script" ; \
done
override_dh_sphinxdoc-arch:
override_dh_auto_test:
.PHONY: override_dh_auto_configure override_dh_auto_clean override_dh_auto_build \
override_dh_installinit override_dh_install-indep override_dh_sphinxdoc-arch \
override_dh_auto_test override_dh_compress override_dh_python2 \
override_dh_link genfiles override_dh_autoreconf check-vcs-version
|