Commit Graph

425 Commits

Author SHA1 Message Date
Kevin Veen-Birkenbach
ab52d37467 Refactor release helper into actions package and add RPM changelog support
- Move the monolithic pkgmgr/actions/release.py implementation into the
  pkgmgr.actions.release package, splitting concerns into versioning,
  git_ops and files helpers.
- Extend the release orchestration to update Fedora/RPM %changelog
  entries via update_spec_changelog(), reusing the same effective
  release message as for CHANGELOG.md and debian/changelog.
- Wire the new update_spec_changelog() helper into _release_impl() so
  every release keeps project, Debian and RPM metadata in sync.
- Add unit tests for update_spec_changelog() and for the updated release
  orchestration behaviour in preview and real modes.
- Remove the deprecated pkgmgr/actions/release.py module.

See ChatGPT discussion: https://chatgpt.com/share/6938368e-0940-800f-92d3-f2ccfddab794
2025-12-09 15:47:37 +01:00
Kevin Veen-Birkenbach
80329b85fb Release version 0.7.1 v0.7.1 2025-12-09 15:26:56 +01:00
Kevin Veen-Birkenbach
44ff0a6cd9 Release version 0.7.0 v0.7.0 2025-12-09 15:21:06 +01:00
Kevin Veen-Birkenbach
e00b1a7b69 Solved import bug 2025-12-09 15:03:31 +01:00
Kevin Veen-Birkenbach
14f0188efd Solved e2e naming bugs 2025-12-09 15:02:04 +01:00
Kevin Veen-Birkenbach
a4efb847ba Cleaned Up tests 2025-12-09 14:33:32 +01:00
Kevin Veen-Birkenbach
d50891dfe5 Refactor: Restructure pkgmgr into actions/, core/, and cli/ (full module breakup)
This commit introduces a large-scale structural refactor of the pkgmgr
codebase. All functionality has been moved from the previous flat
top-level layout into three clearly separated namespaces:

  • pkgmgr.actions      – high-level operations invoked by the CLI
  • pkgmgr.core         – pure logic, helpers, repository utilities,
                          versioning, git helpers, config IO, and
                          command resolution
  • pkgmgr.cli          – parser, dispatch, context, and command
                          handlers

Key improvements:
  - Moved all “branch”, “release”, “changelog”, repo-management
    actions, installer pipelines, and proxy execution logic into
    pkgmgr.actions.<domain>.
  - Reworked installer structure under
        pkgmgr.actions.repository.install.installers
    including OS-package installers, Nix, Python, and Makefile.
  - Consolidated all low-level functionality under pkgmgr.core:
        • git helpers → core/git
        • config load/save → core/config
        • repository helpers → core/repository
        • versioning & semver → core/version
        • command helpers (alias, resolve, run, ink) → core/command
  - Replaced pkgmgr.cli_core with pkgmgr.cli and updated all imports.
  - Added minimal __init__.py files for clean package exposure.
  - Updated all E2E, integration, and unit tests with new module paths.
  - Fixed patch targets so mocks point to the new structure.
  - Ensured backward compatibility at the CLI boundary (pkgmgr entry point unchanged).

This refactor produces a cleaner, layered architecture:
  - `core` = logic
  - `actions` = orchestrated behaviour
  - `cli` = user interface

Reference: ChatGPT-assisted refactor discussion
https://chatgpt.com/share/6938221c-e24c-800f-8317-7732cedf39b9
2025-12-09 14:20:19 +01:00
Kevin Veen-Birkenbach
59d0355b91 Release version 0.6.0 v0.6.0 2025-12-09 05:59:58 +01:00
Kevin Veen-Birkenbach
da9d5cfa6b Fix container tests, unify RPM install path, and ensure Nix TLS truststore detection
Changes included:
• GitHub Actions workflow: rename job from 'test-unit' to 'test-container' to match intent.
• RPM packaging: replace %{_libdir}/package-manager with a fixed /usr/lib/package-manager
  to avoid lib/lib64 divergence on CentOS and ensure pkgmgr + Nix flake resolution works
  consistently across distros.
• Docker entrypoint: add automatic CA-bundle detection and set NIX_SSL_CERT_FILE to fix
  TLS issues on CentOS ('unable to get local issuer certificate') when Nix fetches flake
  inputs.

These updates stabilize container-based tests and unify the runtime environment
for Fedora, CentOS, and other distributions.

Reference:
ChatGPT conversation: https://chatgpt.com/share/6937aa72-d33c-800f-a63f-c353e92de6b3
2025-12-09 05:50:08 +01:00
Kevin Veen-Birkenbach
f9943fafae Refactor container build and installation pipeline to use configurable Makefile parameters (e.g. DISTROS, base images) and propagate them through all build, install, and test scripts 2025-12-09 05:31:55 +01:00
Kevin Veen-Birkenbach
7d73007181 Release version 0.5.1 v0.5.1 2025-12-09 01:21:31 +01:00
Kevin Veen-Birkenbach
c8462fefa4 Release version 0.5.0 v0.5.0 2025-12-09 00:44:16 +01:00
Kevin Veen-Birkenbach
00a1f373ce Merge branch 'feature/config_v2.0' 2025-12-09 00:29:19 +01:00
Kevin Veen-Birkenbach
9f9f2e68c0 Release version 0.4.3 v0.4.3 2025-12-09 00:29:08 +01:00
Kevin Veen-Birkenbach
d25dcb05e4 Merge branch 'feature/branch_close' 2025-12-09 00:03:56 +01:00
Kevin Veen-Birkenbach
e135d39710 Release version 0.4.2 v0.4.2 2025-12-09 00:03:46 +01:00
Kevin Veen-Birkenbach
76b7f84989 Release version 0.4.1 v0.4.1 2025-12-08 23:20:28 +01:00
Kevin Veen-Birkenbach
1b53263f87 Release version 0.4.0 v0.4.0 2025-12-08 23:02:43 +01:00
Kevin Veen-Birkenbach
8ea7ff23e9 Release version 0.3.0 v0.3.0 2025-12-08 22:40:50 +01:00
Kevin Veen-Birkenbach
71823c2f48 Release version 0.2.0 v0.2.0 2025-12-08 20:31:19 +01:00
Kevin Veen-Birkenbach
cd62af41d1 Release version 0.1.0 v0.1.0 2025-12-08 20:24:49 +01:00
Kevin Veen-Birkenbach
bc3ff5b67f Release version 2.1.0 2025-12-08 20:15:13 +01:00
Kevin Veen-Birkenbach
b9b64fed7d Add branch CLI command and tests (see ChatGPT conversation: https://chatgpt.com/share/69370ce1-8090-800f-8b08-8ecfa5089a74)
Signed-off-by: Kevin Veen-Birkenbach <kevin@veen.world>
2025-12-08 18:37:59 +01:00
Kevin Veen-Birkenbach
22b65f83d3 Add changelog CLI command and tests (see ChatGPT conversation 2025-12-08) https://chatgpt.com/share/69370663-4eb8-800f-bba9-4f5c42682450 2025-12-08 18:11:39 +01:00
Kevin Veen-Birkenbach
0b96270f78 Refactor pkgmgr CLI into modular core and add E2E tests for config/release/make/tools (see ChatGPT conversation 2025-12-08 https://chatgpt.com/share/6936ffa5-4868-800f-ab63-6e367093adce) 2025-12-08 17:41:27 +01:00
Kevin Veen-Birkenbach
ccf3b1aa3c Fix RPM installation for Fedora/CentOS by enforcing offline local install
This commit improves the robustness of the RPM installation step for
Fedora and CentOS by disabling all remote repositories when installing
the locally built package-manager RPM. This prevents failures caused
by flaky or mismatched upstream metadata (e.g., BaseOS repomd.xml
checksum errors). The installer now:

- uses 'dnf5/dnf/yum --disablerepo=*' for fully offline installation
- falls back to 'rpm -i --nodeps' if the package manager fails
- ensures deterministic CI builds without remote repo dependencies

Reference: Conversation with ChatGPT (2025-12-08). https://chatgpt.com/share/6936ff1e-4adc-800f-b508-b5b90c0ef635
2025-12-08 17:39:21 +01:00
Kevin Veen-Birkenbach
0933e73e1c Extend 'pkgmgr version' command with multi-source version detection (pyproject, flake, PKGBUILD, debian, spec, AnsibleGalaxy), implement SemVer parsing, consistency warnings, full E2E + unit test coverage.
Ref: https://chatgpt.com/share/6936ef7e-ad5c-800f-96b2-e5d0f32b39ca
2025-12-08 16:32:38 +01:00
Kevin Veen-Birkenbach
a5aaacc8d0 Refactor Docker-based packaging and delegate Nix installation to system hooks (see ChatGPT conversation: https://chatgpt.com/share/6936db94-ff30-800f-9b50-86a4b45c44bf) 2025-12-08 15:08:42 +01:00
Kevin Veen-Birkenbach
ef23e14ae4 Add Git utilities, semantic version helpers, and unit tests
Ref: https://chatgpt.com/share/6936c64b-ae80-800f-ae7e-ed0a692ec3fc
2025-12-08 13:36:40 +01:00
Kevin Veen-Birkenbach
e6d041553b Fix Makefile build-arch target to use a single shell and correctly pass BASE_IMAGE_arch to docker build.
Reference: https://chatgpt.com/share/6936c5f9-5064-800f-8597-1cf3ccf7f42b
2025-12-08 13:35:20 +01:00
Kevin Veen-Birkenbach
15f3c1bcba Refine command resolution and symlink creation (see ChatGPT conversation: https://chatgpt.com/share/6936be2d-952c-800f-a1cd-7ce5438014ff) 2025-12-08 13:02:05 +01:00
Kevin Veen-Birkenbach
f641b95d81 Add recursive capability resolver, integration tests, and GitHub workflow (see: https://chatgpt.com/share/6936abc9-87cc-800f-97e6-f7429fb1a910) 2025-12-08 11:43:39 +01:00
Kevin Veen-Birkenbach
775c30149c Improve MakefileInstaller: only run 'make install' if an install target exists
- Added parsing of Makefile to detect real 'install' target
- Added safe fallback when Makefile cannot be read
- Added informative skip message when install target is missing
- Updated unit tests to cover: install present, install missing, file read
- Removed circular self-import causing test import failures

Conversation reference: https://chatgpt.com/share/6936a2bf-6aa4-800f-a1bc-7c8eac66bc18
2025-12-08 11:05:08 +01:00
Kevin Veen-Birkenbach
26ba3c50cd Improve installer debugging and enhance E2E test diagnostics
- Added rich error reporting to install_repos() for clearer installer failure context
  (repository identifier, repo directory, installer name, exit code).
- Updated E2E test 'install_all_shallow' to show additional diagnostics,
  including Nix profile dumps and contextual SystemExit handling.
- Removed outdated/deactivated test file.
- New test now mirrors the robust debugging flow of the pkgmgr-only test.

See conversation for full context:
https://chatgpt.com/share/6936241b-52ec-800f-9859-1734a581c002
2025-12-08 02:05:03 +01:00
Kevin Veen-Birkenbach
9648be4a26 Refactor test pipeline: introduce separate unit/e2e workflows, fix Dockerfile, update Makefile test targets, and move integration tests to tests/e2e.
Conversation reference:
https://chatgpt.com/share/69361e70-4d74-800f-acd7-51548ac3fa37
2025-12-08 01:40:36 +01:00
Kevin Veen-Birkenbach
b124166205 Fix Nix devShell tests for multi-distro Docker images
- Enable test matrix for arch, debian, ubuntu, fedora, centos
- Mount /nix Docker volume only on Arch so image-local Nix installs remain visible on other distros
- Keep shared Nix cache volume for all distros

Details: https://chatgpt.com/share/69361196-e950-800f-ad3d-670156337b7e
2025-12-08 00:49:36 +01:00
Kevin Veen-Birkenbach
0286cb44e0 Refactor multi-distro Dockerfile and Makefile:
- Add dynamic BASE_IMAGE selection via ARG for Arch, Debian, Ubuntu, Fedora, CentOS
- Introduce conditional package installation and unified Nix installer logic
- Implement single-user Nix install without build-users-group for Debian/Ubuntu/Fedora/CentOS
- Add Nix environment preparation and PATH fixes
- Restore Arch-only makepkg build stage
- Extend Makefile with multi-distro build/test workflow
- Add base image mappings (arch/debian/ubuntu/fedora/centos)
- Add test runner logic for each distro, including Nix devShell fallback scanning
- Improve structure with clear section headers and comments

https://chatgpt.com/share/69360c94-ef04-800f-afd2-75bc6cd33d4d
2025-12-08 00:24:22 +01:00
Kevin Veen-Birkenbach
87b806d1b9 feat: package config/ and defaults.yaml correctly for Nix & setuptools
This commit fixes the missing `config/defaults.yaml` issue that caused
`pkgmgr --help` to fail with exit code 5 inside Nix builds and during
integration tests.

Changes:
- Added `config/__init__.py` to make the directory a proper Python package.
- Updated `pyproject.toml` to rely on setuptools package discovery.
- Extended `tool.setuptools.packages.find.include` to include both `pkgmgr*` and `config*`.
- Added `tool.setuptools.package-data` so `defaults.yaml` is included
  in wheels, Nix builds, and PKGBUILD-derived installations.
- Removed the conflicting `tool.setuptools.packages` declaration.

This ensures that Nix's pypaBuildPhase can build the wheel successfully
and that `pkgmgr --help` no longer crashes due to missing default config.

Reference:
https://chatgpt.com/share/6935f05f-03d8-800f-a126-b3114cc116ec
2025-12-07 22:29:58 +01:00
Kevin Veen-Birkenbach
7760c77952 Use pyproject-based Nix flake build and fix install logic for pkgmgr
- Add pyproject.toml to define package-manager as a Python application
  - Declare setuptools build backend (setuptools.build_meta) and wheel
  - Expose CLI entrypoint via [project.scripts] as `pkgmgr = pkgmgr.cli:main`
  - Define PyYAML as a base runtime dependency

- Update flake.nix to build pkgmgr via python311Packages.buildPythonApplication
  - Use format = "pyproject" and src = ./. (current git checkout)
  - Add setuptools and wheel to nativeBuildInputs for the backend
  - Add pyyaml to propagatedBuildInputs to match pyproject dependencies
  - Provide a devShell that includes the built pkgmgr, git, and Ansible
  - Expose `nix run .#pkgmgr` and `nix run .#default` as flake apps

- Fix Makefile install target for Nix shells
  - Treat install as a no-op when IN_NIX_SHELL is set (skip venv / pip)
  - In non-Nix environments, create ~/.venvs/pkgmgr, install deps, and
    wire automatic activation into shell rc files
  - Keep Arch/Manjaro-specific aur_builder/yay setup behind pacman check

- Adjust PKGBUILD prepare() to correctly copy the full project tree
  - Stop excluding the top-level src directory from rsync
  - Still exclude .git, .github, pkg, and srcpkg

This unifies the installation workflow across Arch, Nix, and local venvs,
and ensures pkgmgr builds cleanly inside the Docker-based Nix devShell tests.

Reference: ChatGPT-assisted refactor & debugging session on 2025-12-07.
https://chatgpt.com/share/6935ee1f-6c0c-800f-bb32-434c4051bd1e
2025-12-07 22:14:29 +01:00
Kevin Veen-Birkenbach
8e80dc5fd7 Fixed tests in container 2025-12-07 21:52:04 +01:00
Kevin Veen-Birkenbach
9679478353 Improve Docker-based build & test pipeline for pkgmgr
- Add .dockerignore rules to prevent Arch package artifacts from entering the build context
- Rework Dockerfile to remove stale package artifacts before makepkg and use a dev entry script
- Introduce docker-entry-dev.sh to always rebuild pkgmgr from the mounted /src tree
- Update Makefile 'test' target to rebuild pkgmgr inside the container before running tests
- Fix predictable makepkg failures caused by residual *.pkg.tar.* files

Conversation reference: https://chatgpt.com/share/6935e6e8-f3fc-800f-a4e9-7537114f13d1
2025-12-07 21:43:38 +01:00
Kevin Veen-Birkenbach
225d6a84b7 Added error code 2025-12-07 21:02:55 +01:00
Kevin Veen-Birkenbach
6e52e875aa Added ENV to Dockerfile 2025-12-07 20:58:49 +01:00
Kevin Veen-Birkenbach
6fee6f27ee Fix PKGBUILD source handling and Docker build context
This commit removes unnecessary source entries from PKGBUILD
to allow full local-tree packaging through prepare(), and updates
the Dockerfile to copy the entire repository and install rsync
for makepkg buildtime dependencies.

See conversation: https://chatgpt.com/share/6935db4e-f3e8-800f-b0ca-42f77491ef5b
2025-12-07 20:54:04 +01:00
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
Kevin Veen-Birkenbach
5134fd5273 Added missing package-manager.install 2025-12-06 19:46:59 +01:00
Kevin Veen-Birkenbach
aaf20da0a0 Add cross-distribution OS package installers (Arch PKGBUILD, Debian control, RPM spec) and restructure tests.
Remove deprecated AUR and Ansible requirements installers.
Introduce Nix init + wrapper scripts and full packaging (Arch/DEB/RPM).
Associated conversation: https://chatgpt.com/share/693476a8-b9f0-800f-8e0c-ea5151295ce2
2025-12-06 19:32:31 +01:00
Kevin Veen-Birkenbach
d6a7ce0aa0 Fix: Skip venv/pip installation inside Nix shell and add fallback for _requirements.txt (see conversation: https://chatgpt.com/share/69345df2-a960-800f-8395-92a7c3a6629f) 2025-12-06 17:57:05 +01:00
Kevin Veen-Birkenbach
f57ab0c2d1 Refactor pkgmgr self-install handling, add pip-enabled Python env to flake, and fix Nix/pip integration
- Rename requirements.txt to _requirements.txt to avoid unintended self-install via PythonInstaller.
- Update flake.nix to provide Python with pip in both devShell and runtime closure.
- Generate a wrapper for pkgmgr that uses the pip-enabled interpreter.
- Adjust NixFlakeInstaller to correctly handle old profile removal and install outputs.
- Update run_command to support string commands and allow_failure.
- Improve integration test by adding nix profile cleanup and debugging output.

Reference: https://chatgpt.com/share/69345df2-a960-800f-8395-92a7c3a6629f
2025-12-06 17:47:46 +01:00
Kevin Veen-Birkenbach
96a0409dbb Enhance Nix flake installer to remove old profile entries before installation and update unit tests accordingly.
Includes:
- Added best-effort removal of existing 'package-manager' Nix profile entry.
- Updated install logic to avoid file conflicts.
- Extended unit tests to verify removal behavior and SystemExit-safe handling.

Conversation reference: https://chatgpt.com/share/69332bc4-a128-800f-a69c-fdc24c4cc7fe
2025-12-06 15:47:31 +01:00