-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
109 lines (91 loc) · 2.9 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
104
105
106
107
108
109
TWINE = python -m twine
GPG := $(shell which gpg)
TARGET := $(shell pwd)/dist
# BUILD_DEPS = oscrypto certvalidator asn1crypto ocspbuilder
.PHONY: default
default: all;
.PHONY: install
install:
python3 setup.py install
.PHONY: sdist
sdist:
python3 setup.py sdist
.PHONY: bdist
bdist:
python3 setup.py bdist --formats=gztar,bztar -u root -g root
.PHONY: wheel
wheel:
python3 setup.py bdist_wheel
.PHONY: rpm
rpm:
python3 setup.py bdist --formats=rpm -u root -g root
.PHONY: deb-src
deb-src:
python3 setup.py --command-packages=stdeb.command sdist_dsc \
--with-python3=True
.PHONY: deb
deb:
python3 setup.py --command-packages=stdeb.command sdist_dsc \
--with-python3=True bdist_deb
@echo "Moving binary packages from 'deb_dist' to 'dist'."
mkdir -p dist/
mv deb_dist/stapled*.deb dist/
#rm -rfv deb_dist
.PHONY: all
all: sdist bdist wheel rpm deb
# TODO: We need to fill in the variables here before we can upload to pypi.
#.PHONY: distribute
#distribute:
# gpg --detach-sign -a dist/package-1.0.1.tar.gz
# python -m twine upload dist/package-1.0.1.tar.gz package-1.0.1.tar.gz.asc
.PHONY: clean
clean:
make -f $(CURDIR)/debian/rules override_dh_auto_clean
rm -rf deb_dist dist *.egg-info .pybuild
rm -rf build_deps
.PHONY: docker-build
docker-build:
mkdir -p dist-docker/
docker build -t build-stapled .
docker run -it -d --name stapled --mount type=bind,source="$$(pwd)/dist-docker/",target=/_dist build-stapled
.PHONY: docker-compile
docker-compile:
docker start stapled
docker exec -it stapled rm -rfv "/_dist/*"
docker exec -it stapled make clean
docker exec -it stapled make
docker exec -it stapled bash -c 'mv dist/* /_dist/ || echo nothing to move.'
.PHONY: docker-install
docker-install:
docker start stapled
docker exec -it stapled bash -c 'apt-get install -y -q /_dist/stapled_*all.deb'
.PHONY: docker-run
docker-run:
docker start stapled
docker exec -it stapled bash -c 'which python3 && python3 --version'
docker exec -it stapled openssl version
docker exec -it stapled ./refresh_testdata.sh
docker exec -it stapled stapled -p /tmp/testdata/ --recursive --interactive --no-haproxy-sockets -vvvv
docker stop stapled
.PHONY: docker-stop
docker-stop:
docker stop stapled
.PHONY: docker-nuke
docker-nuke:
@bash -c 'CONTAINERS=$$(docker container ls --all --filter=name=stapled -q | xargs); \
if [ ! -z $$CONTAINERS ]; then \
echo "Stopping and deleting containers: $${CONTAINERS}"; \
docker stop $$CONTAINERS; \
docker container rm $$CONTAINERS; \
else \
echo "No matching containers found."; \
fi; \
IMAGES=$$(docker images | grep stapled | awk "{print $$1}"); \
if [ ! -z $$IMAGES ]; then \
echo "Deleting images: $${IMAGES}"; \
echo $$IMAGES | xargs docker rmi; \
else \
echo "No matching images found."; \
fi'
.PHONY: docker-all
docker-all: docker-nuke docker-build docker-compile docker-install docker-stop