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
|
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
PYTHON := /usr/bin/python3
PYVERS := $(shell py3versions -vr)
PYTHON2 := /usr/bin/python2
PKGVERS := $(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2 | sed -r -e 's/-.*//' -e 's/~rc/rc/')
build-arch: build-stamp
build-indep: build-stamp
build: build-arch build-indep
build-stamp:
dh_testdir
touch $@
clean:
dh_testdir
dh_testroot
rm -f build-stamp
make clean
-find . -name '*.py[co]' | xargs rm -f
dh_clean
debconf-updatepo
install: build
dh_testdir
dh_testroot
dh_prep
dh_installdirs
# make sure the version is in sync with our changelog
sed -i "s/^ufw_version = .*/ufw_version = '$(PKGVERS)'/" ./setup.py
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
./run_tests.sh -i $(PYTHON2)
./run_tests.sh -i $(PYTHON)
# the testsuite creates the build/ directory with test values that we
# don't want to use
make clean
endif
$(PYTHON2) ./setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb
$(PYTHON) ./setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb
# these shouldn't be conffiles
mv $(CURDIR)/debian/tmp/etc/ufw/ufw.conf $(CURDIR)/debian/tmp/usr/share/ufw
mv $(CURDIR)/debian/tmp/etc/ufw/*.init $(CURDIR)/debian/tmp/usr/share/ufw
# these shouldn't be conffiles either, but we'll use the rules from
# /usr/share/ufw/iptables so just delete these and we'll use dh_link
# later
rm -f $(CURDIR)/debian/tmp/etc/ufw/*.rules
rm -f $(CURDIR)/debian/tmp/lib/ufw/*.rules
dh_link
# Rename and install the shell-completion file
cp $(CURDIR)/shell-completion/bash $(CURDIR)/debian/ufw/usr/share/bash-completion/completions/ufw
binary-arch: build
binary-indep: build install
dh_testdir
dh_testroot
dh_installchangelogs
dh_installchangelogs ChangeLog
dh_installdocs
dh_installdocs README
dh_installexamples doc/skel-ui.example
dh_install
dh_systemd_enable
dh_installinit --no-start --no-restart-on-upgrade
dh_systemd_start --no-start --no-restart-on-upgrade
dh_installlogrotate
dh_installman
dh_installdebconf
dh_lintian
: # Replace all '#!' calls to python with $(PYTHON)
: # and make them executable
for i in `find debian -mindepth 3 -type f`; do \
sed '1s,#!.*python[^ ]*\(.*\),#! $(PYTHON)\1,' \
$$i > $$i.temp; \
if cmp --quiet $$i $$i.temp; then \
rm -f $$i.temp; \
else \
mv -f $$i.temp $$i; \
chmod 755 $$i; \
echo "fixed interpreter: $$i"; \
fi; \
done
# Don't install profiles on Ubuntu
if dpkg-vendor --is ubuntu; then \
rm -f $(CURDIR)/debian/ufw/etc/ufw/applications.d/ufw-* ; \
fi
dh_python2 -p python-ufw
dh_python3 -p ufw
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary install
|