Verified Commit d0ea790c authored by Levente Polyak's avatar Levente Polyak 🚀
Browse files

fix(make): use proper dependency tracking for the build output

Declare the whole keyring data as well as the code as input dependency
for the build target. This way we can properly depend on the build
target for installation without forcing rebuilding on every invocation.

A rebuild will be triggered if either the keyring or the source code
creating the build output changes.

The directories are added to the source dependencies on purpose to
guarantee that changes like deleted files will result in a rebuild.

The mtime of the build directory is force updated on every run to allow
make to track the output artifacts mtime compared against the
parent 0ceb6c74
PREFIX ?= /usr/local
KEYRING_FILES=$(wildcard build/*.gpg) $(wildcard build/*-revoked) $(wildcard build/*-trusted)
SOURCES := $(shell find keyring) $(shell find libkeyringctl -name '*.py' -or -type d) keyringctl
all: build
......@@ -22,14 +23,17 @@ test:
coverage xml
coverage report --fail-under=100.0
build: $(SOURCES)
./keyringctl -v build
rm -rf build
install: build
install -vDm 755 $(KEYRING_FILES) -t $(KEYRING_TARGET_DIR)
rm -f $(KEYRING_TARGET_DIR)/archlinux{.gpg,-trusted,-revoked}
rmdir -p --ignore-fail-on-non-empty $(KEYRING_TARGET_DIR)
.PHONY: all lint fmt test build install uninstall
.PHONY: all lint fmt check test clean install uninstall
......@@ -14,7 +14,11 @@ The PGP packets describing the main signing keys can be found below the
The following packages need to be installed to be able to create a PGP keyring
from the provided data structure and to install it:
* make
* findutils
* python
* sequoia-sq
......@@ -1089,6 +1089,7 @@ def build(
target_dir.mkdir(parents=True, exist_ok=True)
keyring: Path = target_dir / Path("archlinux.gpg")
export(working_dir=working_dir, keyring_root=keyring_root, output=keyring)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment