summaryrefslogtreecommitdiff
path: root/mdbp
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2022-09-21 11:28:27 +0200
committerHelmut Grohne <helmut@subdivi.de>2022-09-21 11:28:27 +0200
commit3ba0ba8d2c81b4aa816dd003fc4e8f1379c17090 (patch)
tree929a3a9881b159c810bd301052f3838e2c2d280f /mdbp
parentd99d7eb5bcfbcac71b14fa68248eb87b7eb5330f (diff)
downloadmdbp-3ba0ba8d2c81b4aa816dd003fc4e8f1379c17090.tar.gz
mmdebstrap: simplify interface of hook_main
Diffstat (limited to 'mdbp')
-rw-r--r--mdbp/mmdebstrap.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/mdbp/mmdebstrap.py b/mdbp/mmdebstrap.py
index 65a4856..37b6655 100644
--- a/mdbp/mmdebstrap.py
+++ b/mdbp/mmdebstrap.py
@@ -17,8 +17,8 @@ import typing
import debian.debian_support
-from .common import buildjson, clean_dir, compute_env, download_dsc, \
- get_dsc_files, json_load, parse_dsc, profile_option
+from .common import JsonObject, buildjson, clean_dir, compute_env, \
+ download_dsc, get_dsc_files, json_load, parse_dsc, profile_option
libc = ctypes.CDLL(ctypes.util.find_library("c"))
def unshare_network() -> None:
@@ -76,10 +76,8 @@ def build_subdir(dsc: debian.deb822.Dsc) -> str:
assert ver is not None # please mypy
return "%s-%s" % (dsc["Source"], ver)
-def hook_main(buildjsonfilename: str, chrootname: str) -> None:
+def hook_main(build: JsonObject, chroot: pathlib.Path) -> None:
"""The entry point for the --hook-helper invocation run from mmdebstrap."""
- build = json_load(pathlib.Path(buildjsonfilename).open("r"))
- chroot = pathlib.Path(chrootname)
builddir = pathlib.PurePath(build.get("build_path", "/build"))
fullbuilddir = chroot / builddir.relative_to("/")
if "source_package_path" in build["input"]:
@@ -171,7 +169,10 @@ class RawStoreAction(argparse.Action):
def main() -> None:
"""Entry point for mdbp-mmdebstrap backend"""
if len(sys.argv) == 4 and sys.argv[1] == "--hook-helper":
- hook_main(sys.argv[2], sys.argv[3])
+ hook_main(
+ json_load(pathlib.Path(sys.argv[2]).open("r", encoding="utf8")),
+ pathlib.Path(sys.argv[3]),
+ )
return
parser = argparse.ArgumentParser()