Files
ports/lib/packie.py
sisungo 5c89842dc0 initial commit
Signed-off-by: sisungo <[email protected]>
2026-08-22 11:41:05 +00:00

47 lines
1.1 KiB
Python

import os
import subprocess
PACKIE_EXEC = os.getenv("PACKIE", "packie")
def host_arch() -> str:
result = subprocess.run(
[PACKIE_EXEC, "print", "profile.host_arch"],
check=True,
capture_output=True,
)
return result.stdout.decode().strip()
def chroot_update(root: str):
subprocess.run([PACKIE_EXEC, "--chroot", root, "update"], check=True)
def chroot_install(root: str, requirements: list[str]):
subprocess.run(
[PACKIE_EXEC, "--chroot", root, "install", "--yes"] + requirements, check=True
)
def update():
subprocess.run([PACKIE_EXEC, "update"], check=True)
def install(requirements: list[str]):
subprocess.run([PACKIE_EXEC, "install", "--yes"] + requirements, check=True)
def repo_add(repo: str, pkgfile: str):
subprocess.run(
[PACKIE_EXEC, "repo-admin", repo, "--add-package", pkgfile], check=True
)
def prefix_of(pkgident: str):
result = subprocess.run(
[PACKIE_EXEC, "print", f"package.prefix.{pkgident}"],
check=True,
capture_output=True,
)
return result.stdout.decode().strip()