diff --git a/easybuild/framework/easyconfig/tools.py b/easybuild/framework/easyconfig/tools.py index fde06b8aec..ddd82c601b 100644 --- a/easybuild/framework/easyconfig/tools.py +++ b/easybuild/framework/easyconfig/tools.py @@ -70,6 +70,7 @@ # PyGraph (used for generating dependency graphs) # https://pypi.python.org/pypi/python-graph-core from pygraph.classes.digraph import digraph + from pygraph.classes.exceptions import AdditionError # https://pypi.python.org/pypi/python-graph-dot import pygraph.readwrite.dot as dot # graphviz (used for creating dependency graph images) @@ -206,7 +207,17 @@ def mk_node_name(spec): edge_attrs = [('style', 'dotted'), ('color', 'blue'), ('arrowhead', 'diamond')] for spec in specs: for dep in spec['ec'].all_dependencies: - dgr.add_edge((spec['module'], dep)) + try: + dgr.add_edge((spec['module'], dep)) + except AdditionError as err: + # When multiple specs are given we can easily have overlapping edges (i.e., common dependency trees) + # so we need to explicitly account this in our digraph + if "already in digraph" in str(err): + _log.info("Edge (%s) -> (%s) already exists in digraph (but duplication is permitted)", + (spec['module'], dep)) + continue + else: + raise err if dep in spec['ec'].build_dependencies: dgr.add_edge_attributes((spec['module'], dep), attrs=edge_attrs) diff --git a/easybuild/scripts/extract_node_from_dotfile.sh b/easybuild/scripts/extract_node_from_dotfile.sh new file mode 100755 index 0000000000..2161448910 --- /dev/null +++ b/easybuild/scripts/extract_node_from_dotfile.sh @@ -0,0 +1,102 @@ +#!/bin/bash +## +# Copyright 2012-2019 Ghent University +# +# This file is part of EasyBuild, +# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), +# with support of Ghent University (http://ugent.be/hpc), +# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), +# Flemish Research Foundation (FWO) (http://www.fwo.be/en) +# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). +# +# https://github.com/easybuilders/easybuild +# +# EasyBuild is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation v2. +# +# EasyBuild is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with EasyBuild. If not, see . +## + +# @author: Alan O'Cais (Juelich Supercomputing Centre) + +## +# Use case: +# +# A large dotfile that contains all software installed with EasyBuild can be generated with a command line such as: +# eb --dep-graph=depgraph.dot $EASYBUILD_INSTALLPATH/software/*/*/easybuild/*.eb +# Such a dotfile is (typically) too large to deal with directly. This script can extract a particular node from such a +# dotfile, e.g., +# ./