summaryrefslogtreecommitdiff
path: root/buildstream
Commit message (Collapse)AuthorAgeFilesLines
* _frontend/main.py: Making error handling more consistentrefactor-error-detailsTristan Van Berkom2018-01-111-16/+27
| | | | | | | | Added app.print_error() to consistently print an error while running the pipeline stuff. Also make bst push & pull commands more consistent with the rest, and print the summary at the end as expected.
* _frontend/widget.py: Change how we format failure messages.Tristan Van Berkom2018-01-111-11/+20
| | | | | | | | | | | | | | | | o Now print the message itself on the same line in place of the abbreviated log file o When reading back the last lines of the log file, prefix that with an informative message about whence the log lines come, showing the full unabbreviated log file. o Fixed the behavior of read_last_lines() so that it works as intended, problems were: - Was prepending an additional newline when the log contains more lines than we want to print - Was not printing anything at all in the case we want to print more lines than exist in the log
* source.py: Allow specifying detailed message in SourceError()Tristan Van Berkom2018-01-111-3/+4
|
* element.py: Allow specifying detailed message in ElementError()Tristan Van Berkom2018-01-111-1/+2
|
* _exceptions.py: Added `detail` member to base BstError class.Tristan Van Berkom2018-01-111-3/+8
| | | | | | | Now any BuildStream exception can potentially add detail to the errors they raise. Allow detail strings already in PluginError()
* _pipeline.py: Only raise the error for inconsistent pipelineTristan Van Berkom2018-01-111-2/+1
| | | | | Dont make the ERROR message explicitly anymore, leave that to the frontend to sort out.
* _message.py: Remove MessageType.ERROR, we have no need for this.Tristan Van Berkom2018-01-111-2/+0
|
* _scheduler/trackqueue.py: Dont use Plugin.error(), use Plugin.warn() for now.Tristan Van Berkom2018-01-112-6/+11
| | | | | | | This is already problematic as this particular error is reported but fails to fail the session correctly. Documented this in issue #187
* plugin.py: Removing Plugin.error() while it's still early and nobody is ↵Tristan Van Berkom2018-01-111-9/+0
| | | | | | | | | | using it. Errors are fatal, as such plugins must raise either SourceError() or ElementError(). This method was never used in plugins so far, lets remove it even though we are technically breaking (unused) API for the overall betterment of the API.
* plugins/sources/local.py: Consider symbolic link target in cache key.Tristan Van Berkom2018-01-101-1/+2
| | | | | | | | Technically this breaks cache keys for the local source, but as this comes in a branch which fixes local source cache keys to be stable (they were random before this branch), we wont bother with considering this enhancement a separate API break, the cache key breakage was inescapable anyway.
* utils.py: Make list_relative_paths() report sorted paths.Tristan Van Berkom2018-01-101-15/+26
| | | | | | | | | | | This is needed because plugins make use of this function to generate a cache key which must be stable. In addition to the above, this patch also mitigates the performance hit of sorting, and allows _process_list() to function to iterate through the generator when additional sorting is not needed. This patch is an enhanced version of Sam Thursfield's patch on MR !216
* _pipeline.py: Raise detailed pipeline error at preflight timeTristan Van Berkom2018-01-061-2/+11
| | | | | If a plugin raises an error, prepend the plugin identifier to the error message and raise PipelineError.
* _frontend/main.py: Fix issue #180 - Fail gracefully when preflight failsTristan Van Berkom2018-01-061-21/+18
| | | | | | | This also makes main.py less redundant, for some reason there was a stray call to app.pipeline.initialize() beside app.initialize() in every function, instead move that into app.initialize() where we now handle the error and exit gracefully.
* _yaml.py: Use save_file_atomic() when writing out YAMLsam/savefile-utilitySam Thursfield2018-01-041-1/+2
| | | | | | This makes writes done by `bst track` atomic, meaning a crash or power loss while overwriting a .bst file should never cause the the contents of that file to be lost or partially written.
* Move utils._generate_key() into a new 'cachekey' moduleSam Thursfield2018-01-045-23/+50
| | | | | This avoids a circular dependency between the 'utils' and '_yaml' modules.
* Use save_file_atomic() when writing source-bundle scriptsSam Thursfield2018-01-042-2/+2
|
* utils.py: Add save_file_atomic() helperSam Thursfield2018-01-041-0/+58
| | | | | | | | | | | | This is a context manager that can be used to divert file writes into a temporary file, which is then renamed into place once writing is complete. It is primarily intended for use by source plugins which download files, so they can ensure that their downloads appear atomic and there is no risk of leaving half-downloaded files in the cache. So far this is not used in the core, but it is needed by the Docker source plugin that is proposed for the bst-external plugins repo. See: https://gitlab.com/BuildStream/bst-external/merge_requests/9
* source.py & element.py: Fixing SourceError() and ElementError() constructors.Tristan Van Berkom2018-01-042-6/+12
| | | | | | | | Recently I added the `reason` member which can be used to set machine readable error reason strings for the purpose of testing. Forgot to add the necessary `*` argument, forcing `reason` to be a keyword-only argument.
* plugins/sources/_downloadablefilesource.py: Exclude a line from coverageTristan Van Berkom2018-01-021-1/+6
| | | | | | | When fetching a downloadable source, we make a defensive check to avoid redundant download at fetch() time by checking if it's already cached, but fetch() will never be called if the source is already cached.
* plugins/sources/local.py: pragma nocover on unreachable codeTristan Van Berkom2018-01-021-3/+3
| | | | | | | | The local plugin is always Consistency.CACHED, this means that fetch(), set_ref() and get_ref() methods will never be called. Instead of omitting them, just "pragma: nocover" on the `pass` statements, making our coverage report more realistic.
* plugins/sources/patch.py: Removing unneeded checkTristan Van Berkom2018-01-021-7/+5
| | | | | | | | | The patch plugin was checking if the target directory exists, however this is automatically guaranteed by the Source abstract class and documented to be guaranteed as well. Since this error cannot be caught by the plugin (it will be caught in advance by the Source class), removing the check from patch.py.
* source.py: Raise proper SourceError() when failing to create the staging ↵Tristan Van Berkom2018-01-021-1/+7
| | | | | | | directory This changes the UX to report a better human readable error, which is otherwise a BUG message with stack trace.
* plugins/sources/patch.py: Added context to some errorsTristan Van Berkom2018-01-011-8/+12
|
* _pipeline.py: Added context to some errorsTristan Van Berkom2018-01-011-1/+1
|
* Exceptions refactoringTristan Van Berkom2017-12-296-24/+100
| | | | | | | | | | | | | | | Outline of changes to exceptions: o Now BstError base class has a `domain` and `reason` member, reason members are optional. o All derived error classes now specify their `domain` o For LoadError, LoadErrorReason defines the error's `reason` o Now the scheduler `job` class takes care of sending the error reason and domain back to the main process where the last exception which caused a child task to fail can be discretely stored.
* _signals.terminator_handler: wrap handlers in trysAngelos Evripiotis2017-12-221-1/+14
| | | | | | | | It's possible for the custom termination handlers to raise exceptions. Indeed this was actually the case for utils._call(). They're especially difficult to reach with tests, so make extra effort to insulate them. Print any exceptions encountered as a regular traceback before exiting.
* utils._call: rm unused assignments to exit_codeAngelos Evripiotis2017-12-221-2/+1
|
* utils._call: fix race condition on 'process' varAngelos Evripiotis2017-12-221-0/+2
| | | | | | | | | | Tested by inflating the chance of hitting the race. First, insert a sleep between opening the terminator context and starting the process, then: python3 -c 'import buildstream.utils; import os; \ buildstream.utils._call(["echo", "hello"], True); \ print(os.getpid())' & sleep 1; kill $!
* utils._call: fix doc typoAngelos Evripiotis2017-12-221-1/+1
|
* plugins/sources/tar.py: Dont manually reraise exceptionTristan Van Berkom2017-12-201-5/+4
| | | | | It's not required to raise SourceError() manually when calling utils.get_host_tool().
* _artifactcache/tarcache.py: Fixed for new location of ProgramNotFoundErrorTristan Van Berkom2017-12-201-2/+2
|
* utils.py: Add UtilErrorTristan Van Berkom2017-12-203-52/+84
| | | | | | | | | | | | | | | | | Report UtilError instead of OSError and similar python errors. Also ensure we catch system errors and raise UtilError with descriptive text instead; for the user experience; this is the difference between: o A FAILURE message with a description as to what went wrong (exception handled with UtilError) o A BUG message with the unhandled system error printed with a stack trace (exception left unhandled) Also, UtilsError and ProgramNotFoundError are now public exceptions declared in utils.py, where they will appear in the documentation.
* project: Export the name as a variableproject-nameMathieu Bridon2017-12-201-0/+3
| | | | | This is often useful, for example when the main element needs to do something with a path like /etc/%{project-name}/ .
* Fix a "TypeError: 'dict' object is not callable" in _plugincontext.pyValentin David2017-12-201-1/+1
|
* project: Rename required-project-version to format-versionJonathan Maw2017-12-141-2/+2
|
* project: Reduce code duplication when storing originsJonathan Maw2017-12-141-25/+33
|
* _plugincontext.py: Let plugins not have YAML defaultsMathieu Bridon2017-12-141-4/+8
| | | | | Source plugins typically do not have an accompanying YAML file with their default settings.
* element.py: Removing the exclamation mark from the overlaps warningTristan Van Berkom2017-12-131-1/+1
|
* Make external plugin loading require explicit configuration in project.confJonathan Maw2017-12-135-132/+148
| | | | | | In addition, it changes the "plugins" and "required-versions" fields, combining them for plugins and adding a new "required-project-version" field.
* _signals: always pop handlers, and restore statesAngelos Evripiotis2017-12-131-19/+23
|
* utils._tempdir: don't leak on exceptionsAngelos Evripiotis2017-12-131-4/+5
|
* source: clarify note on why to use this tmpdir()Angelos Evripiotis2017-12-131-3/+4
|
* _signals: note os._exit() on terminateAngelos Evripiotis2017-12-131-0/+4
| | | | | Make it explicit that we should not rely on 'finally' clauses to clean up for us in the event of termination.
* _frontend: Enable logging right away, fixes issue #168Tristan Van Berkom2017-12-133-149/+54
| | | | | | | | | | | Now we just assume that logging is turned on all the time, any messages must now always go through the central context messaging APIs. As a side effect, we now send all output messages that buildstream generates to stderr, leaving stdout only to payload types of output, such as parsible `bst show` output, the output of `bst workspace list` or `bst shell`.
* _pipeline.py: Removed tickers, use timed activities insteadTristan Van Berkom2017-12-131-54/+38
| | | | | | | | Currently this does not update the task list, and is for timing groups of activities from the frontend, or for timing long standing tasks which run directly in the frontend and not in a child task (like downloading the refs from a remote at load time before a build commences).
* plugin.py: Implement Plugin.timed_activity() using Context._timed_activity()Tristan Van Berkom2017-12-131-33/+5
|
* _context.py: Added _timed_activity() methodTristan Van Berkom2017-12-131-1/+53
| | | | A version of the function which can be shared with the frontend too.
* _frontend/main.py: Rewording `--track-all` build optionTristan Van Berkom2017-12-131-2/+2
|
* main.py: Add `bst build --track-all`Tristan Maat2017-12-131-1/+6
|
* Add `bst build --track-except`Tristan Maat2017-12-132-4/+8
|