forked from StackStorm/st2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
93 lines (77 loc) · 2.68 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
# <<<< TO DEPRICATE
SHELL := /bin/bash
REPO_ROOT := ..
VIRTUALENV_DIR=virtualenv
RPM_ROOT=~/rpmbuild
RPM_SOURCES_DIR := $(RPM_ROOT)/SOURCES/
RPM_SPECS_DIR := $(RPM_ROOT)/SPECS/
COMPONENTS := st2debug
VER=0.4.0
FLAKE8_CONFIG := $(REPO_ROOT)/lint-configs/python/.flake8
.PHONY: clean
clean:
rm -rf *.egg-info
rm -rf build
find . -name \*.pyc -type f -delete
find . -name \*.pyo -type f -delete
.PHONY: flake8
flake8:
flake8 --config $(FLAKE8_CONFIG) $(COMPONENTS)
.PHONY: rpm
rpm:
pushd ~ && rpmdev-setuptree && popd
tar --transform=s~^~$(COMPONENTS)-$(VER)/~ -czf $(RPM_SOURCES_DIR)/$(COMPONENTS).tar.gz bin $(COMPONENTS)
cp packaging/rpm/$(COMPONENTS).spec $(RPM_SPECS_DIR)/
cd $(RPM_SPECS_DIR) && rpmbuild --clean --rmsource -ba $(COMPONENTS).spec
.PHONY: rhel-rpm
rhel-rpm:
pushd ~ && rpmdev-setuptree && popd
tar --transform=s~^~$(COMPONENTS)-$(VER)/~ -czf $(RPM_SOURCES_DIR)/$(COMPONENTS).tar.gz bin $(COMPONENTS)
cp packaging/rpm/$(COMPONENTS)-rhel6.spec $(RPM_SPECS_DIR)/
cd $(RPM_SPECS_DIR) && rpmbuild --clean --rmsource -ba $(COMPONENTS)-rhel6.spec
.PHONY: deb
deb:
mkdir -p ~/debbuild
tar --transform=s~^~$(COMPONENTS)-$(VER)/~ -czf ~/$(COMPONENTS).tar.gz bin $(COMPONENTS) packaging/debian
pushd ~ && tar -xzf $(COMPONENTS).tar.gz && cd $(COMPONENTS)-$(VER) && cp -Rf packaging/debian ./ && dpkg-buildpackage -us -uc -b && popd
cp -f ~/$(COMPONENT)*.deb ~/debbuild/
# >>>>
WHEELDIR ?= /tmp/wheelhouse
ST2_COMPONENT := $(notdir $(CURDIR))
ST2PKG_RELEASE ?= 1
ST2PKG_VERSION ?= $(shell python -c "from $(ST2_COMPONENT) import __version__; print __version__,")
ifneq (,$(wildcard /etc/debian_version))
DEBIAN := 1
DESTDIR ?= $(CURDIR)/debian/$(ST2_COMPONENT)
else
REDHAT := 1
endif
.PHONY: all install wheelhouse
all: install
install: wheelhouse injectdeps changelog
post_install: bdist_wheel
populate_version: .stamp-populate_version
.stamp-populate_version:
# populate version should be run before any pip/setup.py works
sh ../scripts/populate-version.sh
touch $@
requirements:
python ../scripts/fixate-requirements.py -s in-requirements.txt -f ../fixed-requirements.txt
changelog: populate_version
ifeq ($(DEBIAN),1)
debchange -v $(ST2PKG_VERSION)-$(ST2PKG_RELEASE) -M "automated build version: $(ST2PKG_VERSION)"
endif
wheelhouse: .stamp-wheelhouse
.stamp-wheelhouse: populate_version requirements
# Install wheels into shared location
pip wheel --wheel-dir=$(WHEELDIR) -r requirements.txt
touch $@
injectdeps: .stamp-injectdeps
.stamp-injectdeps:
# We can modify requirements ONLY AFTER wheelhouse has been built
@echo "st2common" >> requirements.txt
touch $@
bdist_wheel: .stamp-bdist_wheel
.stamp-bdist_wheel: populate_version
python setup.py bdist_wheel -d $(WHEELDIR)
touch $@