From 5bc2b0731b8f87e50ad0db50706494e53014dbe1 Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Fri, 5 Jul 2019 15:11:47 +0100 Subject: cascache: rm unused link_ref(), available_space --- src/buildstream/_cas/cascache.py | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'src') diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py index 771e31208..49a5e8837 100644 --- a/src/buildstream/_cas/cascache.py +++ b/src/buildstream/_cas/cascache.py @@ -272,19 +272,6 @@ class CASCache(): return None - # link_ref(): - # - # Add an alias for an existing ref. - # - # Args: - # oldref (str): An existing ref - # newref (str): A new ref for the same directory - # - def link_ref(self, oldref, newref): - tree = self.resolve_ref(oldref) - - self.set_ref(newref, tree) - # push(): # # Push committed refs to remote repository. @@ -1050,7 +1037,6 @@ class CASQuota: self._cache_quota_original = None # The cache quota as specified by the user, in bytes self._cache_quota_headroom = None # The headroom in bytes before reaching the quota or full disk self._cache_lower_threshold = None # The target cache size for a cleanup - self.available_space = None self._message = context.messenger.message @@ -1225,7 +1211,6 @@ class CASQuota: total_size, available_space = self._get_cache_volume_size() cache_size = self.get_cache_size() - self.available_space = available_space # Ensure system has enough storage for the cache_quota # -- cgit v1.2.1 From 55b3342fc5b536ed90b701bf6d83b61090346797 Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Fri, 5 Jul 2019 15:13:27 +0100 Subject: _exceptions: rm unused OSTREE ErrorDomain entry --- src/buildstream/_exceptions.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/buildstream/_exceptions.py b/src/buildstream/_exceptions.py index f57e4b34a..82f1fe8ed 100644 --- a/src/buildstream/_exceptions.py +++ b/src/buildstream/_exceptions.py @@ -88,15 +88,14 @@ class ErrorDomain(Enum): SANDBOX = 5 ARTIFACT = 6 PIPELINE = 7 - OSTREE = 8 - UTIL = 9 - SOURCE = 10 - ELEMENT = 11 - APP = 12 - STREAM = 13 - VIRTUAL_FS = 14 - CAS = 15 - PROG_NOT_FOUND = 16 + UTIL = 8 + SOURCE = 9 + ELEMENT = 10 + APP = 11 + STREAM = 12 + VIRTUAL_FS = 13 + CAS = 14 + PROG_NOT_FOUND = 15 # BstError is an internal base exception class for BuildSream -- cgit v1.2.1 From 4c1017ae2eca81d2f60c01f6a6781efea0cfc753 Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Fri, 5 Jul 2019 15:14:30 +0100 Subject: _frontend: rm unused _line_length and Space widget --- src/buildstream/_frontend/status.py | 2 -- src/buildstream/_frontend/widget.py | 8 -------- 2 files changed, 10 deletions(-) (limited to 'src') diff --git a/src/buildstream/_frontend/status.py b/src/buildstream/_frontend/status.py index f0fb22639..32fda1147 100644 --- a/src/buildstream/_frontend/status.py +++ b/src/buildstream/_frontend/status.py @@ -76,7 +76,6 @@ class Status(): self._term_width, _ = click.get_terminal_size() self._alloc_lines = 0 self._alloc_columns = None - self._line_length = 0 self._need_alloc = True self._term_caps = self._init_terminal() @@ -258,7 +257,6 @@ class Status(): self._alloc_lines = alloc_lines self._alloc_columns = alloc_columns - self._line_length = line_length self._need_alloc = False def _job_lines(self, columns): diff --git a/src/buildstream/_frontend/widget.py b/src/buildstream/_frontend/widget.py index 769c95e75..bc49e2927 100644 --- a/src/buildstream/_frontend/widget.py +++ b/src/buildstream/_frontend/widget.py @@ -74,13 +74,6 @@ class Widget(): raise ImplError("{} does not implement render()".format(type(self).__name__)) -# Used to add spacing between columns -class Space(Widget): - - def render(self, message): - return ' ' - - # Used to add fixed text between columns class FixedText(Widget): @@ -330,7 +323,6 @@ class LogLine(Widget): self._resolved_keys = None self._state = state - self._space_widget = Space(context, content_profile, format_profile) self._logfile_widget = LogFile(context, content_profile, format_profile, err_profile) if context.log_debug: -- cgit v1.2.1 From db694dc1ed0f65342426b77fb875e6c13bd5c96a Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Fri, 5 Jul 2019 15:15:34 +0100 Subject: _loader/loadelement: rm unused 'deps' member --- src/buildstream/_loader/loadelement.py | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/buildstream/_loader/loadelement.py b/src/buildstream/_loader/loadelement.py index 850b41a67..673bc50ee 100644 --- a/src/buildstream/_loader/loadelement.py +++ b/src/buildstream/_loader/loadelement.py @@ -61,7 +61,6 @@ class LoadElement(): self.node = node # The YAML node self.name = filename # The element name self.full_name = None # The element full name (with associated junction) - self.deps = None # The list of Dependency objects self.meta_done = False # If the MetaElement for this LoadElement is done self.node_id = next(self._counter) -- cgit v1.2.1 From 639e9054efa3a084ece3183523d9cfb494e82892 Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Fri, 5 Jul 2019 15:19:00 +0100 Subject: _plugincontext: simplify if statement Add shortened local vars to make this statement easier to read and fit onto one line. --- src/buildstream/_plugincontext.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/buildstream/_plugincontext.py b/src/buildstream/_plugincontext.py index 7a5407cf6..9145b3a3b 100644 --- a/src/buildstream/_plugincontext.py +++ b/src/buildstream/_plugincontext.py @@ -217,9 +217,10 @@ class PluginContext(): # Now assert BuildStream version bst_major, bst_minor = utils.get_bst_version() - if bst_major < plugin_type.BST_REQUIRED_VERSION_MAJOR or \ - (bst_major == plugin_type.BST_REQUIRED_VERSION_MAJOR and - bst_minor < plugin_type.BST_REQUIRED_VERSION_MINOR): + req_major = plugin_type.BST_REQUIRED_VERSION_MAJOR + req_minor = plugin_type.BST_REQUIRED_VERSION_MINOR + + if (bst_major, bst_minor) < (req_major, req_minor): raise PluginError("BuildStream {}.{} is too old for {} plugin '{}' (requires {}.{})" .format( bst_major, bst_minor, -- cgit v1.2.1 From be76fb4deeedfaf0ea91742a5bfd83090208a700 Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Fri, 5 Jul 2019 15:35:06 +0100 Subject: _plugincontext: rm unused self._dependencies Also document the pre-existing format_versions parameter. --- src/buildstream/_plugincontext.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/buildstream/_plugincontext.py b/src/buildstream/_plugincontext.py index 9145b3a3b..7fef9b9f4 100644 --- a/src/buildstream/_plugincontext.py +++ b/src/buildstream/_plugincontext.py @@ -32,6 +32,8 @@ from . import _yaml # base_type (type): A base object type for this context # site_plugin_path (str): Path to where buildstream keeps plugins # plugin_origins (list): Data used to search for plugins +# format_versions (dict): A dict of meta.kind to the integer minimum +# version number for each plugin to be loaded # # Since multiple pipelines can be processed recursively # within the same interpretor, it's important that we have @@ -43,8 +45,7 @@ from . import _yaml class PluginContext(): def __init__(self, plugin_base, base_type, site_plugin_path, *, - plugin_origins=None, dependencies=None, - format_versions={}): + plugin_origins=None, format_versions={}): # The plugin kinds which were loaded self.loaded_dependencies = [] @@ -52,7 +53,6 @@ class PluginContext(): # # Private members # - self._dependencies = dependencies self._base_type = base_type # The base class plugins derive from self._types = {} # Plugin type lookup table by kind self._plugin_origins = plugin_origins or [] -- cgit v1.2.1 From a8a779f2e0443bc52f478bc83dbb2f76ed1e4370 Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Fri, 5 Jul 2019 15:47:18 +0100 Subject: scheduler: rm unused _exclusive_* members The {,un}register_exclusive_interest() mechanism is used for this now. --- src/buildstream/_scheduler/scheduler.py | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src') diff --git a/src/buildstream/_scheduler/scheduler.py b/src/buildstream/_scheduler/scheduler.py index d2ea2741e..00d61140e 100644 --- a/src/buildstream/_scheduler/scheduler.py +++ b/src/buildstream/_scheduler/scheduler.py @@ -103,15 +103,6 @@ class Scheduler(): self._interrupt_callback = interrupt_callback self._ticker_callback = ticker_callback - # Whether our exclusive jobs, like 'cleanup' are currently already - # waiting or active. - # - # This is just a bit quicker than scanning the wait queue and active - # queue and comparing job action names. - # - self._exclusive_waiting = set() - self._exclusive_active = set() - self.resources = Resources(context.sched_builders, context.sched_fetchers, context.sched_pushers) -- cgit v1.2.1 From c99f36a8ad4e9b668489c1db82cfb9cbb18d5eda Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Fri, 5 Jul 2019 15:53:26 +0100 Subject: _sourcecache: rm unused required_sources --- src/buildstream/_sourcecache.py | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'src') diff --git a/src/buildstream/_sourcecache.py b/src/buildstream/_sourcecache.py index fdfe00901..b39874b20 100644 --- a/src/buildstream/_sourcecache.py +++ b/src/buildstream/_sourcecache.py @@ -126,18 +126,6 @@ class SourceCache(BaseCache): except SourceCacheError: pass - # required_sources() - # - # Yields the keys of all sources marked as required by the current build - # plan - # - # Returns: - # iterable (str): iterable over the required source refs - # - def required_sources(self): - for source in self._required_sources: - yield source._get_source_name() - # unrequired_sources() # # Yields the refs of all sources not required by the current build plan -- cgit v1.2.1 From 9bb1db1b13a85c988537f8b4dd6334a6b3f9a02d Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Fri, 5 Jul 2019 15:55:26 +0100 Subject: _stream: rm unused _collect_sources() --- src/buildstream/_stream.py | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'src') diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py index 2ad1a4fee..7e68f1afd 100644 --- a/src/buildstream/_stream.py +++ b/src/buildstream/_stream.py @@ -1451,17 +1451,6 @@ class Stream(): os.chmod(script_path, stat.S_IEXEC | stat.S_IREAD) - # Collect the sources in the given sandbox into a tarfile - def _collect_sources(self, directory, tar_name, element_name, compression): - with self._context.messenger.timed_activity("Creating tarball {}".format(tar_name)): - if compression == "none": - permissions = "w:" - else: - permissions = "w:" + compression - - with tarfile.open(tar_name, permissions) as tar: - tar.add(directory, arcname=element_name) - # _get_element_dirname() # # Get path to directory for an element based on its normal name. -- cgit v1.2.1 From f20cf0decbe1089895a101efb504394b3e098528 Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Fri, 5 Jul 2019 16:17:36 +0100 Subject: element: rm unused __tracking_done --- src/buildstream/element.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/buildstream/element.py b/src/buildstream/element.py index fa4f63bff..758a0b97d 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -221,7 +221,6 @@ class Element(Plugin): self.__assemble_scheduled = False # Element is scheduled to be assembled self.__assemble_done = False # Element is assembled self.__tracking_scheduled = False # Sources are scheduled to be tracked - self.__tracking_done = False # Sources have been tracked self.__pull_done = False # Whether pull was attempted self.__splits = None # Resolved regex objects for computing split domains self.__whitelist_regex = None # Resolved regex object to check if file is allowed to overlap @@ -1337,7 +1336,6 @@ class Element(Plugin): assert self.__tracking_scheduled self.__tracking_scheduled = False - self.__tracking_done = True self.__update_state_recursively() -- cgit v1.2.1 From a2c63af692941459be1e65776f30c42e06287230 Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Fri, 5 Jul 2019 16:18:06 +0100 Subject: source: rm unused _cache(), __source_cache --- src/buildstream/source.py | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src') diff --git a/src/buildstream/source.py b/src/buildstream/source.py index 76c56fd1d..f8b5d3f88 100644 --- a/src/buildstream/source.py +++ b/src/buildstream/source.py @@ -312,8 +312,6 @@ class Source(Plugin): super().__init__("{}-{}".format(meta.element_name, meta.element_index), context, project, provenance, "source", unique_id=unique_id) - self.__source_cache = context.sourcecache - self.__element_name = meta.element_name # The name of the element owning this source self.__element_index = meta.element_index # The index of the source in the owning element's source list self.__element_kind = meta.element_kind # The kind of the element owning this source @@ -726,10 +724,6 @@ class Source(Plugin): else: self.__do_fetch() - def _cache(self, previous_sources): - # stage the source into the source cache - self.__source_cache.commit(self, previous_sources) - # Wrapper for stage() api which gives the source # plugin a fully constructed path considering the # 'directory' option -- cgit v1.2.1 From eb653a94f950947735e570f658e2e71c7c674861 Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Fri, 5 Jul 2019 16:28:04 +0100 Subject: _casbaseddirectory: rm unused exception classes --- src/buildstream/storage/_casbaseddirectory.py | 29 --------------------------- 1 file changed, 29 deletions(-) (limited to 'src') diff --git a/src/buildstream/storage/_casbaseddirectory.py b/src/buildstream/storage/_casbaseddirectory.py index a93f16d90..0d43e3bc5 100644 --- a/src/buildstream/storage/_casbaseddirectory.py +++ b/src/buildstream/storage/_casbaseddirectory.py @@ -62,35 +62,6 @@ class IndexEntry(): return self.buildstream_object._get_digest() -class ResolutionException(VirtualDirectoryError): - """ Superclass of all exceptions that can be raised by - CasBasedDirectory._resolve. Should not be used outside this module. """ - - -class InfiniteSymlinkException(ResolutionException): - """ Raised when an infinite symlink loop is found. """ - - -class AbsoluteSymlinkException(ResolutionException): - """Raised if we try to follow an absolute symlink (i.e. one whose - target starts with the path separator) and we have disallowed - following such symlinks. - """ - - -class UnexpectedFileException(ResolutionException): - """Raised if we were found a file where a directory or symlink was - expected, for example we try to resolve a symlink pointing to - /a/b/c but /a/b is a file. - """ - def __init__(self, message=""): - """Allow constructor with no arguments, since this can be raised in - places where there isn't sufficient information to write the - message. - """ - super().__init__(message) - - # CasBasedDirectory intentionally doesn't call its superclass constuctor, # which is meant to be unimplemented. # pylint: disable=super-init-not-called -- cgit v1.2.1 From bed9ca0d90eea05d81461ab325929e7512eff595 Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Fri, 5 Jul 2019 16:29:06 +0100 Subject: _casbaseddirectory: fix '_mark_changed' spelling Override the base-class method '_mark_changed', instead of declaring a new unused method that only raises NotImplementedError. --- src/buildstream/storage/_casbaseddirectory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/buildstream/storage/_casbaseddirectory.py b/src/buildstream/storage/_casbaseddirectory.py index 0d43e3bc5..b88a8a0df 100644 --- a/src/buildstream/storage/_casbaseddirectory.py +++ b/src/buildstream/storage/_casbaseddirectory.py @@ -410,7 +410,7 @@ class CasBasedDirectory(Directory): def export_to_tar(self, tarfile, destination_dir, mtime=BST_ARBITRARY_TIMESTAMP): raise NotImplementedError() - def mark_changed(self): + def _mark_changed(self): """ It should not be possible to externally modify a CAS-based directory at the moment.""" raise NotImplementedError() -- cgit v1.2.1 From ed6cee5bb5b234c8ae3c5f35834b1737c156cc94 Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Fri, 5 Jul 2019 17:05:44 +0100 Subject: _casbaseddirectory: rm unused methods --- src/buildstream/storage/_casbaseddirectory.py | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'src') diff --git a/src/buildstream/storage/_casbaseddirectory.py b/src/buildstream/storage/_casbaseddirectory.py index b88a8a0df..2c5d751e4 100644 --- a/src/buildstream/storage/_casbaseddirectory.py +++ b/src/buildstream/storage/_casbaseddirectory.py @@ -584,32 +584,6 @@ class CasBasedDirectory(Directory): return self.__digest - def _get_child_digest(self, *path): - subdir = self.descend(*path[:-1]) - entry = subdir.index[path[-1]] - if entry.type == _FileType.DIRECTORY: - subdir = entry.buildstream_object - if subdir: - return subdir._get_digest() - else: - return entry.digest - elif entry.type == _FileType.REGULAR_FILE: - return entry.digest - else: - raise VirtualDirectoryError("Directory entry has no digest: {}".format(os.path.join(*path))) - - def _objpath(self, *path): - subdir = self.descend(*path[:-1]) - entry = subdir.index[path[-1]] - return self.cas_cache.objpath(entry.digest) - - def _exists(self, *path): - try: - subdir = self.descend(*path[:-1]) - return path[-1] in subdir.index - except VirtualDirectoryError: - return False - def __invalidate_digest(self): if self.__digest: self.__digest = None -- cgit v1.2.1 From 5781dd9ebcb924ba64f73d746a78402f7e44c7e5 Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Fri, 5 Jul 2019 15:17:20 +0100 Subject: Option: rm unused self.description --- src/buildstream/_options/option.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/buildstream/_options/option.py b/src/buildstream/_options/option.py index ffdb4d272..511678749 100644 --- a/src/buildstream/_options/option.py +++ b/src/buildstream/_options/option.py @@ -45,7 +45,6 @@ class Option(): def __init__(self, name, definition, pool): self.name = name - self.description = None self.variable = None self.value = None self.pool = pool @@ -60,7 +59,11 @@ class Option(): # node (dict): The loaded YAML dictionary describing # the option def load(self, node): - self.description = _yaml.node_get(node, str, 'description') + + # We don't use the description, but we do require that options have a + # description. + _yaml.node_get(node, str, 'description') + self.variable = _yaml.node_get(node, str, 'variable', default_value=None) # Assert valid symbol name for variable name -- cgit v1.2.1