This commit is contained in:
Michal Sojka 2024-09-15 12:19:29 +02:00
parent 05d12bc5d0
commit 20504c30f9

View file

@ -163,7 +163,7 @@ def ros2nix(args):
parser.add_argument("--fetch", action="store_true", help="Use fetches like fetchFromGitHub for src attribute. " parser.add_argument("--fetch", action="store_true", help="Use fetches like fetchFromGitHub for src attribute. "
"The fetch function and its parameters are determined from the local git work tree." "The fetch function and its parameters are determined from the local git work tree."
"sourceRoot is set if needed and not overridden by --source-root.") "sourceRoot attribute is set if needed and not overridden by --source-root.")
parser.add_argument( parser.add_argument(
"--distro", "--distro",
default="rolling", default="rolling",
@ -255,7 +255,7 @@ def ros2nix(args):
match = re.match("https://github.com/(?P<owner>[^/]*)/(?P<repo>.*?)(.git)?$", url) match = re.match("https://github.com/(?P<owner>[^/]*)/(?P<repo>.*?)(.git)?$", url)
if match is not None: if match is not None:
kwargs["src_param"] = "fetchFromGitHub"; kwargs["src_param"] = "fetchFromGitHub"
kwargs["src_expr"] = dedent(f''' kwargs["src_expr"] = dedent(f'''
fetchFromGitHub {{ fetchFromGitHub {{
owner = "{match["owner"]}"; owner = "{match["owner"]}";
@ -264,7 +264,7 @@ def ros2nix(args):
sha256 = "{info["sha256"]}"; sha256 = "{info["sha256"]}";
}}''').strip() }}''').strip()
else: else:
kwargs["src_param"] = "fetchgit"; kwargs["src_param"] = "fetchgit"
kwargs["src_expr"] = dedent(f''' kwargs["src_expr"] = dedent(f'''
fetchgit {{ fetchgit {{
url = "{url}"; url = "{url}";
@ -273,8 +273,8 @@ def ros2nix(args):
}}''').strip() }}''').strip()
if prefix: if prefix:
#kwargs["src_expr"] = f'''let fullSrc = {kwargs["src_expr"]}; in "${{fullSrc}}/{prefix}"''' # kwargs["src_expr"] = f'''let fullSrc = {kwargs["src_expr"]}; in "${{fullSrc}}/{prefix}"'''
kwargs["source_root"] = f"${{src.name}}/{prefix}"; kwargs["source_root"] = f"${{src.name}}/{prefix}"
else: else:
if args.output_dir is None: if args.output_dir is None: