forked from osbuild/otk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (37 loc) · 1.01 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
.PHONY: lint
lint:
pre-commit run --all-files
pylint src/ test/*.py
.PHONY: type
type:
@mypy src/ test/
.PHONY: format
format:
@find src test -name '*.py' | xargs autopep8 --in-place
.PHONY: test
test: lint
@pytest
.PHONY: git-diff-check
git-diff-check:
@git diff --exit-code
@git diff --cached --exit-code
## Package building
COMMIT = $(shell (cd "$(SRCDIR)" && git rev-parse HEAD))
RPM_SPECFILE=rpmbuild/SPECS/otk-$(COMMIT).spec
RPM_TARBALL=rpmbuild/SOURCES/otk-$(COMMIT).tar.gz
$(RPM_SPECFILE):
mkdir -p $(CURDIR)/rpmbuild/SPECS
(echo "%global commit $(COMMIT)"; git show HEAD:otk.spec) > $(RPM_SPECFILE)
$(RPM_TARBALL):
mkdir -p $(CURDIR)/rpmbuild/SOURCES
git archive --prefix=otk-$(COMMIT)/ --format=tar.gz HEAD > $(RPM_TARBALL)
.PHONY: srpm
srpm: git-diff-check $(RPM_SPECFILE) $(RPM_TARBALL)
rpmbuild -bs \
--define "_topdir $(CURDIR)/rpmbuild" \
$(RPM_SPECFILE)
.PHONY: rpm
rpm: git-diff-check $(RPM_SPECFILE) $(RPM_TARBALL)
rpmbuild -bb \
--define "_topdir $(CURDIR)/rpmbuild" \
$(RPM_SPECFILE)