diff --git a/vinca/generate_azure.py b/vinca/generate_azure.py index da5bbb6..954691f 100644 --- a/vinca/generate_azure.py +++ b/vinca/generate_azure.py @@ -143,7 +143,10 @@ def get_all_ancestors(graph, node): current_node = node while True: - a = {a for a in graph[node] if a.startswith('ros-') or a.startswith('ros2')} + a = {a for a in graph.get(node, []) if a.startswith('ros-') or a.startswith('ros2')} + if not graph.get(node): + print(f"[yellow]{node} not found") + ancestors |= a visited.add(current_node) @@ -169,7 +172,10 @@ def add_additional_recipes(args): repodatas = get_skip_existing(vinca_conf, args.platform) + additional_recipes = [] for recipe_path in glob.glob(additional_recipes_path + "/**/recipe.yaml"): + if not "ros-distro-mutex" in recipe_path: + continue with open(recipe_path) as recipe: additional_recipe = yaml.safe_load(recipe) @@ -196,6 +202,9 @@ def add_additional_recipes(args): goal_folder = os.path.join(args.dir, name) os.makedirs(goal_folder, exist_ok=True) copy_tree(os.path.dirname(recipe_path), goal_folder) + additional_recipes.append(additional_recipe) + + return additional_recipes def build_linux_pipeline( @@ -392,8 +401,9 @@ def main(): metas = [] + additional_recipes = [] if args.additional_recipes: - add_additional_recipes(args) + additional_recipes = add_additional_recipes(args) if not os.path.exists(args.dir): print(f"{args.dir} not found. Not generating a pipeline.") @@ -406,7 +416,7 @@ def main(): if len(metas) >= 1: requirements = {} - for pkg in full_tree: + for pkg in full_tree + additional_recipes: requirements[pkg["package"]["name"]] = pkg["requirements"].get( "host", [] ) + pkg["requirements"].get("run", []) @@ -432,6 +442,7 @@ def main(): tg = list(reversed(list(nx.topological_sort(G)))) names_to_build = {pkg["package"]["name"] for pkg in metas} + print("Names to build: ", names_to_build) tg_slimmed = [el for el in tg if el in names_to_build] stages = [] @@ -472,6 +483,15 @@ def main(): stages = batch_stages(filtered_stages) print(stages) + with open("buildorder.txt", "w") as fo: + order = [] + for stage in filtered_stages: + for el in stage: + print(el) + order.append(el) + + fo.write('\n'.join(order)) + if args.platform == "linux-64": build_linux_pipeline(stages, args.trigger_branch, outfile="linux.yml") diff --git a/vinca/migrate.py b/vinca/migrate.py index c637103..4618652 100644 --- a/vinca/migrate.py +++ b/vinca/migrate.py @@ -8,8 +8,9 @@ import shutil import ruamel.yaml from .utils import get_repodata - +from vinca import config from vinca.distro import Distro +from distutils.dir_util import copy_tree distro_version = None ros_prefix = None @@ -114,6 +115,7 @@ def create_migration_instructions(arch, packages_to_migrate, trigger_branch): vinca_conf["packages_select_by_deps"] = ros_names vinca_conf["skip_all_deps"] = True vinca_conf["is_migration"] = True + vinca_conf["skip_existing"] = [] with open("vinca.yaml", "w") as fo: yaml.dump(vinca_conf, fo) @@ -121,9 +123,19 @@ def create_migration_instructions(arch, packages_to_migrate, trigger_branch): if os.path.exists("recipes"): shutil.rmtree("recipes") + mutex_path = os.path.join(config.parsed_args.dir, "additional_recipes/ros-distro-mutex") + if os.path.exists(mutex_path): + goal_folder = os.path.join(config.parsed_args.dir, "recipes", "ros-distro-mutex") + os.makedirs(goal_folder, exist_ok=True) + copy_tree(mutex_path, goal_folder) + + subprocess.check_call( - ["vinca", "-f", "vinca.yaml", "--multiple", "--platform", arch] + ["vinca", "-d", config.parsed_args.dir, "--multiple", "--platform", arch] ) + + # TODO remove hard coded build branch here! + recipe_dir = os.path.join(config.parsed_args.dir, "recipes") subprocess.check_call( [ "vinca-azure", @@ -132,9 +144,8 @@ def create_migration_instructions(arch, packages_to_migrate, trigger_branch): "--trigger-branch", "buildbranch_linux", "-d", - "./recipes", + recipe_dir, "--additional-recipes", - "--sequential", ] ) @@ -173,8 +184,7 @@ def parse_command_line(argv): ) arguments = parser.parse_args(argv[1:]) - global parsed_args - parsed_args = arguments + config.parsed_args = arguments return arguments