Compare commits
17 Commits
v0.9.1
...
eeda944b73
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eeda944b73 | ||
|
|
52cfbebba4 | ||
|
|
f4385807f1 | ||
|
|
e9e083c9dd | ||
|
|
3218b2b39f | ||
|
|
ba296a79c9 | ||
|
|
62e05e2f5b | ||
|
|
77d8b68ba5 | ||
|
|
bb0a801396 | ||
|
|
ee968efc4b | ||
|
|
644b2b8fa0 | ||
|
|
0f74907f82 | ||
|
|
5a8b1b11de | ||
|
|
389ec40163 | ||
|
|
1d03055491 | ||
|
|
7775c6d974 | ||
|
|
a24a819511 |
@@ -25,7 +25,5 @@ venv/
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
||||||
# Arch pkg artifacts
|
# Logs
|
||||||
*.pkg.tar.*
|
*.log
|
||||||
*.log
|
|
||||||
package-manager-*
|
|
||||||
26
.github/workflows/ci.yml
vendored
Normal file
26
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches-ignore:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-unit:
|
||||||
|
uses: ./.github/workflows/test-unit.yml
|
||||||
|
|
||||||
|
test-integration:
|
||||||
|
uses: ./.github/workflows/test-integration.yml
|
||||||
|
|
||||||
|
test-container:
|
||||||
|
uses: ./.github/workflows/test-container.yml
|
||||||
|
|
||||||
|
test-e2e:
|
||||||
|
uses: ./.github/workflows/test-e2e.yml
|
||||||
|
|
||||||
|
test-virgin-user:
|
||||||
|
uses: ./.github/workflows/test-virgin-user.yml
|
||||||
|
|
||||||
|
test-virgin-root:
|
||||||
|
uses: ./.github/workflows/test-virgin-root.yml
|
||||||
64
.github/workflows/mark-stable.yml
vendored
Normal file
64
.github/workflows/mark-stable.yml
vendored
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
name: Mark stable commit
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-unit:
|
||||||
|
uses: ./.github/workflows/test-unit.yml
|
||||||
|
|
||||||
|
test-integration:
|
||||||
|
uses: ./.github/workflows/test-integration.yml
|
||||||
|
|
||||||
|
test-container:
|
||||||
|
uses: ./.github/workflows/test-container.yml
|
||||||
|
|
||||||
|
test-e2e:
|
||||||
|
uses: ./.github/workflows/test-e2e.yml
|
||||||
|
|
||||||
|
test-virgin-user:
|
||||||
|
uses: ./.github/workflows/test-virgin-user.yml
|
||||||
|
|
||||||
|
test-virgin-root:
|
||||||
|
uses: ./.github/workflows/test-virgin-root.yml
|
||||||
|
|
||||||
|
mark-stable:
|
||||||
|
needs:
|
||||||
|
- test-unit
|
||||||
|
- test-integration
|
||||||
|
- test-container
|
||||||
|
- test-e2e
|
||||||
|
- test-virgin-user
|
||||||
|
- test-virgin-root
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write # to move the tag
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Move 'stable' tag to this commit
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
|
echo "Tagging commit $GITHUB_SHA as stable…"
|
||||||
|
|
||||||
|
# delete local tag if exists
|
||||||
|
git tag -d stable 2>/dev/null || true
|
||||||
|
# delete remote tag if exists
|
||||||
|
git push origin :refs/tags/stable || true
|
||||||
|
|
||||||
|
# create new tag on this commit
|
||||||
|
git tag stable "$GITHUB_SHA"
|
||||||
|
git push origin stable
|
||||||
|
|
||||||
|
echo "✅ Stable tag updated."
|
||||||
8
.github/workflows/test-container.yml
vendored
8
.github/workflows/test-container.yml
vendored
@@ -1,13 +1,7 @@
|
|||||||
name: Test OS Containers
|
name: Test OS Containers
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_call:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
- "*"
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-container:
|
test-container:
|
||||||
|
|||||||
8
.github/workflows/test-e2e.yml
vendored
8
.github/workflows/test-e2e.yml
vendored
@@ -1,13 +1,7 @@
|
|||||||
name: Test End-To-End
|
name: Test End-To-End
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_call:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
- "*"
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-e2e:
|
test-e2e:
|
||||||
|
|||||||
8
.github/workflows/test-integration.yml
vendored
8
.github/workflows/test-integration.yml
vendored
@@ -1,13 +1,7 @@
|
|||||||
name: Test Code Integration
|
name: Test Code Integration
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_call:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
- "*"
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-integration:
|
test-integration:
|
||||||
|
|||||||
8
.github/workflows/test-unit.yml
vendored
8
.github/workflows/test-unit.yml
vendored
@@ -1,13 +1,7 @@
|
|||||||
name: Test Units
|
name: Test Units
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_call:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
- "*"
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-unit:
|
test-unit:
|
||||||
|
|||||||
8
.github/workflows/test-virgin-root.yml
vendored
8
.github/workflows/test-virgin-root.yml
vendored
@@ -1,13 +1,7 @@
|
|||||||
name: Test Virgin Root
|
name: Test Virgin Root
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_call:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
- "*"
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-virgin-root:
|
test-virgin-root:
|
||||||
|
|||||||
8
.github/workflows/test-virgin-user.yml
vendored
8
.github/workflows/test-virgin-user.yml
vendored
@@ -1,13 +1,7 @@
|
|||||||
name: Test Virgin User
|
name: Test Virgin User
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_call:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
- "*"
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-virgin-user:
|
test-virgin-user:
|
||||||
|
|||||||
12
.gitignore
vendored
12
.gitignore
vendored
@@ -14,17 +14,8 @@ venv/
|
|||||||
dist/
|
dist/
|
||||||
build/*
|
build/*
|
||||||
*.egg-info/
|
*.egg-info/
|
||||||
pkg
|
|
||||||
src/source
|
|
||||||
package-manager-*
|
package-manager-*
|
||||||
|
|
||||||
# debian
|
|
||||||
debian/package-manager/
|
|
||||||
debian/debhelper-build-stamp
|
|
||||||
debian/files
|
|
||||||
debian/.debhelper/
|
|
||||||
debian/package-manager.substvars
|
|
||||||
|
|
||||||
# Editor files
|
# Editor files
|
||||||
.vscode/
|
.vscode/
|
||||||
.idea/
|
.idea/
|
||||||
@@ -35,6 +26,9 @@ Thumbs.db
|
|||||||
|
|
||||||
# Nix Cache to speed up tests
|
# Nix Cache to speed up tests
|
||||||
.nix/
|
.nix/
|
||||||
|
.nix-dev-installed
|
||||||
|
|
||||||
# Ignore logs
|
# Ignore logs
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
|
result
|
||||||
@@ -31,7 +31,7 @@ installation layers, and setup controller flow:
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
**Diagram status:** *Stand: 10. Dezember 2025*
|
**Diagram status:** *Stand: 11. Dezember 2025*
|
||||||
**Always-up-to-date version:** https://s.veen.world/pkgmgrmp
|
**Always-up-to-date version:** https://s.veen.world/pkgmgrmp
|
||||||
|
|
||||||
## Installation ⚙️
|
## Installation ⚙️
|
||||||
|
|||||||
7
TODO.md
Normal file
7
TODO.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# to-dos
|
||||||
|
|
||||||
|
For the following checkout the implementation map:
|
||||||
|
|
||||||
|
- Implement TAGS
|
||||||
|
- Implement MIRROR
|
||||||
|
- Implement SIGNING_KEY
|
||||||
BIN
assets/map.png
BIN
assets/map.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1765186076,
|
||||||
|
"narHash": "sha256-hM20uyap1a0M9d344I692r+ik4gTMyj60cQWO+hAYP8=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "addf7cf5f383a3101ecfba091b98d0a1263dc9b8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
33
flake.nix
33
flake.nix
@@ -26,6 +26,11 @@
|
|||||||
packages = forAllSystems (system:
|
packages = forAllSystems (system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
|
||||||
|
# Single source of truth for pkgmgr: Python 3.11
|
||||||
|
# - Matches pyproject.toml: requires-python = ">=3.11"
|
||||||
|
# - Uses python311Packages so that PyYAML etc. are available
|
||||||
|
python = pkgs.python311;
|
||||||
pyPkgs = pkgs.python311Packages;
|
pyPkgs = pkgs.python311Packages;
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
@@ -45,7 +50,7 @@
|
|||||||
pyPkgs.wheel
|
pyPkgs.wheel
|
||||||
];
|
];
|
||||||
|
|
||||||
# Runtime dependencies (matches [project.dependencies])
|
# Runtime dependencies (matches [project.dependencies] in pyproject.toml)
|
||||||
propagatedBuildInputs = [
|
propagatedBuildInputs = [
|
||||||
pyPkgs.pyyaml
|
pyPkgs.pyyaml
|
||||||
pyPkgs.pip
|
pyPkgs.pip
|
||||||
@@ -55,6 +60,7 @@
|
|||||||
|
|
||||||
pythonImportsCheck = [ "pkgmgr" ];
|
pythonImportsCheck = [ "pkgmgr" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
default = pkgmgr;
|
default = pkgmgr;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -65,29 +71,42 @@
|
|||||||
devShells = forAllSystems (system:
|
devShells = forAllSystems (system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
pkgmgrPkg = self.packages.${system}.pkgmgr;
|
|
||||||
|
|
||||||
ansiblePkg =
|
ansiblePkg =
|
||||||
if pkgs ? ansible-core then pkgs.ansible-core
|
if pkgs ? ansible-core then pkgs.ansible-core
|
||||||
else pkgs.ansible;
|
else pkgs.ansible;
|
||||||
|
|
||||||
# Python 3 + pip für alles, was "python3 -m pip" macht
|
# Use the same Python version as the package (3.11)
|
||||||
pythonWithPip = pkgs.python3.withPackages (ps: [
|
python = pkgs.python311;
|
||||||
|
|
||||||
|
pythonWithDeps = python.withPackages (ps: [
|
||||||
ps.pip
|
ps.pip
|
||||||
|
ps.pyyaml
|
||||||
]);
|
]);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
pythonWithPip
|
pythonWithDeps
|
||||||
pkgmgrPkg
|
|
||||||
pkgs.git
|
pkgs.git
|
||||||
ansiblePkg
|
ansiblePkg
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
# Ensure our Python with dependencies is preferred on PATH
|
||||||
|
export PATH=${pythonWithDeps}/bin:$PATH
|
||||||
|
|
||||||
|
# Ensure src/ layout is importable:
|
||||||
|
# pkgmgr lives in ./src/pkgmgr
|
||||||
|
export PYTHONPATH="$PWD/src:${PYTHONPATH:-}"
|
||||||
|
# Also add repo root in case tools/tests rely on it
|
||||||
|
export PYTHONPATH="$PWD:$PYTHONPATH"
|
||||||
|
|
||||||
echo "Entered pkgmgr development shell for ${system}"
|
echo "Entered pkgmgr development shell for ${system}"
|
||||||
echo "pkgmgr CLI is available via the flake build"
|
echo "Python used in this shell:"
|
||||||
|
python --version
|
||||||
|
echo "pkgmgr CLI (from source) is available via:"
|
||||||
|
echo " python -m pkgmgr.cli --help"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
10
main.py
10
main.py
@@ -1,6 +1,14 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Ensure local src/ overrides installed package
|
||||||
|
ROOT = Path(__file__).resolve().parent
|
||||||
|
SRC = ROOT / "src"
|
||||||
|
if SRC.is_dir():
|
||||||
|
sys.path.insert(0, str(SRC))
|
||||||
|
|
||||||
from pkgmgr.cli import main
|
from pkgmgr.cli import main
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
6
packaging/arch/.gitignore
vendored
Normal file
6
packaging/arch/.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Arch pkg artifacts
|
||||||
|
*.pkg.tar.*
|
||||||
|
*.log
|
||||||
|
package-manager-*
|
||||||
|
src/
|
||||||
|
pkg/
|
||||||
@@ -15,7 +15,7 @@ makedepends=('rsync')
|
|||||||
install=${pkgname}.install
|
install=${pkgname}.install
|
||||||
|
|
||||||
# Local source checkout — avoids the tarball requirement.
|
# Local source checkout — avoids the tarball requirement.
|
||||||
# This assumes you build the package from inside the main project repository.
|
# We build from the project root (two levels above packaging/arch/).
|
||||||
source=()
|
source=()
|
||||||
sha256sums=()
|
sha256sums=()
|
||||||
|
|
||||||
@@ -24,12 +24,18 @@ _srcdir_name="source"
|
|||||||
|
|
||||||
prepare() {
|
prepare() {
|
||||||
mkdir -p "$srcdir/$_srcdir_name"
|
mkdir -p "$srcdir/$_srcdir_name"
|
||||||
|
|
||||||
|
local project_root
|
||||||
|
project_root="$(cd "$startdir/../.." && pwd)"
|
||||||
|
|
||||||
rsync -a \
|
rsync -a \
|
||||||
--exclude=".git" \
|
--exclude=".git" \
|
||||||
--exclude=".github" \
|
--exclude=".github" \
|
||||||
--exclude="pkg" \
|
--exclude="pkg" \
|
||||||
--exclude="srcpkg" \
|
--exclude="srcpkg" \
|
||||||
"$startdir/" "$srcdir/$_srcdir_name/"
|
--exclude="packaging" \
|
||||||
|
--exclude="assets" \
|
||||||
|
"$project_root/" "$srcdir/$_srcdir_name/"
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
@@ -62,7 +68,8 @@ package() {
|
|||||||
"$pkgdir/usr/lib/package-manager/PKGBUILD" \
|
"$pkgdir/usr/lib/package-manager/PKGBUILD" \
|
||||||
"$pkgdir/usr/lib/package-manager/Dockerfile" \
|
"$pkgdir/usr/lib/package-manager/Dockerfile" \
|
||||||
"$pkgdir/usr/lib/package-manager/debian" \
|
"$pkgdir/usr/lib/package-manager/debian" \
|
||||||
|
"$pkgdir/usr/lib/package-manager/packaging" \
|
||||||
"$pkgdir/usr/lib/package-manager/.gitignore" \
|
"$pkgdir/usr/lib/package-manager/.gitignore" \
|
||||||
"$pkgdir/usr/lib/package-manager/__pycache__" \
|
"$pkgdir/usr/lib/package-manager/__pycache__" \
|
||||||
"$pkgdir/usr/lib/package-manager/.gitkeep"
|
"$pkgdir/usr/lib/package-manager/.gitkeep" || true
|
||||||
}
|
}
|
||||||
6
packaging/debian/.gitignore
vendored
Normal file
6
packaging/debian/.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# debian
|
||||||
|
package-manager/
|
||||||
|
debhelper-build-stamp
|
||||||
|
files
|
||||||
|
.debhelper/
|
||||||
|
package-manager.substvars
|
||||||
@@ -39,13 +39,13 @@ pkgmgr = "pkgmgr.cli:main"
|
|||||||
# -----------------------------
|
# -----------------------------
|
||||||
# setuptools configuration
|
# setuptools configuration
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# We use find_packages(), not a fixed list,
|
# Source layout: all packages live under "src/"
|
||||||
# and explicitly include pkgmgr* and config*
|
[tool.setuptools]
|
||||||
|
package-dir = { "" = "src", "config" = "config" }
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
where = ["."]
|
where = ["src", "."]
|
||||||
include = ["pkgmgr*", "config*"]
|
include = ["pkgmgr*", "config*"]
|
||||||
|
|
||||||
# Ensure defaults.yaml is shipped inside wheels & nix builds
|
|
||||||
[tool.setuptools.package-data]
|
[tool.setuptools.package-data]
|
||||||
"config" = ["defaults.yaml"]
|
"config" = ["defaults.yaml"]
|
||||||
|
|||||||
@@ -3,10 +3,21 @@ set -euo pipefail
|
|||||||
|
|
||||||
echo "[arch/package] Building Arch package (makepkg --nodeps)..."
|
echo "[arch/package] Building Arch package (makepkg --nodeps)..."
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)"
|
||||||
|
PKG_DIR="${PROJECT_ROOT}/packaging/arch"
|
||||||
|
|
||||||
|
if [[ ! -f "${PKG_DIR}/PKGBUILD" ]]; then
|
||||||
|
echo "[arch/package] ERROR: PKGBUILD not found in ${PKG_DIR}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "${PKG_DIR}"
|
||||||
|
|
||||||
if id aur_builder >/dev/null 2>&1; then
|
if id aur_builder >/dev/null 2>&1; then
|
||||||
echo "[arch/package] Using 'aur_builder' user for makepkg..."
|
echo "[arch/package] Using 'aur_builder' user for makepkg..."
|
||||||
chown -R aur_builder:aur_builder "$(pwd)"
|
chown -R aur_builder:aur_builder "${PKG_DIR}"
|
||||||
su aur_builder -c "cd '$(pwd)' && rm -f package-manager-*.pkg.tar.* && makepkg --noconfirm --clean --nodeps"
|
su aur_builder -c "cd '${PKG_DIR}' && rm -f package-manager-*.pkg.tar.* && makepkg --noconfirm --clean --nodeps"
|
||||||
else
|
else
|
||||||
echo "[arch/package] WARNING: user 'aur_builder' not found, running makepkg as current user..."
|
echo "[arch/package] WARNING: user 'aur_builder' not found, running makepkg as current user..."
|
||||||
rm -f package-manager-*.pkg.tar.*
|
rm -f package-manager-*.pkg.tar.*
|
||||||
|
|||||||
@@ -4,8 +4,17 @@ set -euo pipefail
|
|||||||
echo "[centos/package] Setting up rpmbuild directories..."
|
echo "[centos/package] Setting up rpmbuild directories..."
|
||||||
mkdir -p /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
mkdir -p /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)"
|
||||||
|
SPEC_PATH="${PROJECT_ROOT}/packaging/fedora/package-manager.spec"
|
||||||
|
|
||||||
|
if [[ ! -f "${SPEC_PATH}" ]]; then
|
||||||
|
echo "[centos/package] ERROR: SPEC file not found: ${SPEC_PATH}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[centos/package] Extracting version from package-manager.spec..."
|
echo "[centos/package] Extracting version from package-manager.spec..."
|
||||||
version="$(grep -E '^Version:' package-manager.spec | awk '{print $2}')"
|
version="$(grep -E '^Version:' "${SPEC_PATH}" | awk '{print $2}')"
|
||||||
if [[ -z "${version}" ]]; then
|
if [[ -z "${version}" ]]; then
|
||||||
echo "ERROR: Version missing!"
|
echo "ERROR: Version missing!"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -15,13 +24,13 @@ srcdir="package-manager-${version}"
|
|||||||
echo "[centos/package] Preparing source tree: ${srcdir}"
|
echo "[centos/package] Preparing source tree: ${srcdir}"
|
||||||
rm -rf "/tmp/${srcdir}"
|
rm -rf "/tmp/${srcdir}"
|
||||||
mkdir -p "/tmp/${srcdir}"
|
mkdir -p "/tmp/${srcdir}"
|
||||||
cp -a . "/tmp/${srcdir}/"
|
cp -a "${PROJECT_ROOT}/." "/tmp/${srcdir}/"
|
||||||
|
|
||||||
echo "[centos/package] Creating source tarball..."
|
echo "[centos/package] Creating source tarball..."
|
||||||
tar czf "/root/rpmbuild/SOURCES/${srcdir}.tar.gz" -C /tmp "${srcdir}"
|
tar czf "/root/rpmbuild/SOURCES/${srcdir}.tar.gz" -C /tmp "${srcdir}"
|
||||||
|
|
||||||
echo "[centos/package] Copying SPEC..."
|
echo "[centos/package] Copying SPEC..."
|
||||||
cp package-manager.spec /root/rpmbuild/SPECS/
|
cp "${SPEC_PATH}" /root/rpmbuild/SPECS/
|
||||||
|
|
||||||
echo "[centos/package] Running rpmbuild..."
|
echo "[centos/package] Running rpmbuild..."
|
||||||
cd /root/rpmbuild/SPECS
|
cd /root/rpmbuild/SPECS
|
||||||
|
|||||||
@@ -3,6 +3,25 @@ set -euo pipefail
|
|||||||
|
|
||||||
echo "[debian/package] Building Debian package..."
|
echo "[debian/package] Building Debian package..."
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)"
|
||||||
|
|
||||||
|
BUILD_ROOT="/tmp/package-manager-debian-build"
|
||||||
|
rm -rf "${BUILD_ROOT}"
|
||||||
|
mkdir -p "${BUILD_ROOT}"
|
||||||
|
|
||||||
|
echo "[debian/package] Syncing project sources to ${BUILD_ROOT}..."
|
||||||
|
rsync -a \
|
||||||
|
--exclude 'packaging/debian' \
|
||||||
|
"${PROJECT_ROOT}/" "${BUILD_ROOT}/"
|
||||||
|
|
||||||
|
echo "[debian/package] Overlaying debian/ metadata from packaging/debian..."
|
||||||
|
mkdir -p "${BUILD_ROOT}/debian"
|
||||||
|
cp -a "${PROJECT_ROOT}/packaging/debian/." "${BUILD_ROOT}/debian/"
|
||||||
|
|
||||||
|
cd "${BUILD_ROOT}"
|
||||||
|
|
||||||
|
echo "[debian/package] Running dpkg-buildpackage..."
|
||||||
dpkg-buildpackage -us -uc -b
|
dpkg-buildpackage -us -uc -b
|
||||||
|
|
||||||
echo "[debian/package] Installing generated DEB package..."
|
echo "[debian/package] Installing generated DEB package..."
|
||||||
|
|||||||
@@ -4,8 +4,17 @@ set -euo pipefail
|
|||||||
echo "[fedora/package] Setting up rpmbuild directories..."
|
echo "[fedora/package] Setting up rpmbuild directories..."
|
||||||
mkdir -p /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
mkdir -p /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)"
|
||||||
|
SPEC_PATH="${PROJECT_ROOT}/packaging/fedora/package-manager.spec"
|
||||||
|
|
||||||
|
if [[ ! -f "${SPEC_PATH}" ]]; then
|
||||||
|
echo "[fedora/package] ERROR: SPEC file not found: ${SPEC_PATH}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[fedora/package] Extracting version from package-manager.spec..."
|
echo "[fedora/package] Extracting version from package-manager.spec..."
|
||||||
version="$(grep -E '^Version:' package-manager.spec | awk '{print $2}')"
|
version="$(grep -E '^Version:' "${SPEC_PATH}" | awk '{print $2}')"
|
||||||
if [[ -z "${version}" ]]; then
|
if [[ -z "${version}" ]]; then
|
||||||
echo "ERROR: Version missing!"
|
echo "ERROR: Version missing!"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -15,13 +24,13 @@ srcdir="package-manager-${version}"
|
|||||||
echo "[fedora/package] Preparing source tree: ${srcdir}"
|
echo "[fedora/package] Preparing source tree: ${srcdir}"
|
||||||
rm -rf "/tmp/${srcdir}"
|
rm -rf "/tmp/${srcdir}"
|
||||||
mkdir -p "/tmp/${srcdir}"
|
mkdir -p "/tmp/${srcdir}"
|
||||||
cp -a . "/tmp/${srcdir}/"
|
cp -a "${PROJECT_ROOT}/." "/tmp/${srcdir}/"
|
||||||
|
|
||||||
echo "[fedora/package] Creating source tarball..."
|
echo "[fedora/package] Creating source tarball..."
|
||||||
tar czf "/root/rpmbuild/SOURCES/${srcdir}.tar.gz" -C /tmp "${srcdir}"
|
tar czf "/root/rpmbuild/SOURCES/${srcdir}.tar.gz" -C /tmp "${srcdir}"
|
||||||
|
|
||||||
echo "[fedora/package] Copying SPEC..."
|
echo "[fedora/package] Copying SPEC..."
|
||||||
cp package-manager.spec /root/rpmbuild/SPECS/
|
cp "${SPEC_PATH}" /root/rpmbuild/SPECS/
|
||||||
|
|
||||||
echo "[fedora/package] Running rpmbuild..."
|
echo "[fedora/package] Running rpmbuild..."
|
||||||
cd /root/rpmbuild/SPECS
|
cd /root/rpmbuild/SPECS
|
||||||
|
|||||||
@@ -3,6 +3,25 @@ set -euo pipefail
|
|||||||
|
|
||||||
echo "[ubuntu/package] Building Ubuntu (Debian-style) package..."
|
echo "[ubuntu/package] Building Ubuntu (Debian-style) package..."
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)"
|
||||||
|
|
||||||
|
BUILD_ROOT="/tmp/package-manager-ubuntu-build"
|
||||||
|
rm -rf "${BUILD_ROOT}"
|
||||||
|
mkdir -p "${BUILD_ROOT}"
|
||||||
|
|
||||||
|
echo "[ubuntu/package] Syncing project sources to ${BUILD_ROOT}..."
|
||||||
|
rsync -a \
|
||||||
|
--exclude 'packaging/debian' \
|
||||||
|
"${PROJECT_ROOT}/" "${BUILD_ROOT}/"
|
||||||
|
|
||||||
|
echo "[ubuntu/package] Overlaying debian/ metadata from packaging/debian..."
|
||||||
|
mkdir -p "${BUILD_ROOT}/debian"
|
||||||
|
cp -a "${PROJECT_ROOT}/packaging/debian/." "${BUILD_ROOT}/debian/"
|
||||||
|
|
||||||
|
cd "${BUILD_ROOT}"
|
||||||
|
|
||||||
|
echo "[ubuntu/package] Running dpkg-buildpackage..."
|
||||||
dpkg-buildpackage -us -uc -b
|
dpkg-buildpackage -us -uc -b
|
||||||
|
|
||||||
echo "[ubuntu/package] Installing generated DEB package..."
|
echo "[ubuntu/package] Installing generated DEB package..."
|
||||||
|
|||||||
@@ -10,24 +10,24 @@ for distro in $DISTROS; do
|
|||||||
|
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v "$(pwd):/src" \
|
-v "$(pwd):/src" \
|
||||||
-v pkgmgr_nix_store_${distro}:/nix \
|
-v "pkgmgr_nix_store_${distro}:/nix" \
|
||||||
-v "pkgmgr_nix_cache_${distro}:/root/.cache/nix" \
|
-v "pkgmgr_nix_cache_${distro}:/root/.cache/nix" \
|
||||||
-e PKGMGR_DEV=1 \
|
-e PKGMGR_DEV=1 \
|
||||||
-e TEST_PATTERN="${TEST_PATTERN}" \
|
-e TEST_PATTERN="${TEST_PATTERN}" \
|
||||||
--workdir /src \
|
--workdir /src \
|
||||||
--entrypoint bash \
|
--entrypoint bash \
|
||||||
"package-manager-test-$distro" \
|
"package-manager-test-${distro}" \
|
||||||
-c '
|
-c '
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
# Load distro info
|
# Load distro info
|
||||||
if [ -f /etc/os-release ]; then
|
if [ -f /etc/os-release ]; then
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Running tests inside distro: $ID"
|
echo "Running tests inside distro: ${ID:-unknown}"
|
||||||
|
|
||||||
# Load nix environment if available
|
# Load Nix environment if available
|
||||||
if [ -f "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh" ]; then
|
if [ -f "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh" ]; then
|
||||||
. "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh"
|
. "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh"
|
||||||
fi
|
fi
|
||||||
@@ -43,8 +43,18 @@ for distro in $DISTROS; do
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Mark the mounted repository as safe to avoid Git ownership errors
|
# Mark the mounted repository as safe to avoid Git ownership errors.
|
||||||
git config --global --add safe.directory /src || true
|
# Newer Git (e.g. on Ubuntu) complains about the gitdir (/src/.git),
|
||||||
|
# older versions about the worktree (/src). Nix turns "." into the
|
||||||
|
# flake input "git+file:///src", which then uses Git under the hood.
|
||||||
|
if command -v git >/dev/null 2>&1; then
|
||||||
|
# Worktree path
|
||||||
|
git config --global --add safe.directory /src || true
|
||||||
|
# Gitdir path shown in the "dubious ownership" error
|
||||||
|
git config --global --add safe.directory /src/.git || true
|
||||||
|
# Ephemeral CI containers: allow all paths as a last resort
|
||||||
|
git config --global --add safe.directory '*' || true
|
||||||
|
fi
|
||||||
|
|
||||||
# Run the E2E tests inside the Nix development shell
|
# Run the E2E tests inside the Nix development shell
|
||||||
nix develop .#default --no-write-lock-file -c \
|
nix develop .#default --no-write-lock-file -c \
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ docker run --rm \
|
|||||||
set -e;
|
set -e;
|
||||||
git config --global --add safe.directory /src || true;
|
git config --global --add safe.directory /src || true;
|
||||||
nix develop .#default --no-write-lock-file -c \
|
nix develop .#default --no-write-lock-file -c \
|
||||||
python -m unittest discover \
|
python3 -m unittest discover \
|
||||||
-s tests/integration \
|
-s tests/integration \
|
||||||
-t /src \
|
-t /src \
|
||||||
-p "$TEST_PATTERN";
|
-p "$TEST_PATTERN";
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ docker run --rm \
|
|||||||
set -e;
|
set -e;
|
||||||
git config --global --add safe.directory /src || true;
|
git config --global --add safe.directory /src || true;
|
||||||
nix develop .#default --no-write-lock-file -c \
|
nix develop .#default --no-write-lock-file -c \
|
||||||
python -m unittest discover \
|
python3 -m unittest discover \
|
||||||
-s tests/unit \
|
-s tests/unit \
|
||||||
-t /src \
|
-t /src \
|
||||||
-p "$TEST_PATTERN";
|
-p "$TEST_PATTERN";
|
||||||
|
|||||||
36
src/pkgmgr/__init__.py
Normal file
36
src/pkgmgr/__init__.py
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
"""
|
||||||
|
Top-level pkgmgr package.
|
||||||
|
|
||||||
|
We deliberately avoid importing heavy submodules (like the CLI)
|
||||||
|
on import to keep unit tests fast and to not require optional
|
||||||
|
dependencies (like PyYAML) unless they are actually used.
|
||||||
|
|
||||||
|
Accessing ``pkgmgr.cli`` will load the CLI module lazily via
|
||||||
|
``__getattr__``. This keeps patterns like
|
||||||
|
|
||||||
|
from pkgmgr import cli
|
||||||
|
|
||||||
|
working as expected in tests and entry points.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from importlib import import_module
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
__all__ = ["cli"]
|
||||||
|
|
||||||
|
|
||||||
|
def __getattr__(name: str) -> Any:
|
||||||
|
"""
|
||||||
|
Lazily expose ``pkgmgr.cli`` as attribute on the top-level package.
|
||||||
|
|
||||||
|
This keeps ``import pkgmgr`` lightweight while still allowing
|
||||||
|
``from pkgmgr import cli`` in tests and entry points.
|
||||||
|
"""
|
||||||
|
if name == "cli":
|
||||||
|
return import_module("pkgmgr.cli")
|
||||||
|
raise AttributeError(f"module 'pkgmgr' has no attribute {name!r}")
|
||||||
@@ -197,13 +197,8 @@ def _load_layer_dir(
|
|||||||
|
|
||||||
def _load_defaults_from_package_or_project() -> Dict[str, Any]:
|
def _load_defaults_from_package_or_project() -> Dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
Fallback: Versuche Defaults aus dem installierten Paket ODER
|
Fallback: load default configs from various possible install or development
|
||||||
aus dem Projekt-Root zu laden:
|
layouts (pip-installed, editable install, source repo with src/ layout).
|
||||||
|
|
||||||
<pkg_root>/config_defaults
|
|
||||||
<pkg_root>/config
|
|
||||||
<project_root>/config_defaults
|
|
||||||
<project_root>/config
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
import pkgmgr # type: ignore
|
import pkgmgr # type: ignore
|
||||||
@@ -211,14 +206,25 @@ def _load_defaults_from_package_or_project() -> Dict[str, Any]:
|
|||||||
return {"directories": {}, "repositories": []}
|
return {"directories": {}, "repositories": []}
|
||||||
|
|
||||||
pkg_root = Path(pkgmgr.__file__).resolve().parent
|
pkg_root = Path(pkgmgr.__file__).resolve().parent
|
||||||
project_root = pkg_root.parent
|
roots = set()
|
||||||
|
|
||||||
candidates = [
|
# Case 1: installed package (site-packages/pkgmgr)
|
||||||
pkg_root / "config_defaults",
|
roots.add(pkg_root)
|
||||||
pkg_root / "config",
|
|
||||||
project_root / "config_defaults",
|
# Case 2: parent directory (site-packages/, src/)
|
||||||
project_root / "config",
|
roots.add(pkg_root.parent)
|
||||||
]
|
|
||||||
|
# Case 3: src-layout during development:
|
||||||
|
# repo_root/src/pkgmgr -> repo_root
|
||||||
|
parent = pkg_root.parent
|
||||||
|
if parent.name == "src":
|
||||||
|
roots.add(parent.parent)
|
||||||
|
|
||||||
|
# Candidate config dirs
|
||||||
|
candidates = []
|
||||||
|
for root in roots:
|
||||||
|
candidates.append(root / "config_defaults")
|
||||||
|
candidates.append(root / "config")
|
||||||
|
|
||||||
for cand in candidates:
|
for cand in candidates:
|
||||||
defaults = _load_layer_dir(cand, skip_filename=None)
|
defaults = _load_layer_dir(cand, skip_filename=None)
|
||||||
@@ -227,7 +233,6 @@ def _load_defaults_from_package_or_project() -> Dict[str, Any]:
|
|||||||
|
|
||||||
return {"directories": {}, "repositories": []}
|
return {"directories": {}, "repositories": []}
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Hauptfunktion
|
# Hauptfunktion
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user