Updated some stuff trying to get package fetching working
This commit is contained in:
@@ -12,6 +12,7 @@ def get_package_meta(pkgname: str) -> dict | None:
|
|||||||
continue
|
continue
|
||||||
meta = _search_db(os.path.join(DB_PATH, dbfile), pkgname)
|
meta = _search_db(os.path.join(DB_PATH, dbfile), pkgname)
|
||||||
if meta:
|
if meta:
|
||||||
|
meta.
|
||||||
return meta
|
return meta
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
from config import load_config
|
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]:
|
def fetch_package(meta: dict) -> tuple[Path, Path]:
|
||||||
CACHE_DIR.mkdir(parents=True, exist_ok=True)
|
CACHE_DIR.mkdir(parents=True, exist_ok=True)
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
#! /bin/env python
|
#! /bin/env python
|
||||||
import sys
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
import tarfile
|
||||||
|
|
||||||
from db import get_package_meta, ensure_db
|
from db import get_package_meta, ensure_db
|
||||||
from handoff import delegate_to_pacman
|
from handoff import delegate_to_pacman
|
||||||
from fetch import fetch_package
|
from fetch import fetch_package
|
||||||
@@ -34,5 +37,19 @@ def install(pkgname: str):
|
|||||||
|
|
||||||
# Send to pacman with userman flags
|
# 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__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
Reference in New Issue
Block a user