Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 92 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,94 @@ all: docs packages ## Generate docs and packages
tmp:
mkdir -p $(TMP)/.fmf

##
## Development
##

# Distro-specific lists and targets:
#
# * _deps/$_OS_ID + $_DEPS_CORE_$_OS_ID - minimal dependencies for various development-focused targets
# * _build-deps/$_OS_ID - build dependencies to allow tmt packaging
# * _develop/$_OS_ID + $_DEPS_DEVELOP_$_OS_ID - development dependencies for local development

_DEPS_CORE_FEDORA := \
hatch \
uv \
python3-devel \
python3-hatch-vcs \
rpm-build \
clang \
beakerlib

_DEPS_DEVELOP_FEDORA := \
expect \
gcc \
git \
python3-nitrate \
libvirt-devel \
krb5-devel \
libpq-devel \
python3-devel \
jq \
podman \
buildah \
/usr/bin/python3.9 \
Comment thread
happz marked this conversation as resolved.
pre-commit

# Note: interestingly, `hatch` is not shipped by Ubuntu, but `hatch` plugins are.
# Manual `hatch` installation probably does not the packaged plugin, leaving it
# in for now until we get better coverage.
_DEPS_CORE_UBUNTU := \
python3-dev \
python3-hatch-vcs \
clang

_DEPS_DEVELOP_UBUNTU := \
expect \
gcc \
git \
libvirt-dev \
libkrb5-dev \
libpq-dev \
python3-dev \
jq \
podman \
buildah \
Comment thread
happz marked this conversation as resolved.
python3.9 \
pre-commit
Comment on lines +34 to +78
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can reshuffle so that cores are together with core and develop are together with develop?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had it that way, then I switched to per-distro grouping. I guess both have their pros and cons, I don't have a favorite.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yeah. In one case we have all of the dependencies grouped together so it is easier for the maintainer to make sure something is not missed. In the other case it might be more useful for the passer-by checking the content


_OS_ID := $(shell sh -c '. /etc/os-release 2>/dev/null && echo $$ID')

# Fedora
_deps/fedora:
sudo dnf install -y $(_DEPS_CORE_FEDORA)

_build-deps/fedora: _deps tarball ver2spec
rpmbuild --define '_topdir $(TMP)' -br packaging/rpm/tmt.spec || sudo dnf builddep -y $(TMP)/SRPMS/tmt-*buildreqs.nosrc.rpm

_develop/fedora: _deps/fedora
sudo dnf install -y $(_DEPS_DEVELOP_FEDORA)

# Ubuntu
_deps/ubuntu:
sudo apt-get install -y $(_DEPS_CORE_UBUNTU)

@if [ "$$(which hatch)" = "" ]; then \
echo ""; \
echo "$(ccred)Hatch executable not detected. Ubuntu does not package hatch executable,$(ccend)"; \
echo "$(ccred)install it manually, please: https://hatch.pypa.io/latest/install/$(ccend)"; \
fi

# TODO: a placeholder, not packaging yet
_build-deps/ubuntu: _deps

_develop/ubuntu: _deps/ubuntu
sudo apt-get install -y $(_DEPS_DEVELOP_UBUNTU)

_deps: _deps/$(_OS_ID)
develop: _develop/$(_OS_ID) ## Install development requirements
build-deps: _build-deps/$(_OS_ID) ## Install build dependencies

##
## Run the tests
##
Expand Down Expand Up @@ -66,12 +154,6 @@ rpm: tarball ver2spec ## Build RPMs
srpm: tarball ver2spec ## Build SRPM
rpmbuild --define '_topdir $(TMP)' -bs packaging/rpm/tmt.spec

_deps: # Minimal dependencies (common for 'deps' and 'develop' targets)
sudo dnf install -y hatch uv python3-devel python3-hatch-vcs rpm-build clang beakerlib

build-deps: _deps tarball ver2spec ## Install build dependencies
rpmbuild --define '_topdir $(TMP)' -br packaging/rpm/tmt.spec || sudo dnf builddep -y $(TMP)/SRPMS/tmt-*buildreqs.nosrc.rpm

packages: rpm srpm ## Build RPM and SRPM packages

version: ## Build tmt version for packaging purposes
Expand Down Expand Up @@ -297,16 +379,15 @@ $(TMT_TEST_IMAGE_TARGET_PREFIX)/$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/debian/1

$(TMT_TEST_IMAGE_TARGET_PREFIX)/$(TMT_TEST_CONTAINER_IMAGE_NAME_PREFIX)/fedora/latest/bootc\:latest:
$(call build-test-container-image,$@,fedora/latest/bootc/Containerfile)
##
## Development
##
develop: _deps ## Install development requirements
sudo dnf install -y expect gcc git python3-nitrate {libvirt,krb5,libpq,python3}-devel jq podman buildah /usr/bin/python3.9

# Git vim tags and cleanup
tags:
find tmt -name '*.py' | xargs ctags --python-kinds=-i

##
## Clean
##

clean: ## Remove all temporary files, packaging artifacts and docs
rm -rf $(TMP) build dist tmt.1
rm -rf .cache .mypy_cache .ruff_cache
Expand Down
Loading