From 268f94ecd83f4426972df5a17c9d4f37b5cb1fdd Mon Sep 17 00:00:00 2001 From: Mat Booth Date: Fri, 31 May 2019 12:20:57 +0100 Subject: [PATCH] Better ordering for bootstrapping. --- .gitignore | 2 ++ clone_rpms.sh | 13 ++++++++ gen_build_order_graph.py | 54 +++++++++++++++++++++++++++++++ tycho.yaml | 69 +++++++++++++++++----------------------- 4 files changed, 99 insertions(+), 39 deletions(-) create mode 100644 .gitignore create mode 100755 clone_rpms.sh create mode 100755 gen_build_order_graph.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e4e766e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/*.png +/rpms/ diff --git a/clone_rpms.sh b/clone_rpms.sh new file mode 100755 index 0000000..e01107d --- /dev/null +++ b/clone_rpms.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +mkdir -p rpms +pushd rpms 2>&1 >/dev/null + +for pkg in $(grep -B1 --no-group-separator buildorder ../tycho.yaml | grep -v buildorder | sed -e 's/:$//') ; do + if [ ! -d "$pkg" ] ; then + fedpkg clone $pkg + (cd $pkg && fedpkg switch-branch f30 && fedpkg switch-branch master && fedpkg switch-branch tycho) + fi +done + +popd 2>&1 >/dev/null diff --git a/gen_build_order_graph.py b/gen_build_order_graph.py new file mode 100755 index 0000000..01dbab7 --- /dev/null +++ b/gen_build_order_graph.py @@ -0,0 +1,54 @@ +#!/usr/bin/python3 + +import yaml +from pygraphviz import AGraph +from subprocess import call + +with open("tycho.yaml", 'r') as stream: + yaml = yaml.safe_load(stream) + +rpms = yaml['data']['components']['rpms'] + +g = AGraph(directed=True, name="G", strict=False, label="Build Order Graph") +ranks = [] +for key, value in rpms.items(): + rank = value['buildorder'] + if rank not in ranks: + ranks.append(rank) + subg = g.get_subgraph(f"{rank}") + if subg is None: + subg = g.add_subgraph(name=f"{rank}", label=f"Build Order {rank}", rank="same") + subg.add_node(f"{rank}") + subg.add_node(key) + rs = value['rationale'].replace('\n', ' ').split('.') + reqs = [] + breqs = [] + for r in rs: + r = r.strip() + if not r or r == 'Module API': + continue + if r.startswith('Runtime dependency of'): + r = r[len('Runtime dependency of'):] + reqs = [x.strip() for x in r.split(',')] + if r.startswith('Build dependency of'): + r = r[len('Build dependency of'):] + breqs = [x.strip() for x in r.split(',')] + for req in reqs: + # For Rs, check if also a BR + if req not in breqs: + g.add_edge(key, req, color='blue') + else: + g.add_edge(key, req, color='purple') + for breq in breqs: + # For BRs, check if also a R + if breq not in reqs: + g.add_edge(key, breq, color='red') +ranks.sort() +for idx, rank in enumerate(ranks): + if idx+1 < len(ranks): + g.add_edge(rank, ranks[idx+1], weight=1000) + + +print(g.string()) +g.draw("build_order_graph.png", prog="dot") +call('eog build_order_graph.png &', shell=True) diff --git a/tycho.yaml b/tycho.yaml index b84bc4e..dc2602d 100644 --- a/tycho.yaml +++ b/tycho.yaml @@ -42,9 +42,9 @@ data: api: rpms: - cbi-plugins - - takari-tycho-support - tycho - tycho-extras + - takari-tycho-support buildopts: rpms: macros: | @@ -72,8 +72,8 @@ data: ref: tycho arches: [x86_64, ppc64le, aarch64, s390x] rationale: > - Runtime dependency of eclipse. - Build dependency of eclipse. + Runtime dependency of eclipse, tycho. + Build dependency of eclipse, tycho. cbi-plugins: buildorder: 50 ref: tycho @@ -96,23 +96,21 @@ data: Runtime dependency of takari-lifecycle, tycho. Build dependency of glassfish-jsp, tycho. eclipse: - buildorder: 120 + buildorder: 80 ref: tycho arches: [x86_64, ppc64le, aarch64, s390x] rationale: > - Runtime dependency of eclipse-emf, takari-lifecycle, - tycho. - Build dependency of eclipse, eclipse-ecf, eclipse-emf, - jetty, takari-lifecycle, tycho. + Runtime dependency of takari-lifecycle. + Build dependency of takari-lifecycle. eclipse-ecf: - buildorder: 110 + buildorder: 70 ref: tycho arches: [x86_64, ppc64le, aarch64, s390x] rationale: > Runtime dependency of eclipse. Build dependency of eclipse. eclipse-emf: - buildorder: 100 + buildorder: 60 ref: tycho arches: [x86_64, ppc64le, aarch64, s390x] rationale: > @@ -175,29 +173,29 @@ data: ref: tycho arches: [x86_64, ppc64le, aarch64, s390x] rationale: > - Runtime dependency of eclipse. - Build dependency of eclipse. + Runtime dependency of eclipse, tycho. + Build dependency of eclipse, tycho. glassfish-jsp: buildorder: 20 ref: tycho arches: [x86_64, ppc64le, aarch64, s390x] rationale: > - Runtime dependency of eclipse. - Build dependency of eclipse. + Runtime dependency of eclipse, tycho. + Build dependency of eclipse, tycho. google-gson: buildorder: 10 ref: tycho arches: [x86_64, ppc64le, aarch64, s390x] rationale: > - Runtime dependency of takari-lifecycle. - Build dependency of takari-lifecycle. + Runtime dependency of eclipse, takari-lifecycle. + Build dependency of eclipse, takari-lifecycle. icu4j: buildorder: 10 ref: tycho arches: [x86_64, ppc64le, aarch64, s390x] rationale: > - Runtime dependency of eclipse. - Build dependency of eclipse. + Runtime dependency of eclipse, tycho. + Build dependency of eclipse, tycho. jackson-annotations: buildorder: 30 ref: tycho @@ -279,15 +277,15 @@ data: ref: tycho arches: [x86_64, ppc64le, aarch64, s390x] rationale: > - Runtime dependency of eclipse. - Build dependency of eclipse. + Runtime dependency of eclipse, tycho. + Build dependency of eclipse, tycho. sat4j: buildorder: 10 ref: tycho arches: [x86_64, ppc64le, aarch64, s390x] rationale: > - Runtime dependency of eclipse. - Build dependency of eclipse. + Runtime dependency of eclipse, tycho. + Build dependency of eclipse, tycho. takari-archiver: buildorder: 10 ref: tycho @@ -303,34 +301,27 @@ data: Runtime dependency of takari-lifecycle. Build dependency of takari-lifecycle. takari-lifecycle: - buildorder: 70 + buildorder: 90 ref: tycho arches: [x86_64, ppc64le, aarch64, s390x] rationale: > Runtime dependency of takari-pom. - Build dependency of eclipse-m2e-workspace, - takari-archiver, takari-incrementalbuild, - takari-lifecycle, takari-plugin-testing, takari-pom, - tesla-polyglot. + Build dependency of takari-pom. takari-plugin-testing: buildorder: 20 ref: tycho arches: [x86_64, ppc64le, aarch64, s390x] rationale: > - Build dependency of takari-incrementalbuild, - takari-lifecycle. + Build dependency of takari-lifecycle. takari-pom: - buildorder: 80 + buildorder: 100 ref: tycho arches: [x86_64, ppc64le, aarch64, s390x] rationale: > Runtime dependency of takari-tycho-support. - Build dependency of takari-archiver, - takari-incrementalbuild, takari-lifecycle, - takari-plugin-testing, takari-tycho-support, - tesla-polyglot. + Build dependency of takari-tycho-support. takari-tycho-support: - buildorder: 90 + buildorder: 110 ref: tycho arches: [x86_64, ppc64le, aarch64, s390x] rationale: > @@ -352,9 +343,9 @@ data: takari-tycho-support, tycho-extras. Build dependency of cbi-plugins, eclipse, eclipse-ecf, eclipse-emf, eclipse-license, takari-tycho-support, - tycho, tycho-extras. + tycho-extras. tycho-extras: - buildorder: 90 + buildorder: 50 ref: tycho arches: [x86_64, ppc64le, aarch64, s390x] rationale: > @@ -371,8 +362,8 @@ data: ref: tycho arches: [x86_64, ppc64le, aarch64, s390x] rationale: > - Runtime dependency of batik, eclipse. - Build dependency of batik, eclipse. + Runtime dependency of batik. + Build dependency of batik. xpp3: buildorder: 10 ref: tycho