-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
85 lines (63 loc) · 1.97 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
PYTHON ?= python
ifeq ($(origin VIRTUAL_ENV), undefined)
DIST_PYTHON ?= poetry run $(PYTHON)
else
DIST_PYTHON ?= $(PYTHON)
endif
NAME = receptor
IMAGE_NAME ?= $(NAME)
PIP_NAME = receptor
VERSION := $(shell $(DIST_PYTHON) setup.py --version)
ifeq ($(OFFICIAL),yes)
RELEASE ?= 1
else
ifeq ($(origin RELEASE), undefined)
RELEASE := 0.git_$(shell git rev-parse --short HEAD)
endif
endif
DIST ?= el7
ARCH ?= x86_64
NVR_RELEASE = $(RELEASE).$(DIST)
EPEL_DIST = $(subst el,epel-,$(DIST))
NVR = $(NAME)-$(VERSION)-$(NVR_RELEASE)
RESULTDIR = rpm-build/results-$(DIST)-$(ARCH)
.PHONY: clean version release dist sdist image dev shell test \
mock-rpm mock-srpm image docs
clean:
rm -rf dist
rm -rf receptor.egg-info
rm -rf rpm-build
version:
@echo $(VERSION)
release:
@echo $(RELEASE)
dist:
$(DIST_PYTHON) setup.py bdist_wheel --universal
sdist: dist/$(NAME)-$(VERSION).tar.gz
dist/$(NAME)-$(VERSION).tar.gz: $(shell find receptor -type f -name '*.py')
$(DIST_PYTHON) setup.py sdist
image: dist
docker build --rm=true -t $(IMAGE_NAME) -f ./packaging/docker/Dockerfile .
dev:
poetry install
shell:
poetry shell
test:
tox
docs:
cd docs && make html
dist/$(VERSION).tar.gz: dist/$(NAME)-$(VERSION).tar.gz
cp dist/$(NAME)-$(VERSION).tar.gz dist/$(VERSION).tar.gz
rpm-build/$(NVR).spec: packaging/rpm/$(NAME).spec.j2
mkdir -p rpm-build
ansible -i localhost, -c local all -m template \
-a "src=packaging/rpm/$(NAME).spec.j2 dest=rpm-build/$(NVR).spec" \
-e version=$(VERSION) \
-e release=$(NVR_RELEASE)
$(RESULTDIR)/$(NVR).src.rpm: dist/$(VERSION).tar.gz rpm-build/$(NVR).spec
mock --buildsrpm --no-clean -r $(EPEL_DIST)-$(ARCH) --spec rpm-build/$(NVR).spec --sources dist/$(VERSION).tar.gz --resultdir $(RESULTDIR)
$(RESULTDIR)/$(NVR).rpm: $(RESULTDIR)/$(NVR).src.rpm
mock --rebuild --no-clean -r $(EPEL_DIST)-$(ARCH) $(RESULTDIR)/$(NVR).src.rpm --resultdir $(RESULTDIR)
@touch $@
mock-srpm: $(RESULTDIR)/$(NVR).src.rpm
mock-rpm: $(RESULTDIR)/$(NVR).rpm