Commit d5ed4f45 authored by William Salmon's avatar William Salmon
Browse files

Improve error message for build if there are refs missing

parent 9b6fac5a
Loading
Loading
Loading
Loading
Loading
+5 −14
Original line number Diff line number Diff line
@@ -359,23 +359,14 @@ class Pipeline():

        if inconsistent:
            detail = "Exact versions are missing for the following elements:\n\n"

            missingTrack = 0
            for element in inconsistent:
                detail += "  " + element._get_full_name()
                detail += "  Element: {} is inconsistent\n".format(element._get_full_name())
                for source in element.sources():
                    if not source._get_consistency() and not source.get_ref():
                        if hasattr(source, 'tracking') and source.tracking is None:
                            detail += ": Source {} is missing ref and track. ".format(source._get_full_name()) + \
                                      "Please specify a ref or branch/tag to track."
                            missingTrack = 1

                detail += "\n"
                    if source._get_consistency() == Consistency.INCONSISTENT:
                        detail += "    Source {} is missing ref\n".format(source)
                detail += '\n'
            detail += "Try tracking these elements first with `bst track`\n"

            if missingTrack:
                detail += "\nThen track these elements with `bst track`\n"
            else:
                detail += "\nTry tracking these elements first with `bst track`\n"
            raise PipelineError("Inconsistent pipeline", detail=detail, reason="inconsistent-pipeline")

    #############################################################