From 1b483e178d2f865c4d975971491295916798570e Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 9 Dec 2025 22:57:11 +0100 Subject: [PATCH] Release version 0.7.10 --- CHANGELOG.md | 5 ++ PKGBUILD | 2 +- debian/changelog | 6 +++ flake.nix | 2 +- package-manager.spec | 5 +- pyproject.toml | 2 +- scripts/installation/centos/dependencies.sh | 1 + tests/e2e/test_install_pkgmgr_shallow.py | 52 +++++++++++++-------- 8 files changed, 51 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 535cda1..79f85d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [0.7.10] - 2025-12-09 + +* Fixed test_install_pkgmgr_shallow.py + + ## [0.7.9] - 2025-12-09 * 'main' and 'master' are now both accepted as branches for branch close merge diff --git a/PKGBUILD b/PKGBUILD index eac9c4a..4e10c3f 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Kevin Veen-Birkenbach pkgname=package-manager -pkgver=0.7.9 +pkgver=0.7.10 pkgrel=1 pkgdesc="Local-flake wrapper for Kevin's package-manager (Nix-based)." arch=('any') diff --git a/debian/changelog b/debian/changelog index bfb8cfe..65a878f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +package-manager (0.7.10-1) unstable; urgency=medium + + * Fixed test_install_pkgmgr_shallow.py + + -- Kevin Veen-Birkenbach Tue, 09 Dec 2025 22:57:08 +0100 + package-manager (0.7.9-1) unstable; urgency=medium * 'main' and 'master' are now both accepted as branches for branch close merge diff --git a/flake.nix b/flake.nix index 18f852c..0b831bc 100644 --- a/flake.nix +++ b/flake.nix @@ -31,7 +31,7 @@ rec { pkgmgr = pyPkgs.buildPythonApplication { pname = "package-manager"; - version = "0.7.9"; + version = "0.7.10"; # Use the git repo as source src = ./.; diff --git a/package-manager.spec b/package-manager.spec index 5814f1c..63772c9 100644 --- a/package-manager.spec +++ b/package-manager.spec @@ -1,5 +1,5 @@ Name: package-manager -Version: 0.7.9 +Version: 0.7.10 Release: 1%{?dist} Summary: Wrapper that runs Kevin's package-manager via Nix flake @@ -77,6 +77,9 @@ echo ">>> package-manager removed. Nix itself was not removed." /usr/lib/package-manager/ %changelog +* Tue Dec 09 2025 Kevin Veen-Birkenbach - 0.7.10-1 +- Fixed test_install_pkgmgr_shallow.py + * Tue Dec 09 2025 Kevin Veen-Birkenbach - 0.7.9-1 - 'main' and 'master' are now both accepted as branches for branch close merge diff --git a/pyproject.toml b/pyproject.toml index 2a67d77..0f61dd6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta" [project] name = "package-manager" -version = "0.7.9" +version = "0.7.10" description = "Kevin's package-manager tool (pkgmgr)" readme = "README.md" requires-python = ">=3.11" diff --git a/scripts/installation/centos/dependencies.sh b/scripts/installation/centos/dependencies.sh index bc9aab1..c6eda13 100755 --- a/scripts/installation/centos/dependencies.sh +++ b/scripts/installation/centos/dependencies.sh @@ -13,6 +13,7 @@ dnf -y install \ bash \ curl-minimal \ ca-certificates \ + sudo \ xz dnf clean all diff --git a/tests/e2e/test_install_pkgmgr_shallow.py b/tests/e2e/test_install_pkgmgr_shallow.py index e41a1bc..c5c9778 100644 --- a/tests/e2e/test_install_pkgmgr_shallow.py +++ b/tests/e2e/test_install_pkgmgr_shallow.py @@ -35,8 +35,8 @@ def remove_pkgmgr_from_nix_profile() -> None: prints a descriptive format without an index column inside the container. Instead, we directly try to remove possible names: - - 'pkgmgr' (the actual name shown in `nix profile list`) - - 'package-manager' (the name mentioned in Nix's own error hints) + - 'pkgmgr' + - 'package-manager' """ for spec in ("pkgmgr", "package-manager"): subprocess.run( @@ -45,18 +45,34 @@ def remove_pkgmgr_from_nix_profile() -> None: ) +def configure_git_safe_directory() -> None: + """ + Configure Git to treat /src as a safe directory. + + Needed because /src is a bind-mounted repository in CI, often owned by a + different UID. Modern Git aborts with: + 'fatal: detected dubious ownership in repository at /src/.git' + + This fix applies ONLY inside this test container. + """ + try: + subprocess.run( + ["git", "config", "--global", "--add", "safe.directory", "/src"], + check=False, + ) + except FileNotFoundError: + print("[WARN] git not found – skipping safe.directory configuration") + + def pkgmgr_help_debug() -> None: """ Run `pkgmgr --help` after installation *inside an interactive bash shell*, print its output and return code, but never fail the test. - Reason: - - The installer adds venv/alias setup into shell rc files (~/.bashrc, ~/.zshrc) - - Those changes are only applied in a new interactive shell session. + This ensures the installer’s shell RC changes are actually loaded. """ print("\n--- PKGMGR HELP (after installation, via bash -i) ---") - # Simulate a fresh interactive bash, so ~/.bashrc gets sourced proc = subprocess.run( ["bash", "-i", "-c", "pkgmgr --help"], capture_output=True, @@ -76,10 +92,6 @@ def pkgmgr_help_debug() -> None: print(f"returncode: {proc.returncode}") print("--- END ---\n") - # Important: this is **debug-only**. Do NOT fail the test here. - # If you ever want to hard-assert on this, you can add an explicit - # assertion in the test method instead of here. - class TestIntegrationInstalPKGMGRShallow(unittest.TestCase): def test_install_pkgmgr_self_install(self) -> None: @@ -87,12 +99,8 @@ class TestIntegrationInstalPKGMGRShallow(unittest.TestCase): End-to-end test that runs "python main.py install pkgmgr ..." inside the test container. - We isolate HOME into /tmp/pkgmgr-self-install so that: - - ~/.config/pkgmgr points to an isolated test config area - - ~/Repositories is owned by the current user inside the container - (avoiding Nix's 'repository path is not owned by current user' error) + HOME is isolated to avoid permission problems with Nix & repositories. """ - # Use a dedicated HOME for this test to avoid permission/ownership issues temp_home = "/tmp/pkgmgr-self-install" os.makedirs(temp_home, exist_ok=True) @@ -103,20 +111,24 @@ class TestIntegrationInstalPKGMGRShallow(unittest.TestCase): # Isolate HOME so that ~ expands to /tmp/pkgmgr-self-install os.environ["HOME"] = temp_home - # Optional: ensure XDG_* also use the temp HOME for extra isolation + # Optional XDG override for a fully isolated environment os.environ.setdefault("XDG_CONFIG_HOME", os.path.join(temp_home, ".config")) os.environ.setdefault("XDG_CACHE_HOME", os.path.join(temp_home, ".cache")) os.environ.setdefault("XDG_DATA_HOME", os.path.join(temp_home, ".local", "share")) + # 🔧 IMPORTANT FIX: allow Git to access /src safely + configure_git_safe_directory() + # Debug before cleanup nix_profile_list_debug("BEFORE CLEANUP") - # Cleanup: aggressively try to drop any pkgmgr/profile entries + # Cleanup: drop any pkgmgr entries from nix profile remove_pkgmgr_from_nix_profile() # Debug after cleanup nix_profile_list_debug("AFTER CLEANUP") + # Prepare argv for module execution sys.argv = [ "python", "install", @@ -126,15 +138,15 @@ class TestIntegrationInstalPKGMGRShallow(unittest.TestCase): "--no-verification", ] - # Run installation via main.py + # Execute installation via main.py runpy.run_module("main", run_name="__main__") - # After successful installation: run `pkgmgr --help` for debug + # Debug: interactive shell test pkgmgr_help_debug() finally: + # Restore system state sys.argv = original_argv - # Restore full environment os.environ.clear() os.environ.update(original_environ)