Files
pkgmgr/Makefile

109 lines
3.1 KiB
Makefile
Raw Normal View History

.PHONY: install uninstall \
build build-no-cache build-no-cache-all build-missing \
delete-volumes purge \
test test-unit test-e2e test-integration test-env-virtual test-env-nix \
lint \
setup setup-venv setup-nix
# Distro
# Options: arch debian ubuntu fedora centos
DISTROS ?= arch debian ubuntu fedora centos
2025-12-13 15:05:34 +01:00
PKGMGR_DISTRO ?= arch
export PKGMGR_DISTRO
# Nix Config Variable (To avoid rate limit)
NIX_CONFIG ?=
export NIX_CONFIG
# ------------------------------------------------------------
# Base images
# ------------------------------------------------------------
refactor(docker): consume the base images instead of building them The `virgin` stage installed the distribution build dependencies, and that layer now lives in its own repository: https://github.com/kevinveenbirkenbach/base-images. What remains here is one image per distribution that installs pkgmgr on top of it. `slim` goes with it: it was published for every distribution and pulled by nothing. scripts/build/base.sh stops pinning five upstream images and resolves ghcr.io/<owner>/base-<distro>:<tag> instead. Its env names follow the images repository rather than this one, so the code shows whose namespace that is. image.sh loses the --target axis, the -virgin/-slim tag suffixes with it, and passes --platform on push. Manjaro joins the set; os_resolver.sh already maps it onto arch, so it needs no dependency script of its own. The two virgin workflows pull the base image rather than building it. What they prove is unchanged: pkgmgr installs into an untouched container, as root and as an unprivileged user. test_distro_dependency_scripts_install_gpg_tools goes: it grepped the dependency scripts for gnupg, and those scripts are base-images' responsibility now, where the contract test runs `gpg --version` instead of reading a package list. Verified against locally built base images: the arch image builds FROM base-arch, and the full suite passes inside it - 405 unit, 90 integration and 49 e2e tests. Requires base-images to be published first; until then every build here fails at the pull. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 15:51:25 +02:00
BASE_IMAGES_TAG ?= latest
export BASE_IMAGES_TAG
# PYthon Unittest Pattern
TEST_PATTERN := test_*.py
export TEST_PATTERN
export PYTHONPATH := src
# ------------------------------------------------------------
# System install
# ------------------------------------------------------------
install:
@echo "Building and installing distro-native package-manager for this system..."
@bash scripts/installation/init.sh
2025-04-01 15:37:07 +02:00
# ------------------------------------------------------------
# PKGMGR setup
# ------------------------------------------------------------
# Default: keep current auto-detection behavior
setup: setup-venv
# Explicit: developer setup (Python venv + shell RC + install)
2025-12-12 18:07:25 +01:00
setup-venv: setup-nix
@bash scripts/setup/venv.sh
# Explicit: Nix shell mode (no venv, no RC changes)
setup-nix:
@bash scripts/setup/nix.sh
# ------------------------------------------------------------
# Docker build targets (delegated to scripts/build)
# ------------------------------------------------------------
build:
@bash scripts/build/image.sh
refactor(docker): consume the base images instead of building them The `virgin` stage installed the distribution build dependencies, and that layer now lives in its own repository: https://github.com/kevinveenbirkenbach/base-images. What remains here is one image per distribution that installs pkgmgr on top of it. `slim` goes with it: it was published for every distribution and pulled by nothing. scripts/build/base.sh stops pinning five upstream images and resolves ghcr.io/<owner>/base-<distro>:<tag> instead. Its env names follow the images repository rather than this one, so the code shows whose namespace that is. image.sh loses the --target axis, the -virgin/-slim tag suffixes with it, and passes --platform on push. Manjaro joins the set; os_resolver.sh already maps it onto arch, so it needs no dependency script of its own. The two virgin workflows pull the base image rather than building it. What they prove is unchanged: pkgmgr installs into an untouched container, as root and as an unprivileged user. test_distro_dependency_scripts_install_gpg_tools goes: it grepped the dependency scripts for gnupg, and those scripts are base-images' responsibility now, where the contract test runs `gpg --version` instead of reading a package list. Verified against locally built base images: the arch image builds FROM base-arch, and the full suite passes inside it - 405 unit, 90 integration and 49 e2e tests. Requires base-images to be published first; until then every build here fails at the pull. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 15:51:25 +02:00
build-missing:
@bash scripts/build/image.sh --missing
build-no-cache:
@bash scripts/build/image.sh --no-cache
build-no-cache-all:
@set -e; \
for d in $(DISTROS); do \
echo "=== build-no-cache: $$d ==="; \
PKGMGR_DISTRO="$$d" $(MAKE) build-no-cache; \
done
# ------------------------------------------------------------
# Lint targets (run on the host, not in a container)
# ------------------------------------------------------------
lint:
@bash scripts/lint/python.sh
# ------------------------------------------------------------
# Test targets (delegated to scripts/test)
# ------------------------------------------------------------
test-unit: build-missing
@bash scripts/test/test-unit.sh
test-integration: build-missing
@bash scripts/test/test-integration.sh
test-e2e: build-missing
@bash scripts/test/test-e2e.sh
test-env-virtual: build-missing
@bash scripts/test/test-env-virtual.sh
test-env-nix: build-missing
@bash scripts/test/test-env-nix.sh
# Combined test target for local + CI (lint + unit + integration + e2e)
test: lint test-env-virtual test-unit test-integration test-e2e
2025-04-27 22:38:52 +02:00
2025-12-11 15:29:51 +01:00
delete-volumes:
@docker volume rm "pkgmgr_nix_store_${PKGMGR_DISTRO}" "pkgmgr_nix_cache_${PKGMGR_DISTRO}" || echo "No volumes to delete."
2025-12-11 15:29:51 +01:00
purge: delete-volumes build-no-cache
# ------------------------------------------------------------
# Uninstall target
# ------------------------------------------------------------
2025-04-27 22:38:52 +02:00
uninstall:
@bash scripts/uninstall.sh