summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Pollard <tom.pollard@codethink.co.uk>2020-01-09 12:18:46 +0000
committerTom Pollard <tom.pollard@codethink.co.uk>2020-01-09 12:18:46 +0000
commit928d8e6b77daee3eb259d96681f4bce9dc512afd (patch)
tree3bf20dd40b80d3dcdf406a08277ea6fafb849098
parent5960a90e03b1e5115f6e5912b126529846e589f5 (diff)
parent5c1a6ae58fc569b1d4dc50248298f3c0d993076d (diff)
downloadbuildstream-928d8e6b77daee3eb259d96681f4bce9dc512afd.tar.gz
Merge branch 'tpollard/showjunction' into 'master'
_frontend/widget.py: show_pipeline() Don't show buildable for junction Closes #1205 See merge request BuildStream/buildstream!1764
-rw-r--r--NEWS7
-rw-r--r--src/buildstream/_frontend/cli.py2
-rw-r--r--src/buildstream/_frontend/widget.py4
-rw-r--r--tests/format/junctions.py9
4 files changed, 20 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 37a15bea6..abd53d903 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,13 @@
(unreleased)
============
+CLI
+---
+
+ o BREAKING CHANGE: `bst show` will now output `junction` instead
+ of `buildable` for the state of junction elements, as they can't
+ be built.
+
==================
buildstream 1.91.3
diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py
index 365f5c421..fc501f09c 100644
--- a/src/buildstream/_frontend/cli.py
+++ b/src/buildstream/_frontend/cli.py
@@ -565,7 +565,7 @@ def show(app, elements, deps, except_, order, format_):
%{name} The element name
%{key} The abbreviated cache key (if all sources are consistent)
%{full-key} The full cache key (if all sources are consistent)
- %{state} cached, buildable, waiting or inconsistent
+ %{state} cached, buildable, waiting, inconsistent or junction
%{config} The element configuration
%{vars} Variable configuration
%{env} Environment settings
diff --git a/src/buildstream/_frontend/widget.py b/src/buildstream/_frontend/widget.py
index 63fbfbb7d..98ebf31f3 100644
--- a/src/buildstream/_frontend/widget.py
+++ b/src/buildstream/_frontend/widget.py
@@ -350,7 +350,9 @@ class LogLine(Widget):
if consistency == Consistency.INCONSISTENT:
line = p.fmt_subst(line, "state", "no reference", fg="red")
else:
- if element._cached_failure():
+ if element.get_kind() == "junction":
+ line = p.fmt_subst(line, "state", "junction", fg="magenta")
+ elif element._cached_failure():
line = p.fmt_subst(line, "state", "failed", fg="red")
elif element._cached_success():
line = p.fmt_subst(line, "state", "cached", fg="magenta")
diff --git a/tests/format/junctions.py b/tests/format/junctions.py
index 45ccff222..43cd3f7ba 100644
--- a/tests/format/junctions.py
+++ b/tests/format/junctions.py
@@ -465,3 +465,12 @@ def test_invalid_target_format(cli, tmpdir, datafiles, target):
result.assert_main_error(ErrorDomain.ELEMENT, None)
assert "'target' option must be in format '{junction-name}:{element-name}'" in result.stderr
+
+
+@pytest.mark.datafiles(DATA_DIR)
+def test_junction_show(cli, tmpdir, datafiles):
+ project = os.path.join(str(datafiles), "foo")
+ copy_subprojects(project, datafiles, ["base"])
+
+ # Show, assert that it says junction
+ assert cli.get_element_state(project, "base.bst") == "junction"