- Replace Makefile version/release file system with metadata.yaml only - Add Python build automation (./tools/build) with Gitea API integration - Add GitHub release updater (./tools/update-gh) for version management - Centralize Dockerfiles into single parameterized Dockerfile - Remove 54+ individual package Dockerfiles and version directories - Update Makefile to use new Python tooling - Add GITEA_API_TOKEN validation to prevent duplicate builds - Support both explicit version/release args and metadata.yaml reading
86 lines
3.3 KiB
Makefile
86 lines
3.3 KiB
Makefile
# Variables
|
|
ROOT_DIR := $(PWD)
|
|
BUILD_TOOL := $(ROOT_DIR)/tools/build
|
|
DISTRO ?= el/9 # Default to el/9 if not specified
|
|
|
|
# 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)
|
|
|
|
# Default target to build all packages
|
|
.PHONY: all list build clean
|
|
all: build-all
|
|
|
|
# List all available packages
|
|
list:
|
|
@echo "Available packages:"
|
|
@for package in $(PACKAGES); do \
|
|
echo " $$package"; \
|
|
done
|
|
|
|
# Build all packages using Python tool
|
|
build-all:
|
|
@echo "Building all packages using Python tooling for distro $(DISTRO)..."
|
|
$(BUILD_TOOL) --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
|
|
|
|
# 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
|
|
|
|
# Clean target
|
|
clean:
|
|
@echo "Cleaning build artifacts..."
|
|
rm -rf $(ROOT_DIR)/dist
|
|
|
|
# Update packages from GitHub releases
|
|
update:
|
|
@echo "Checking for package updates from GitHub releases..."
|
|
$(ROOT_DIR)/tools/update-gh --all
|
|
|
|
# Update specific package from GitHub
|
|
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"
|