forked from semios/semios-packages
38 lines
895 B
Python
38 lines
895 B
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
|
|
)
|