refactor: modernise RPM builder with Python tooling v2
Build / build-8 (pull_request) Successful in 8s
Build / build-9 (pull_request) Successful in 9s

- Migrate from legacy shell-based build system to modern Python tooling
- Update all metadata.yaml files to new schema with per-distro builds
- Standardise build scripts with curl -L, envsubst, and error handling
- Convert nfpm.yaml templates to use environment variable substitution
- Update Dockerfile to accept all package metadata as build arguments
- Modernise Makefile to use new Python build tool commands
- Update CI workflow to use tools/build instead of make
This commit is contained in:
2025-11-30 20:27:05 +11:00
parent b3ba980f9f
commit 182641132a
160 changed files with 2013 additions and 1089 deletions
+4 -40
View File
@@ -1,7 +1,7 @@
# Variables
ROOT_DIR := $(PWD)
BUILD_TOOL := $(ROOT_DIR)/tools/build
DISTRO ?= el/9 # Default to el/9 if not specified
DISTRO ?= almalinux/el9
# Automatically find all packages with metadata.yaml
PACKAGES := $(shell find $(ROOT_DIR)/rpms -mindepth 1 -maxdepth 1 -type d -exec test -f {}/metadata.yaml \; -print | xargs -n1 basename | sort)
@@ -20,33 +20,18 @@ list:
# Build all packages using Python tool
build-all:
@echo "Building all packages using Python tooling for distro $(DISTRO)..."
$(BUILD_TOOL) --all --distro $(DISTRO)
$(BUILD_TOOL) build-all --distro $(DISTRO)
# Build specific package using Python tool
.PHONY: $(PACKAGES)
$(PACKAGES):
@echo "Building package: $@ for distro $(DISTRO)"
$(BUILD_TOOL) --package $@ --distro $(DISTRO)
# Build specific package with version/release override
build:
@if [ -z "$(PACKAGE_NAME)" ]; then \
echo "Error: PACKAGE_NAME not specified"; \
echo "Usage: make build PACKAGE_NAME=package [PACKAGE_VERSION=version] [PACKAGE_RELEASE=release]"; \
exit 1; \
fi
@if [ -n "$(PACKAGE_VERSION)" ] && [ -n "$(PACKAGE_RELEASE)" ]; then \
echo "Building $(PACKAGE_NAME) with explicit version $(PACKAGE_VERSION)-$(PACKAGE_RELEASE) for distro $(DISTRO)"; \
$(BUILD_TOOL) --package $(PACKAGE_NAME) --version $(PACKAGE_VERSION) --release $(PACKAGE_RELEASE) --distro $(DISTRO); \
else \
echo "Building $(PACKAGE_NAME) using metadata.yaml for distro $(DISTRO)"; \
$(BUILD_TOOL) --package $(PACKAGE_NAME) --distro $(DISTRO); \
fi
$(BUILD_TOOL) build --distro $(DISTRO) $@
# Dry run - show what would be built without building
dry-run:
@echo "Dry run - showing what would be built for distro $(DISTRO):"
$(BUILD_TOOL) --all --distro $(DISTRO) --dry-run
$(BUILD_TOOL) build-all --distro $(DISTRO) --dry-run
# Clean target
clean:
@@ -62,24 +47,3 @@ update:
update-%:
@echo "Checking for updates for package: $*"
$(ROOT_DIR)/tools/update-gh --package $*
# Help target
help:
@echo "Available targets:"
@echo " all - Build all packages (default)"
@echo " list - List all available packages"
@echo " build-all - Build all packages using Python tooling"
@echo " <package> - Build specific package (e.g., 'make consul')"
@echo " build - Build with explicit PACKAGE_NAME, PACKAGE_VERSION, PACKAGE_RELEASE"
@echo " dry-run - Show what would be built without building"
@echo " clean - Remove build artifacts"
@echo " update - Check all packages for GitHub release updates"
@echo " update-<pkg> - Check specific package for GitHub release updates"
@echo " help - Show this help message"
@echo ""
@echo "Examples:"
@echo " make consul # Build consul using metadata.yaml"
@echo " make build PACKAGE_NAME=consul # Build consul using metadata.yaml"
@echo " make build PACKAGE_NAME=consul PACKAGE_VERSION=1.21.1 PACKAGE_RELEASE=1"
@echo " make update-consul # Check consul for GitHub updates"
@echo " make dry-run # Show what would be built"