summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2017-07-12 08:36:58 +0200
committerJürg Billeter <j@bitron.ch>2017-07-14 14:13:51 +0200
commit15beacbabeb8235649717f4d5d71575b8fec6710 (patch)
treed557dfa3d1819d9e6614308bf408d2c0269eedbd
parenteb67b93f14fe0b8b7882650f4e3ab5868c984013 (diff)
downloadbuildstream-15beacbabeb8235649717f4d5d71575b8fec6710.tar.gz
element.py: Add _get_full_display_key()
-rw-r--r--buildstream/element.py37
1 files changed, 28 insertions, 9 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index 8ef14f84c..db2fd44b1 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -767,23 +767,42 @@ class Element(Plugin):
return self.__cache_key
- # _get_display_key():
+ # _get_full_display_key():
#
- # Returns an abbreviated cache key for display purposes
+ # Returns cache keys for display purposes
#
# Returns:
- # (str): An abbreviated hex digest cache key for this Element, or zeros
+ # (str): A full hex digest cache key for this Element
+ # (str): An abbreviated hex digest cache key for this Element
+ # (bool): True if key should be shown as dim, False otherwise
#
- # Zeros are returned if information for the cache key is missing.
+ # Question marks are returned if information for the cache key is missing.
#
- def _get_display_key(self):
+ def _get_full_display_key(self):
context = self.get_context()
cache_key = self._get_cache_key()
- if cache_key:
- length = min(len(cache_key), context.log_key_length)
- return cache_key[0:length]
+ dim_key = False
+
+ if not cache_key:
+ cache_key = "{:?<64}".format('')
+ # Show unresolved cache keys as dim
+ dim_key = True
- return ("{:?<" + str(context.log_key_length) + "}").format('')
+ length = min(len(cache_key), context.log_key_length)
+ return (cache_key, cache_key[0:length], dim_key)
+
+ # _get_display_key():
+ #
+ # Returns an abbreviated cache key for display purposes
+ #
+ # Returns:
+ # (str): An abbreviated hex digest cache key for this Element
+ #
+ # Question marks are returned if information for the cache key is missing.
+ #
+ def _get_display_key(self):
+ _, display_key, _ = self._get_full_display_key()
+ return display_key
# _get_variables()
#