forked from lago-project/lago
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
109 lines (92 loc) · 3.04 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
VERSION=$(shell scripts/version_manager.py . version)
NAME=lago
TAR_FILE=${NAME}-${VERSION}.tar
TARBALL_FILE=${TAR_FILE}.gz
SPECFILE=${NAME}.spec
# this is needed to use the libs from venv
PYTEST=$(shell which py.test)
FLAKE8=$(shell which flake8)
OUTPUT_DIR=${PWD}
RPM_DIR=${OUTPUT_DIR}/rpmbuild
DIST_DIR=${OUTPUT_DIR}/dist
TAR_DIST_LOCATION=${DIST_DIR}/${TAR_FILE}
TARBALL_DIST_LOCATION=${DIST_DIR}/${TARBALL_FILE}
.PHONY: build rpm srpm ${TARBALL_DIST_LOCATION} check-local dist check ${SPECFILE} docs fullchangelog changelog python-sdist add-extra-files-sdist
changelog:
echo Creating RPM compatible ChangeLog \
&& ( \
scripts/version_manager.py . changelog \
) > ChangeLog \
|| ( \
echo Failed to generate RPM ChangeLog >&2 \
&& exit 1 \
)
fullchangelog:
@if test -d ".git"; then \
echo Creating FullChangeLog \
&& ( \
echo '# Generated by Makefile. Do not edit.'; echo; \
git log --stat \
) > FullChangeLog \
|| ( \
echo Failed to generate FullChangeLog >&2 \
); \
else \
echo A git clone is required to generate a FullChangeLog >&2; \
fi
${SPECFILE}: ${SPECFILE}.in changelog
sed -e "s/@@VERSION@@/${VERSION}/g" \
${SPECFILE}.in > $@; \
cat ChangeLog >> $@
build:
LAGO_VERSION=${VERSION} python2 setup.py build
check: check-local
check-local:
@echo "-------------------------------------------------------------"
@echo "-------------------------------------------------------------"
@echo "-~ Running style checks --"
@echo "-------------------------------------------------------------"
scripts/check_style.sh
@echo "-------------------------------------------------------------"
@echo "-~ Running static checks --"
@echo "-------------------------------------------------------------"
PYTHONPATH=${PWD} python2 ${FLAKE8} --version
PYTHONPATH=${PWD} python2 ${FLAKE8}
@echo "-------------------------------------------------------------"
@echo "-~ Running unit tests --"
@echo "-------------------------------------------------------------"
PYTHONPATH=${PWD} python2 ${PYTEST} -v tests/unit
@echo "-------------------------------------------------------------"
@echo "-------------------------------------------------------------"
dist: ${TARBALL_DIST_LOCATION}
python-sdist:
LAGO_VERSION=${VERSION} python2 setup.py sdist --dist-dir ${DIST_DIR}
add-extra-files-sdist: changelog fullchangelog
gunzip ${TARBALL_DIST_LOCATION}
tar rvf ${TAR_DIST_LOCATION} \
FullChangeLog \
ChangeLog
gzip ${TAR_DIST_LOCATION}
${TARBALL_DIST_LOCATION}: python-sdist add-extra-files-sdist
srpm: dist ${SPECFILE}
rpmbuild \
--define "_topdir ${RPM_DIR}" \
--define "_sourcedir ${DIST_DIR}" \
-of \
${SPECFILE}
rpm: dist ${SPECFILE}
rpmbuild \
--define "_topdir ${RPM_DIR}" \
--define "_sourcedir ${DIST_DIR}" \
-ba \
${SPECFILE}
clean:
python2 setup.py clean
rm -rf ${DIST_DIR}
rm -rf ${RPM_DIR}
rm -rf build "$(REPO_LOCAL_REL_PATH)"
rm -f ${SPECFILE}
rm -f AUTHORS
docs:
$(MAKE) -C docs clean
$(MAKE) -C docs html