handle failed makepkg call
This commit is contained in:
8
utils.py
8
utils.py
@@ -28,13 +28,17 @@ def import_keys(pkgbuild: str) -> bool:
|
|||||||
def parse_pkgbuild(pkgbuild_file: str) -> dict:
|
def parse_pkgbuild(pkgbuild_file: str) -> dict:
|
||||||
pkgbuild_path = pathlib.Path(pkgbuild_file)
|
pkgbuild_path = pathlib.Path(pkgbuild_file)
|
||||||
os.chdir(pkgbuild_path.parent)
|
os.chdir(pkgbuild_path.parent)
|
||||||
res = subprocess.run(["makepkg", "--printsrcinfo"], check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
res = subprocess.run(["makepkg", "--printsrcinfo"], check=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
os.chdir(sys.path[0])
|
os.chdir(sys.path[0])
|
||||||
|
|
||||||
|
if res.returncode:
|
||||||
|
logging.warning("[PKGBUILD] makekg failed: %s", res.stdout.decode(errors="ignore"))
|
||||||
|
return {}
|
||||||
|
|
||||||
(parsed, errors) = parse_srcinfo(res.stdout.decode(errors="ignore"))
|
(parsed, errors) = parse_srcinfo(res.stdout.decode(errors="ignore"))
|
||||||
|
|
||||||
if errors:
|
if errors:
|
||||||
logging.warning("[PKGBUILD] Failed to parse: %s", pkgbuild_path.name)
|
logging.warning("[PKGBUILD] Failed to parse %s: %s", pkgbuild_path.name, errors)
|
||||||
return {}
|
return {}
|
||||||
return parsed
|
return parsed
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user