Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate buildorder.txt file and add ros-distro-mutex to migrations #21

Merged
merged 1 commit into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions vinca/generate_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be removed :)

continue
with open(recipe_path) as recipe:
additional_recipe = yaml.safe_load(recipe)

Expand All @@ -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(
Expand Down Expand Up @@ -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.")
Expand All @@ -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", [])
Expand All @@ -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 = []
Expand Down Expand Up @@ -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")

Expand Down
22 changes: 16 additions & 6 deletions vinca/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -114,16 +115,27 @@ 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)

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",
Expand All @@ -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",
]
)

Expand Down Expand Up @@ -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


Expand Down