forked from storaged-project/libblockdev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.am
199 lines (152 loc) · 5.76 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
SHELL = /bin/bash
.SHELLFLAGS = -o pipefail -c
ACLOCAL_AMFLAGS = -I m4
DISTCHECK_CONFIGURE_FLAGS = --enable-introspection
if !WITH_BTRFS
DISTCHECK_CONFIGURE_FLAGS += --without-btrfs
endif
if !WITH_CRYPTO
DISTCHECK_CONFIGURE_FLAGS += --without-crypto
endif
if !WITH_DM
DISTCHECK_CONFIGURE_FLAGS += --without-dm
endif
if !WITH_LOOP
DISTCHECK_CONFIGURE_FLAGS += --without-loop
endif
if !WITH_LVM
DISTCHECK_CONFIGURE_FLAGS += --without-lvm
endif
if !WITH_LVM_DBUS
DISTCHECK_CONFIGURE_FLAGS += --without-lvm-dbus
endif
if !WITH_MDRAID
DISTCHECK_CONFIGURE_FLAGS += --without-mdraid
endif
if !WITH_MPATH
DISTCHECK_CONFIGURE_FLAGS += --without-mpath
endif
if !WITH_NVDIMM
DISTCHECK_CONFIGURE_FLAGS += --without-nvdimm
endif
if !WITH_SWAP
DISTCHECK_CONFIGURE_FLAGS += --without-swap
endif
if !WITH_KBD
DISTCHECK_CONFIGURE_FLAGS += --without-kbd
endif
if !WITH_PART
DISTCHECK_CONFIGURE_FLAGS += --without-part
endif
if !WITH_S390
DISTCHECK_CONFIGURE_FLAGS += --without-s390
endif
SUBDIRS = include src dist scripts data
if WITH_GTK_DOC
SUBDIRS += docs
endif
dist_noinst_DATA = features.rst roadmap.rst specs.rst LICENSE tests
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.sub \
configure depcomp install-sh ltmain.sh missing py-compile compile ar-lib \
m4/*.m4
LIBDIRS = src/utils/.libs:src/plugins/.libs:src/plugins/fs/.libs:src/lib/.libs
GIDIR = src/lib
if WITH_PYTHON3
PYTHON = python3
PYLINT = python3-pylint
else
PYTHON = python
PYLINT = pylint
endif
TEST_PYTHON ?= $(PYTHON)
COVERAGE ?= coverage
TEST_SUITE_LOG ?= test-suite-$(TEST_PYTHON).log
PYLINT_LOG ?= pylint.log
PLUGINS = btrfs \
crypto \
dm \
fs \
kbd \
loop \
lvm \
mdraid \
mpath \
nvdimm \
part \
s390 \
swap
ALT_PLUGINS = lvm-dbus
LIBRARY_TESTS = library
UTILS_TESTS = utils
run-ipython: all
GI_TYPELIB_PATH=${GIDIR} LD_LIBRARY_PATH=${LIBDIRS} PYTHONPATH=src/python G_MESSAGES_DEBUG=all LIBBLOCKDEV_CONFIG_DIR=data/conf.d/ i${PYTHON}
run-root-ipython: all
sudo env GI_TYPELIB_PATH=${GIDIR} LD_LIBRARY_PATH=${LIBDIRS} PYTHONPATH=src/python G_MESSAGES_DEBUG=all LIBBLOCKDEV_CONFIG_DIR=data/conf.d/ i${PYTHON}
pylint:
which $(PYLINT) && $(PYLINT) -E src/python/gi/overrides/BlockDev.py || echo "pylint not available, skipping"
if TESTS_ENABLED
test: all pylint
sudo $(TEST_PYTHON) tests/run_tests.py
fast-test: all pylint
sudo $(TEST_PYTHON) tests/run_tests.py --fast
test-all: all pylint
sudo $(TEST_PYTHON) tests/run_tests.py --lucky
test-plugin-%: all
sudo $(TEST_PYTHON) tests/run_tests.py $*_test
fast-test-plugin-%: all
sudo $(TEST_PYTHON) tests/run_tests.py --fast $*_test
test-lvm-dbus: all
sudo $(TEST_PYTHON) tests/run_tests.py lvm_dbus_tests
fast-test-lvm-dbus: all
sudo $(TEST_PYTHON) tests/run_tests.py --fast lvm_dbus_tests
endif # TESTS_ENABLED
coverage: all
@rm -f $(TEST_SUITE_LOG)
@sudo env GI_TYPELIB_PATH=${GIDIR} LD_LIBRARY_PATH=${LIBDIRS} PYTHONPATH=.:tests/:src/python LIBBLOCKDEV_CONFIG_DIR=tests/default_config \
$(COVERAGE) run --branch -m unittest discover -v -s tests/ -p '*_test.py' 2>&1 | tee -a $(TEST_SUITE_LOG)
@sudo env GI_TYPELIB_PATH=${GIDIR} LD_LIBRARY_PATH=${LIBDIRS} PYTHONPATH=.:tests/:src/python LIBBLOCKDEV_CONFIG_DIR=tests/lvm_dbus_config \
$(COVERAGE) run --branch -m unittest discover -v -s tests/ -p 'lvm_dbus_tests.py' 2>&1 | tee -a $(TEST_SUITE_LOG)
$(COVERAGE) report --show-missing --include="src/*"
$(COVERAGE) report --include="src/*" > coverage-report.log
coverage-all: all
@sudo env FEELING_LUCKY= GI_TYPELIB_PATH=${GIDIR} LD_LIBRARY_PATH=${LIBDIRS} PYTHONPATH=.:tests/:src/python LIBBLOCKDEV_CONFIG_DIR=tests/default_config \
$(COVERAGE) run --branch -m unittest discover -v -s tests/ -p '*_test.py'
@sudo env GI_TYPELIB_PATH=${GIDIR} LD_LIBRARY_PATH=${LIBDIRS} PYTHONPATH=.:tests/:src/python LIBBLOCKDEV_CONFIG_DIR=tests/lvm_dbus_config \
$(COVERAGE) run --branch -m unittest discover -v -s tests/ -p 'lvm_dbus_tests.py'
$(COVERAGE) report --show-missing --include="src/*"
$(COVERAGE) report --include="src/*" > coverage-report.log
tag:
TAG="$(PACKAGE_VERSION)-1" ; \
git tag -a -s -m "Tag as $$TAG" -f "$$TAG" && \
echo "Tagged as $$TAG"
rpmlog:
@cl=`grep -n %changelog dist/libblockdev.spec.in |cut -d : -f 1 |head -1` ; \
version_release=`tail --lines=+$$(($$cl + 1)) dist/libblockdev.spec.in|head -1|cut -d- -f2-3|sed 's/ //g'` ; \
git log --no-merges --pretty="format:- %s (%ae)" "$$version_release.." |sed -e 's/@.*)/)/' ; \
echo
shortlog:
git shortlog -r --no-merges --format="- %s" -w76,0,2 $$(git tag -l --sort=taggerdate | tail -n 1)..HEAD | sed 's/"):$"/"):\n"/g'
bumpver:
@VERSION=`echo $(PACKAGE_VERSION)|sed -r 's/(.*)\.([0-9]+)/\1/'` ; \
SUBVERSION=`echo $(PACKAGE_VERSION)|sed -r 's/.*\.([0-9]+)/\1/'` ; \
NEWSUBVERSION=$$(($$SUBVERSION + 1)) ; \
DATELINE="* `date "+%a %b %d %Y"` `git config user.name` <`git config user.email`> - $$VERSION.$$NEWSUBVERSION-1" ; \
cl=`grep -n %changelog dist/libblockdev.spec.in |cut -d : -f 1 |head -1` ; \
tail --lines=+$$(($$cl + 1)) dist/libblockdev.spec.in > speclog ; \
(head -n $$cl dist/libblockdev.spec.in ; echo "$$DATELINE" ; make --quiet rpmlog 2>/dev/null ; echo ""; cat speclog) > dist/libblockdev.spec.in.new ; \
mv dist/libblockdev.spec.in.new dist/libblockdev.spec.in ; rm -f speclog ; \
sed -ri "s/(AC_INIT\(\[$(PACKAGE_NAME)\], \[)[0-9]+\.[0-9]+(\],.*)/\1$$VERSION.$$NEWSUBVERSION\2/" configure.ac ; \
sed -ri "s/Version:(\\s+)[-0-9.]+/Version:\\1$$VERSION.$$NEWSUBVERSION/" dist/libblockdev.spec.in ;
archive: distcheck
local: dist
srpm: local
rpmbuild -ts --nodeps $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
rm -f $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
rpm: local
rpmbuild -tb --nodeps $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
rm -f $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
release: tag
$(MAKE) archive
ci: all distcheck
$(MAKE) pylint > $(PYLINT_LOG)
$(MAKE) --quiet test