-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (29 loc) · 1.35 KB
/
Copy pathMakefile
File metadata and controls
36 lines (29 loc) · 1.35 KB
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
current_dir:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
version:=$(shell git describe --tags --abbrev=0 2>/dev/null || grep -m 1 'version = ' pyproject.toml | sed 's/.*version = "//' | sed 's/".*//')
name:=python-fact_inventory
_default:
@echo "Perhaps you want:"
@echo "make sources - Create source tarball for koji"
@echo "make srpm - Build source RPM locally"
@echo "make rpm - Build binary RPM locally"
@echo "make lint-ansible"
@echo "make test-ansible-role"
sources:
@echo "Creating source tarball for koji"
@tmpdir=$$(mktemp -d); \
set -e; \
git archive --format=tar --prefix=$(name)-$(version)/ HEAD > "$$tmpdir/src.tar"; \
gzip --best -c "$$tmpdir/src.tar" > "$(current_dir)/$(name)-$(version).tar.gz"; \
rm -rf "$$tmpdir"
srpm: sources
@echo "Building source RPM"
rpmbuild -bs --define '_sourcedir $(current_dir)' --define '_srcrpmdir $(current_dir)/SRPMS' $(name).spec
rpm: sources
@echo "Building binary RPM"
rpmbuild -bb --define '_rpmdir $(current_dir)/RPMS' --define '_builddir $(current_dir)/BUILD' --define '_sourcedir $(current_dir)' $(name).spec
lint-ansible:
@echo "Linting Ansible collection..."
cd client/ansible_collections/fermilab/fact_inventory && uv run ansible-lint
test-ansible-role:
$(MAKE) -C tests/client/ansible test-ansible-role
.PHONY: _default sources srpm rpm lint-ansible test-ansible-role