forked from teemtee/tmt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
114 lines (91 loc) · 3.19 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
110
111
112
113
114
#
# Notes WRT help: a comment introduced by "##"...
# - ... after a target specification will server as its help,
# - ... at the beginning of line will serve as a target group separator.
#
# Prepare variables
TMP = $(CURDIR)/tmp
# Define special targets
.DEFAULT_GOAL := help
.PHONY: docs
all: docs packages ## Generate docs and packages
# Temporary directory, include .fmf to prevent exploring tests there
tmp:
mkdir -p $(TMP)/.fmf
##
## Run the tests
##
test: tmp ## Run the test suite
hatch run test:unit
smoke: tmp ## Run the smoke-level part of the test suite
hatch run test:smoke
coverage: tmp nitrateconf ## Run the test suite with coverage enabled
hatch run test:coverage
nitrateconf:
test -e ~/.nitrate || echo -en '[nitrate]\nurl = https://nitrate.server/xmlrpc/\n' | tee ~/.nitrate
# remove selected/all response files in tests/integration/test_data directory
requre: ## Regenerate test data for integration tests
hatch run test:requre
##
## Documentation
##
docs: clean ## Build documentation
hatch run docs:html
man: ## Build man page
hatch run docs:man
##
## Packaging & Packit
##
build: clean man
hatch build
tarball: clean tmp build
mkdir -p $(TMP)/SOURCES
cp dist/tmt-*.tar.gz $(TMP)/SOURCES
rpm: tarball ver2spec ## Build RPMs
# If the build system is missing the required dependencies, use nosrc.rpm to install them
rpmbuild --define '_topdir $(TMP)' -bb tmt.spec || echo 'Hint: run `make deps` to install build dependencies'
srpm: tarball ver2spec ## Build SRPM
rpmbuild --define '_topdir $(TMP)' -bs tmt.spec
deps: tarball ver2spec
rpmbuild --define '_topdir $(TMP)' -br tmt.spec || sudo dnf builddep $(TMP)/SRPMS/tmt-*buildreqs.nosrc.rpm
packages: rpm srpm ## Build RPM and SRPM packages
version: ## Build tmt version for packaging purposes
hatch version
ver2spec:
$(shell sed -E "s/^(Version:[[:space:]]*).*/\1$$(hatch version)/" -i tmt.spec)
##
## Containers
##
images: ## Build tmt images for podman/docker
podman build -t tmt --squash -f ./containers/Containerfile.mini .
podman build -t tmt-all --squash -f ./containers/Containerfile.full .
##
## Development
##
develop: ## Install development requirements
sudo dnf --setopt=install_weak_deps=False install hatch gcc make git rpm-build python3-nitrate {python3,libvirt,krb5,libpq}-devel jq podman
# Git vim tags and cleanup
tags:
find tmt -name '*.py' | xargs ctags --python-kinds=-i
clean: ## Remove all temporary files, packaging artifacts and docs
rm -rf $(TMP) build dist tmt.1
rm -rf .cache .mypy_cache .ruff_cache
rm -rf docs/{_build,stories,spec}
find . -type f -name "*.py[co]" -delete
find . -type f -name "*,cover" -delete
find . -type d -name "__pycache__" -delete
find . -type d -name .pytest_cache -exec rm -rv {} +
rm -f .coverage tags
rm -rf examples/convert/{main.fmf,test.md,Manual} Manual
rm -f tests/full/repo_copy.tgz
##
## Help!
##
help:: ## Show this help text
@gawk -vG=$$(tput setaf 2) -vR=$$(tput sgr0) ' \
match($$0, "^(([^#:]*[^ :]) *:)?([^#]*)##([^#].+|)$$",a) { \
if (a[2] != "") { printf " make %s%-18s%s %s\n", G, a[2], R, a[4]; next }\
if (a[3] == "") { print a[4]; next }\
printf "\n%-36s %s\n","",a[4]\
}' $(MAKEFILE_LIST)
@echo "" # blank line at the end