Files
pkgmgr/debian/rules
Kevin Veen-Birkenbach 16a9d55d4f Refactor pkgmgr installers, introduce capability-based execution, and replace manifest layer
References:
- Current ChatGPT conversation: https://chatgpt.com/share/6935d6d7-0ae4-800f-988a-44a50c17ba48
- Extended discussion: https://chatgpt.com/share/6935d734-fd84-800f-9755-290902b8cee8

Summary:
This commit performs a major cleanup and modernization of the installation pipeline:

1. Introduced a new capability-detection subsystem:
   - Capabilities (python-runtime, make-install, nix-flake) are detected per installer/layer.
   - Installers run only when they add new capabilities.
   - Prevents duplicated work such as Python installers running when Nix already provides the runtime.

2. Removed deprecated pkgmgr.yml manifest installer:
   - Dependency resolution is now delegated entirely to real package managers (Nix, pip, make, distro build tools).
   - Simplifies layering and avoids unnecessary recursion.

3. Reworked OS-specific installers:
   - Arch PKGBUILD now uses 'makepkg --syncdeps --cleanbuild --install --noconfirm'.
   - Debian installer now builds proper .deb packages via dpkg-buildpackage + installs them.
   - RPM installer now builds packages using rpmbuild and installs them via rpm.

4. Switched from remote GitHub flakes to local-flake execution:
   - Wrapper now executes: nix run /usr/lib/package-manager#pkgmgr
   - Avoids lock-file write attempts and improves reliability in CI.

5. Added bash -i based integration test:
   - Correctly sources ~/.bashrc and evaluates alias + venv activation.
   - ‘pkgmgr --help’ is now printed for debugging without failing tests.

6. Updated unit tests across all installers:
   - Removed references to manifest installer.
   - Adjusted expectations for new behaviors (makepkg, dpkg-buildpackage, rpmbuild).
   - Added capability subsystem tests.

7. Improved flake.nix packaging logic:
   - The entire project source tree is copied into the runtime closure.
   - pkgmgr wrapper now executes runpy inside the packaged directory.

Together, these changes create a predictable, layered, capability-driven installer pipeline with consistent behavior across Arch, Debian, RPM, Nix, and Python layers.
2025-12-07 20:36:39 +01:00

37 lines
1.3 KiB
Makefile
Executable File

#!/usr/bin/make -f
%:
dh $@
override_dh_auto_install:
# Create target directories
install -d debian/package-manager/usr/bin
install -d debian/package-manager/usr/lib/package-manager
# Install wrapper
install -m0755 scripts/pkgmgr-wrapper.sh \
debian/package-manager/usr/bin/pkgmgr
# Install shared Nix init script
install -m0755 scripts/init-nix.sh \
debian/package-manager/usr/lib/package-manager/init-nix.sh
# Copy full project source into /usr/lib/package-manager,
# but do not include the debian/ directory itself.
find . -mindepth 1 -maxdepth 1 \
! -name debian \
! -name .git \
-exec cp -a {} debian/package-manager/usr/lib/package-manager/ \;
# Remove packaging-only and development artefacts from the installed tree
rm -rf \
debian/package-manager/usr/lib/package-manager/debian \
debian/package-manager/usr/lib/package-manager/PKGBUILD \
debian/package-manager/usr/lib/package-manager/Dockerfile \
debian/package-manager/usr/lib/package-manager/.git \
debian/package-manager/usr/lib/package-manager/.github \
debian/package-manager/usr/lib/package-manager/tests \
debian/package-manager/usr/lib/package-manager/.gitignore \
debian/package-manager/usr/lib/package-manager/__pycache__ \
debian/package-manager/usr/lib/package-manager/.gitkeep || true