From a3e5c888350c2ee3bf987738cca5ed892b1ef4ec Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Mon, 27 Feb 2023 18:21:59 +0900 Subject: [PATCH] Add opt to link "$HOME/.cargo/registry" on build Set "link_cargo_registry = true" in an "[[entry]]" to link "$HOME/.cargo/registry" to the build's chroot. --- update.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/update.py b/update.py index f76658a..88895b8 100755 --- a/update.py +++ b/update.py @@ -1066,6 +1066,12 @@ def update_pkg_list( nowstring = datetime.datetime.now(datetime.timezone.utc).strftime( "%Y-%m-%d_%H-%M-%S_%Z" ) + if "link_cargo_registry" in pkg_state[pkg]: + command_list.insert(2, "-d") + command_list.insert( + 3, + f'{os.environ["HOME"]}/.cargo/registry:/build/.cargo/registry', + ) # log_print(f"Using command list: {command_list + post_command_list}") # DEBUG with open( os.path.join( @@ -1276,7 +1282,7 @@ def print_state_info_and_get_update_list(pkg_state: dict[str, Any]): to_update = [] log_print("package state:") - for (pkg_name, pkg_dict) in pkg_state.items(): + for pkg_name, pkg_dict in pkg_state.items(): if "state" in pkg_dict: log_print(f" {pkg_name:40}: {pkg_dict['state']}") if pkg_dict["state"] == "install": @@ -1485,6 +1491,12 @@ if __name__ == "__main__": pkg_state[entry["name"]]["skip_branch_up_to_date"] = True else: pkg_state[entry["name"]]["skip_branch_up_to_date"] = False + if ( + "link_cargo_registry" in entry + and type(entry["link_cargo_registry"]) is bool + and entry["link_cargo_registry"] + ): + pkg_state[entry["name"]]["link_cargo_registry"] = True other_state["chroot"] = d["chroot"] other_state["pkg_out_dir"] = d["pkg_out_dir"] other_state["repo"] = d["repo"]