forked from oVirt/vdsm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.am
207 lines (168 loc) · 4.45 KB
/
Makefile.am
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# SPDX-FileCopyrightText: Red Hat, Inc.
# SPDX-License-Identifier: GPL-2.0-or-later
TOX_MIN_VERSION = 3.15
# We don't want the standard gnu file setup (README, INSTALL, etc.)
AUTOMAKE_OPTIONS = foreign
SUBDIRS = \
contrib \
helpers \
init \
lib \
static \
vdsm_hooks \
$(NULL)
# The tests should be always last as they need the rest of the source to be
# prepared before running.
SUBDIRS += tests
VENV_DIR = $(HOME)/.venv/vdsm
VENV = $(VENV_DIR)/bin
RPM_TOPDIR = $(PWD)/build
include $(top_srcdir)/build-aux/Makefile.subs
# This is an *exception*, we ship also vdsm.spec so it's possible to build the
# rpm from the tarball.
EXTRA_DIST = \
.gitignore \
README.logging \
README.md \
autobuild.sh \
autogen.sh \
build-aux/pkg-version \
build-aux/vercmp \
contrib/logdb \
contrib/logstat \
contrib/lvs-stats \
contrib/profile-stats \
contrib/repoplot \
contrib/repostat \
pylintrc \
vdsm.spec \
vdsm.spec.in \
tox.ini \
$(NULL)
CLEANFILES = \
vdsm.spec \
$(DIST_ARCHIVES) \
$(NULL)
PYLINT_TARGETS = \
static/usr/bin/vdsm-tool \
static/libexec/vdsm/sitecustomize.py \
lib/vdsm \
lib/vdsmclient \
lib/yajsonrpc \
$(NULL)
.PHONY: gitignore
gitignore:
@echo "Checking that .in files are ignored..."
@if test -f .gitignore; then \
for i in `git ls-files \*.in`; do \
if ! grep -q -x $${i%%.in} .gitignore; then \
echo "Missing $${i%%.in} in .gitignore"; exit 1; fi; \
done; \
fi;
.PHONY: pylint
pylint: tox
tox -e pylint -- \
$(PYLINT_TARGETS)
execcmd:
! git --no-pager grep execCmd `git ls-files | grep -v -F -f execcmd-allowlist.txt`
.PHONY: pylint-diff
pylint-diff: tox
modules=`git diff-tree --no-commit-id --name-only -r HEAD | egrep '\.py$$'`; \
if [ -n "$$modules" ]; then tox -e pylint $$modules; fi
flake8: tox
tox -e flake8
.PHONY: reuse
reuse: tox
tox -e reuse
.PHONY: black
black: tox
tox -e black
.PHONY: tox
tox:
out=`tox --version`; \
if [ $$? -ne 0 ]; then \
echo "Error: cannot run tox, please install tox \
$(TOX_MIN_VERSION) or later"; \
exit 1; \
fi; \
version=`echo $$out | cut -d' ' -f1`; \
if build-aux/vercmp $$version $(TOX_MIN_VERSION); then \
echo "Error: tox is too old, please install tox \
$(TOX_MIN_VERSION) or later"; \
exit 1; \
fi
# Note: dependencies ordered by time needed to run them
check: lint tests
check-recursive:
@true
.PHONY: check-all
check-all:
$(MAKE) check NOSE_STRESS_TESTS=1 NOSE_SLOW_TESTS=1
.PHONY: check-unit
check-unit:
$(MAKE) -C tests/ check NOSE_EVAL_ATTR="type=='unit'"
.PHONY: lint
lint: gitignore reuse execcmd black flake8 pylint
.PHONY: venv
venv:
python3 -m venv $(VENV_DIR) && \
$(VENV)/python3 -m pip install --upgrade pip && \
$(VENV)/python3 -m pip install -r docker/requirements.txt
.PHONY: tests
tests: tox
tox -e "tests,lib,network,virt,gluster,hooks"
.PHONY: tests-storage-user
tests-storage-user: tox
tox -e "storage-user"
.PHONY: tests-storage-root
tests-storage-root: tox
tox -e "storage-root"
.PHONY: storage
storage:
userstorage create tests/storage/storage.py
.PHONY: clean-storage
clean-storage:
userstorage delete tests/storage/storage.py
all-local: \
vdsm.spec
clean-local: clean-build
.PHONY: upgrade
upgrade:
sudo dnf upgrade $(RPM_TOPDIR)/RPMS/*/*.rpm
.PHONY: srpm rpm clean-build
srpm: clean-build dist
rpmbuild -ts $(if $(BUILDID),--define="extra_release .$(BUILDID)") \
--define="_topdir $(RPM_TOPDIR)" \
$(DIST_ARCHIVES)
rpm: clean-build dist
rpmbuild -ta $(if $(BUILDID),--define="extra_release .$(BUILDID)") \
--define="_topdir $(RPM_TOPDIR)" \
--define="qemu_user $(QEMUUSER)" \
--define="qemu_group $(QEMUGROUP)" \
--define="with_ovirt_vmconsole $(OVIRT_VMCONSOLE)" \
--define="with_gluster_mgmt $(GLUSTER_MGMT)" \
--define="with_hooks $(HOOKS)" \
--define="with_vhostmd $(VHOSTMD)" \
--define="vdsm_version $(PACKAGE_VERSION)" \
--define="vdsm_release $(PACKAGE_RELEASE)" \
$(DIST_ARCHIVES)
clean-build:
rm -rf $(RPM_TOPDIR)
dist-hook: gen-VERSION gen-ChangeLog
.PHONY: gen-VERSION gen-ChangeLog
# Generate the ChangeLog file and insert it into the directory
# we're about to use to create a tarball.
gen-ChangeLog:
if test -d .git; then \
$(top_srcdir)/build-aux/gitlog-to-changelog \
> $(distdir)/cl-t; \
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
fi
gen-VERSION:
if test -d .git; then \
$(top_srcdir)/build-aux/pkg-version --full \
> $(distdir)/ve-t; \
rm -f $(distdir)/VERSION; \
mv $(distdir)/ve-t $(distdir)/VERSION; \
fi