From 5cb41ac8b524ed74eb7508845609c0548eb4526f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zacharias=20Zell=C3=A9n?= Date: Mon, 18 May 2026 15:11:29 +0200 Subject: [PATCH] Updated some stuff trying to get package fetching working --- db.py | 1 + fetch.py | 2 +- main.py | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/db.py b/db.py index 2b80a18..a066817 100644 --- a/db.py +++ b/db.py @@ -12,6 +12,7 @@ def get_package_meta(pkgname: str) -> dict | None: continue meta = _search_db(os.path.join(DB_PATH, dbfile), pkgname) if meta: + meta. return meta return None diff --git a/fetch.py b/fetch.py index 9652b22..4e33b33 100644 --- a/fetch.py +++ b/fetch.py @@ -4,7 +4,7 @@ from pathlib import Path from config import load_config -CACHE_DIR = os.path.expanduser(load_config()["cache_dir"]) +CACHE_DIR = Path(os.path.expanduser(load_config()["cache_dir"])) def fetch_package(meta: dict) -> tuple[Path, Path]: CACHE_DIR.mkdir(parents=True, exist_ok=True) diff --git a/main.py b/main.py index cdfd2fc..fca03ce 100755 --- a/main.py +++ b/main.py @@ -1,5 +1,8 @@ #! /bin/env python import sys +from pathlib import Path +import tarfile + from db import get_package_meta, ensure_db from handoff import delegate_to_pacman from fetch import fetch_package @@ -34,5 +37,19 @@ def install(pkgname: str): # Send to pacman with userman flags + if not _is_userman_pkg(pkg_path): + # Throw it to pacman + print(":: Not Implemeted") + sys.exit(1) + +def _is_userman_pkg(pkg_dir: Path, pkg_name: str) -> bool: + with tarfile.open(pkg_dir, "r") as pkg: + for member in pkg.getmembers(): + parts = member.name.split("/") + if len(parts) != 3 or parts[4] != (pkg_name + ".userman"): + continue + return True + return False + if __name__ == "__main__": main() \ No newline at end of file