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.
This commit is contained in:
63
PKGBUILD
63
PKGBUILD
@@ -3,31 +3,72 @@
|
||||
pkgname=package-manager
|
||||
pkgver=0.1.1
|
||||
pkgrel=1
|
||||
pkgdesc="Wrapper that runs Kevin's package-manager via Nix flake."
|
||||
pkgdesc="Local-flake wrapper for Kevin's package-manager (Nix-based)."
|
||||
arch=('any')
|
||||
url="https://github.com/kevinveenbirkenbach/package-manager"
|
||||
license=('MIT')
|
||||
|
||||
# Nix is the only runtime dependency; Python is provided by the Nix closure.
|
||||
depends=('nix')
|
||||
makedepends=('rsync')
|
||||
|
||||
install=${pkgname}.install
|
||||
|
||||
source=('scripts/pkgmgr-wrapper.sh'
|
||||
'scripts/init-nix.sh')
|
||||
sha256sums=('SKIP'
|
||||
'SKIP')
|
||||
# Local source checkout — avoids the tarball requirement.
|
||||
# This assumes you build the package from inside the main project repository.
|
||||
source=(
|
||||
"scripts/pkgmgr-wrapper.sh"
|
||||
"scripts/init-nix.sh"
|
||||
)
|
||||
|
||||
sha256sums=('SKIP' 'SKIP')
|
||||
|
||||
# Local source directory name under $srcdir
|
||||
_srcdir_name="source"
|
||||
|
||||
prepare() {
|
||||
mkdir -p "$srcdir/$_srcdir_name"
|
||||
|
||||
# Copy the full local tree into $srcdir/source,
|
||||
# but avoid makepkg's own directories and the VCS metadata.
|
||||
rsync -a \
|
||||
--exclude="src" \
|
||||
--exclude="pkg" \
|
||||
--exclude=".git" \
|
||||
"$startdir/" "$srcdir/$_srcdir_name/"
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "$srcdir/$_srcdir_name"
|
||||
:
|
||||
}
|
||||
|
||||
package() {
|
||||
install -d "$pkgdir/usr/bin"
|
||||
install -d "$pkgdir/usr/lib/package-manager"
|
||||
cd "$srcdir/$_srcdir_name"
|
||||
|
||||
# Wrapper
|
||||
install -m0755 "scripts/pkgmgr-wrapper.sh" "$pkgdir/usr/bin/pkgmgr"
|
||||
# Install the wrapper into /usr/bin
|
||||
install -Dm0755 "scripts/pkgmgr-wrapper.sh" \
|
||||
"$pkgdir/usr/bin/pkgmgr"
|
||||
|
||||
# Shared Nix init script
|
||||
install -m0755 "scripts/init-nix.sh" "$pkgdir/usr/lib/package-manager/init-nix.sh"
|
||||
# Install Nix init helper
|
||||
install -Dm0755 "scripts/init-nix.sh" \
|
||||
"$pkgdir/usr/lib/package-manager/init-nix.sh"
|
||||
|
||||
# Install the full repository into /usr/lib/package-manager
|
||||
mkdir -p "$pkgdir/usr/lib/package-manager"
|
||||
|
||||
# Copy entire project tree from our local source checkout
|
||||
cp -a . "$pkgdir/usr/lib/package-manager/"
|
||||
|
||||
# Remove packaging-only and development artefacts from the installed tree
|
||||
rm -rf \
|
||||
"$pkgdir/usr/lib/package-manager/.git" \
|
||||
"$pkgdir/usr/lib/package-manager/.github" \
|
||||
"$pkgdir/usr/lib/package-manager/tests" \
|
||||
"$pkgdir/usr/lib/package-manager/PKGBUILD" \
|
||||
"$pkgdir/usr/lib/package-manager/Dockerfile" \
|
||||
"$pkgdir/usr/lib/package-manager/debian" \
|
||||
"$pkgdir/usr/lib/package-manager/.gitignore" \
|
||||
"$pkgdir/usr/lib/package-manager/__pycache__" \
|
||||
"$pkgdir/usr/lib/package-manager/.gitkeep"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user