-
Notifications
You must be signed in to change notification settings - Fork 216
/
Makefile
103 lines (84 loc) · 3 KB
/
Makefile
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
.PHONY: all detect install initsystem
prefix = /opt/Git-Auto-Deploy/
#init_version := $(shell /sbin/init --version 2>&1)
#test_upstart := $(shell printf $(init_version) | grep -q upstart || grep -q upstart /proc/net/unix ; echo $$?)
#test_systemd := $(shell printf $(init_version) | grep -q systemd || grep -q systemd /proc/1/comm || grep -q systemd /proc/net/unix ; echo $$?)
PYTHON ?= python2
# Debian distos to create packages for
DISTROS= \
cosmic \
bionic \
artful \
xenial \
trusty \
precise
# Package name and version
PACKAGE_NAME=$(shell python setup.py --name)
PACKAGE_VERSION=$(shell python setup.py --version)
define version =
echo "hello"
exit 1
endef
all:
clean: clean-pypi clean-deb
rm -rf *.tar.gz
clean-pypi:
rm -rf *.egg-info
rm -rf dist/pypi
if [ -d "dist" ]; then rmdir --ignore-fail-on-non-empty dist; fi
pypi:
$(PYTHON) setup.py sdist --dist-dir dist/pypi
upload-pypi:
$(PYTHON) setup.py sdist --dist-dir dist/pypi register upload -r pypi
clean-deb:
rm -rf dist/deb
rm -f dist/*.tar.gz
if [ -d "dist" ]; then rmdir --ignore-fail-on-non-empty dist; fi
# Usage: make deb-source [DIST=<debian dist>]
deb-source: clean-deb
@- $(foreach DIST,$(DISTROS), \
echo "Creating deb source package for dist $(DIST)" ; \
echo "Make a debian source package using stdeb" ; \
python setup.py --command-packages=stdeb.command sdist_dsc -x platforms/debian/stdeb.cfg --dist-dir dist/deb --debian-version $(DIST) --suite $(DIST) --upstream-version-suffix "~$(DIST)" ; \
echo "Copy debian package config files" ; \
cp -vr platforms/debian/stdeb/* dist/deb/$(PACKAGE_NAME)-$(PACKAGE_VERSION)~$(DIST)/debian/ ; \
)
deb: clean-deb deb-source
@- $(foreach DIST,$(DISTROS), \
echo "Creating unsigned deb package for dist $(DIST)" ; \
echo "Build .deb package (without signing)" ; \
cd dist/deb/$(PACKAGE_NAME)-$(PACKAGE_VERSION)~$(DIST) ; \
dpkg-buildpackage -rfakeroot -uc -us ; \
cd ../../../ ; \
)
signed-deb: clean-deb deb-source
@- $(foreach DIST,$(DISTROS), \
echo "Creating signed deb package for dist $(DIST)" ; \
echo "Build .deb package (signed)" ; \
cd dist/deb/$(PACKAGE_NAME)-$(PACKAGE_VERSION)~$(DIST) ; \
debuild -S -sa ; \
cd ../../../ ; \
)
upload-deb: clean-deb signed-deb
@- $(foreach DIST,$(DISTROS), \
echo "Upload signed debian package to ppa for dist $(DIST)" ; \
dput ppa:olipo186/$(PACKAGE_NAME) dist/deb/$(PACKAGE_NAME)_$(PACKAGE_VERSION)~$(DIST)-$(DIST)_source.changes ; \
)
#initsystem:
#ifeq ($(test_upstart),0)
# @echo "Upstart detected!"
#else ifeq ($(test_systemd),0)
# @echo "Systemd detected!"
#else
# @echo "InitV supposed"
#endif
# @echo "Init script not installed - not yet implemented"
#install: clean all
# @echo "Installing deploy script in $(prefix) ..."
# @echo "Installing deploy script in $(init_version) ..."
# @sudo mkdir $(prefix) &> /dev/null || true
# @sudo cp config.json.sample $(prefix)config.json
# @sudo cp -r gitautodeploy $(prefix)/
#
# @echo "Installing run-on-startup scripts according to your init system ..."
# @make initsystem