Phillip Smyth pushed to branch mac_fixes at BuildStream / buildstream
Commits:
-
08fe704a
by Valentin David at 2018-08-21T12:46:21Z
-
c1b1076a
by Valentin David at 2018-08-21T12:46:21Z
-
6dfc7695
by Jürg Billeter at 2018-08-21T12:46:21Z
-
8f8c6cf6
by Jonathan Maw at 2018-08-21T12:46:21Z
-
6190a09f
by Jonathan Maw at 2018-08-21T12:46:22Z
-
39b1385b
by Jonathan Maw at 2018-08-21T12:46:22Z
-
42bfb46d
by Jonathan Maw at 2018-08-21T12:46:22Z
-
d87324b9
by Jonathan Maw at 2018-08-21T12:46:22Z
-
c3f8aff8
by knownexus at 2018-08-23T10:27:44Z
22 changed files:
- NEWS
- buildstream/_frontend/app.py
- buildstream/_loader/loadelement.py
- buildstream/_loader/types.py
- + buildstream/_platform/darwin.py
- buildstream/_platform/linux.py
- buildstream/_platform/platform.py
- buildstream/_project.py
- buildstream/_stream.py
- buildstream/_versions.py
- doc/source/format_declaring.rst
- setup.py
- tests/frontend/track.py
- tests/loader/dependencies.py
- + tests/loader/dependencies/elements/builddep-list.bst
- tests/loader/dependencies/elements/firstdep.bst
- + tests/loader/dependencies/elements/list-combine.bst
- + tests/loader/dependencies/elements/list-overlap.bst
- + tests/loader/dependencies/elements/runtimedep-list.bst
- + tests/loader/dependencies/elements/seconddep.bst
- + tests/loader/dependencies/elements/thirddep.bst
- tests/testutils/repo/bzr.py
Changes:
| 1 |
+=================
|
|
| 2 |
+buildstream 1.3.1
|
|
| 3 |
+=================
|
|
| 4 |
+ |
|
| 5 |
+ o Failed builds are included in the cache as well.
|
|
| 6 |
+ `bst checkout` will provide anything in `%{install-root}`.
|
|
| 7 |
+ A build including cached fails will cause any dependant elements
|
|
| 8 |
+ to not be scheduled and fail during artifact assembly,
|
|
| 9 |
+ and display the retry prompt during an interactive session.
|
|
| 10 |
+ |
|
| 11 |
+ o Due to enabling the use of relative workspaces, "Legacy" workspaces
|
|
| 12 |
+ may need to be closed and remade before the changes will affect them.
|
|
| 13 |
+ Downgrading after using this feature may result in workspaces
|
|
| 14 |
+ not functioning correctly
|
|
| 15 |
+ |
|
| 16 |
+ o Elements may now specify 'build-depends' and 'runtime-depends' fields
|
|
| 17 |
+ to avoid having to specify the dependency type for every entry in
|
|
| 18 |
+ 'depends'.
|
|
| 19 |
+ |
|
| 20 |
+ |
|
| 1 | 21 |
=================
|
| 2 | 22 |
buildstream 1.1.5
|
| 3 | 23 |
=================
|
| ... | ... | @@ -11,16 +31,8 @@ buildstream 1.1.5 |
| 11 | 31 |
|
| 12 | 32 |
o Added new `remote` source plugin for downloading file blobs
|
| 13 | 33 |
|
| 14 |
- o Failed builds are included in the cache as well.
|
|
| 15 |
- `bst checkout` will provide anything in `%{install-root}`.
|
|
| 16 |
- A build including cached fails will cause any dependant elements
|
|
| 17 |
- to not be scheduled and fail during artifact assembly,
|
|
| 18 |
- and display the retry prompt during an interactive session.
|
|
| 34 |
+ o Add support for the new include '(@)' directive in project.conf and .bst files
|
|
| 19 | 35 |
|
| 20 |
- o Due to enabling the use of relative workspaces, "Legacy" workspaces
|
|
| 21 |
- may need to be closed and remade before the changes will affect them.
|
|
| 22 |
- Downgrading after using this feature may result in workspaces
|
|
| 23 |
- not functioning correctly
|
|
| 24 | 36 |
|
| 25 | 37 |
=================
|
| 26 | 38 |
buildstream 1.1.4
|
| ... | ... | @@ -120,9 +120,10 @@ class App(): |
| 120 | 120 |
# SafeHardlinks FUSE needs to hold file descriptors for all processes in the sandbox.
|
| 121 | 121 |
# Avoid hitting the limit too quickly.
|
| 122 | 122 |
limits = resource.getrlimit(resource.RLIMIT_NOFILE)
|
| 123 |
- if limits[0] != limits[1]:
|
|
| 123 |
+ # This does not work on MacOSX
|
|
| 124 |
+ if limits[0] != limits[1] and not os.getenv('BST_FORCE_BACKEND', sys.platform).startswith('darwin'):
|
|
| 124 | 125 |
# Set soft limit to hard limit
|
| 125 |
- resource.setrlimit(resource.RLIMIT_NOFILE, (limits[1], limits[1]))
|
|
| 126 |
+ resource.setrlimit(resource.RLIMIT_NOFILE, (49152, limits[1]))
|
|
| 126 | 127 |
|
| 127 | 128 |
# create()
|
| 128 | 129 |
#
|
| ... | ... | @@ -71,6 +71,7 @@ class LoadElement(): |
| 71 | 71 |
'kind', 'depends', 'sources', 'sandbox',
|
| 72 | 72 |
'variables', 'environment', 'environment-nocache',
|
| 73 | 73 |
'config', 'public', 'description',
|
| 74 |
+ 'build-depends', 'runtime-depends',
|
|
| 74 | 75 |
])
|
| 75 | 76 |
|
| 76 | 77 |
# Extract the Dependencies
|
| ... | ... | @@ -127,28 +128,46 @@ class LoadElement(): |
| 127 | 128 |
# Returns:
|
| 128 | 129 |
# (list): a list of Dependency objects
|
| 129 | 130 |
#
|
| 130 |
-def _extract_depends_from_node(node):
|
|
| 131 |
- depends = _yaml.node_get(node, list, Symbol.DEPENDS, default_value=[])
|
|
| 131 |
+def _extract_depends_from_node(node, *, key=None):
|
|
| 132 |
+ if key is None:
|
|
| 133 |
+ build_depends = _extract_depends_from_node(node, key=Symbol.BUILD_DEPENDS)
|
|
| 134 |
+ runtime_depends = _extract_depends_from_node(node, key=Symbol.RUNTIME_DEPENDS)
|
|
| 135 |
+ depends = _extract_depends_from_node(node, key=Symbol.DEPENDS)
|
|
| 136 |
+ return build_depends + runtime_depends + depends
|
|
| 137 |
+ elif key == Symbol.BUILD_DEPENDS:
|
|
| 138 |
+ default_dep_type = Symbol.BUILD
|
|
| 139 |
+ elif key == Symbol.RUNTIME_DEPENDS:
|
|
| 140 |
+ default_dep_type = Symbol.RUNTIME
|
|
| 141 |
+ elif key == Symbol.DEPENDS:
|
|
| 142 |
+ default_dep_type = None
|
|
| 143 |
+ else:
|
|
| 144 |
+ assert False, "Unexpected value of key '{}'".format(key)
|
|
| 145 |
+ |
|
| 146 |
+ depends = _yaml.node_get(node, list, key, default_value=[])
|
|
| 132 | 147 |
output_deps = []
|
| 133 | 148 |
|
| 134 | 149 |
for dep in depends:
|
| 135 |
- dep_provenance = _yaml.node_get_provenance(node, key=Symbol.DEPENDS, indices=[depends.index(dep)])
|
|
| 150 |
+ dep_provenance = _yaml.node_get_provenance(node, key=key, indices=[depends.index(dep)])
|
|
| 136 | 151 |
|
| 137 | 152 |
if isinstance(dep, str):
|
| 138 |
- dependency = Dependency(dep, provenance=dep_provenance)
|
|
| 153 |
+ dependency = Dependency(dep, provenance=dep_provenance, dep_type=default_dep_type)
|
|
| 139 | 154 |
|
| 140 | 155 |
elif isinstance(dep, Mapping):
|
| 141 |
- _yaml.node_validate(dep, ['filename', 'type', 'junction'])
|
|
| 142 |
- |
|
| 143 |
- # Make type optional, for this we set it to None
|
|
| 144 |
- dep_type = _yaml.node_get(dep, str, Symbol.TYPE, default_value=None)
|
|
| 145 |
- if dep_type is None or dep_type == Symbol.ALL:
|
|
| 146 |
- dep_type = None
|
|
| 147 |
- elif dep_type not in [Symbol.BUILD, Symbol.RUNTIME]:
|
|
| 148 |
- provenance = _yaml.node_get_provenance(dep, key=Symbol.TYPE)
|
|
| 149 |
- raise LoadError(LoadErrorReason.INVALID_DATA,
|
|
| 150 |
- "{}: Dependency type '{}' is not 'build', 'runtime' or 'all'"
|
|
| 151 |
- .format(provenance, dep_type))
|
|
| 156 |
+ if default_dep_type:
|
|
| 157 |
+ _yaml.node_validate(dep, ['filename', 'junction'])
|
|
| 158 |
+ dep_type = default_dep_type
|
|
| 159 |
+ else:
|
|
| 160 |
+ _yaml.node_validate(dep, ['filename', 'type', 'junction'])
|
|
| 161 |
+ |
|
| 162 |
+ # Make type optional, for this we set it to None
|
|
| 163 |
+ dep_type = _yaml.node_get(dep, str, Symbol.TYPE, default_value=None)
|
|
| 164 |
+ if dep_type is None or dep_type == Symbol.ALL:
|
|
| 165 |
+ dep_type = None
|
|
| 166 |
+ elif dep_type not in [Symbol.BUILD, Symbol.RUNTIME]:
|
|
| 167 |
+ provenance = _yaml.node_get_provenance(dep, key=Symbol.TYPE)
|
|
| 168 |
+ raise LoadError(LoadErrorReason.INVALID_DATA,
|
|
| 169 |
+ "{}: Dependency type '{}' is not 'build', 'runtime' or 'all'"
|
|
| 170 |
+ .format(provenance, dep_type))
|
|
| 152 | 171 |
|
| 153 | 172 |
filename = _yaml.node_get(dep, str, Symbol.FILENAME)
|
| 154 | 173 |
junction = _yaml.node_get(dep, str, Symbol.JUNCTION, default_value=None)
|
| ... | ... | @@ -159,13 +178,13 @@ def _extract_depends_from_node(node): |
| 159 | 178 |
|
| 160 | 179 |
else:
|
| 161 | 180 |
index = depends.index(dep)
|
| 162 |
- p = _yaml.node_get_provenance(node, key=Symbol.DEPENDS, indices=[index])
|
|
| 181 |
+ p = _yaml.node_get_provenance(node, key=key, indices=[index])
|
|
| 163 | 182 |
raise LoadError(LoadErrorReason.INVALID_DATA,
|
| 164 | 183 |
"{}: Dependency is not specified as a string or a dictionary".format(p))
|
| 165 | 184 |
|
| 166 | 185 |
output_deps.append(dependency)
|
| 167 | 186 |
|
| 168 |
- # Now delete "depends", we dont want it anymore
|
|
| 169 |
- del node[Symbol.DEPENDS]
|
|
| 187 |
+ # Now delete the field, we dont want it anymore
|
|
| 188 |
+ del node[key]
|
|
| 170 | 189 |
|
| 171 | 190 |
return output_deps
|
| ... | ... | @@ -26,6 +26,8 @@ class Symbol(): |
| 26 | 26 |
FILENAME = "filename"
|
| 27 | 27 |
KIND = "kind"
|
| 28 | 28 |
DEPENDS = "depends"
|
| 29 |
+ BUILD_DEPENDS = "build-depends"
|
|
| 30 |
+ RUNTIME_DEPENDS = "runtime-depends"
|
|
| 29 | 31 |
SOURCES = "sources"
|
| 30 | 32 |
CONFIG = "config"
|
| 31 | 33 |
VARIABLES = "variables"
|
| 1 |
+#
|
|
| 2 |
+# Copyright (C) 2017 Codethink Limited
|
|
| 3 |
+#
|
|
| 4 |
+# This program is free software; you can redistribute it and/or
|
|
| 5 |
+# modify it under the terms of the GNU Lesser General Public
|
|
| 6 |
+# License as published by the Free Software Foundation; either
|
|
| 7 |
+# version 2 of the License, or (at your option) any later version.
|
|
| 8 |
+#
|
|
| 9 |
+# This library is distributed in the hope that it will be useful,
|
|
| 10 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 11 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
| 12 |
+# Lesser General Public License for more details.
|
|
| 13 |
+#
|
|
| 14 |
+# You should have received a copy of the GNU Lesser General Public
|
|
| 15 |
+# License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
| 16 |
+#
|
|
| 17 |
+# Authors:
|
|
| 18 |
+# Phillip Smyth <Phillip Smyth codethink co uk>
|
|
| 19 |
+ |
|
| 20 |
+import os
|
|
| 21 |
+ |
|
| 22 |
+from .._artifactcache.cascache import CASCache
|
|
| 23 |
+from .._exceptions import PlatformError
|
|
| 24 |
+from ..sandbox import SandboxChroot
|
|
| 25 |
+ |
|
| 26 |
+from . import Platform
|
|
| 27 |
+ |
|
| 28 |
+ |
|
| 29 |
+class Darwin(Platform):
|
|
| 30 |
+ |
|
| 31 |
+ def __init__(self, context):
|
|
| 32 |
+ |
|
| 33 |
+ super().__init__(context)
|
|
| 34 |
+ self._artifact_cache = CASCache(context)
|
|
| 35 |
+ |
|
| 36 |
+ # Not necessarily 100% reliable, but we want to fail early.
|
|
| 37 |
+ if os.geteuid() != 0:
|
|
| 38 |
+ raise PlatformError("Root privileges are required to run without bubblewrap.")
|
|
| 39 |
+ |
|
| 40 |
+ @property
|
|
| 41 |
+ def artifactcache(self):
|
|
| 42 |
+ return self._artifact_cache
|
|
| 43 |
+ |
|
| 44 |
+ def create_sandbox(self, *args, **kwargs):
|
|
| 45 |
+ return SandboxChroot(*args, **kwargs)
|
| ... | ... | @@ -52,6 +52,9 @@ class Linux(Platform): |
| 52 | 52 |
# Private Methods #
|
| 53 | 53 |
################################################
|
| 54 | 54 |
def _check_user_ns_available(self, context):
|
| 55 |
+ import os
|
|
| 56 |
+ if not os.path.exists('/dev/fuse')
|
|
| 57 |
+ return False
|
|
| 55 | 58 |
|
| 56 | 59 |
# Here, lets check if bwrap is able to create user namespaces,
|
| 57 | 60 |
# issue a warning if it's not available, and save the state
|
| ... | ... | @@ -40,19 +40,22 @@ class Platform(): |
| 40 | 40 |
|
| 41 | 41 |
@classmethod
|
| 42 | 42 |
def create_instance(cls, *args, **kwargs):
|
| 43 |
- if sys.platform.startswith('linux'):
|
|
| 44 |
- backend = 'linux'
|
|
| 45 |
- else:
|
|
| 46 |
- backend = 'unix'
|
|
| 47 |
- |
|
| 48 | 43 |
# Meant for testing purposes and therefore hidden in the
|
| 49 | 44 |
# deepest corners of the source code. Try not to abuse this,
|
| 50 | 45 |
# please?
|
| 51 | 46 |
if os.getenv('BST_FORCE_BACKEND'):
|
| 52 | 47 |
backend = os.getenv('BST_FORCE_BACKEND')
|
| 48 |
+ elif sys.platform.startswith('linux'):
|
|
| 49 |
+ backend = 'linux'
|
|
| 50 |
+ elif sys.platform.startswith('darwin'):
|
|
| 51 |
+ backend = 'darwin'
|
|
| 52 |
+ else:
|
|
| 53 |
+ backend = 'unix'
|
|
| 53 | 54 |
|
| 54 | 55 |
if backend == 'linux':
|
| 55 | 56 |
from .linux import Linux as PlatformImpl
|
| 57 |
+ elif backend == 'darwin':
|
|
| 58 |
+ from .darwin import Darwin as PlatformImpl
|
|
| 56 | 59 |
elif backend == 'unix':
|
| 57 | 60 |
from .unix import Unix as PlatformImpl
|
| 58 | 61 |
else:
|
| ... | ... | @@ -19,6 +19,7 @@ |
| 19 | 19 |
# Tiago Gomes <tiago gomes codethink co uk>
|
| 20 | 20 |
|
| 21 | 21 |
import os
|
| 22 |
+import sys
|
|
| 22 | 23 |
from collections import Mapping, OrderedDict
|
| 23 | 24 |
from pluginbase import PluginBase
|
| 24 | 25 |
from . import utils
|
| ... | ... | @@ -574,7 +575,10 @@ class Project(): |
| 574 | 575 |
# Based on some testing (mainly on AWS), maximum effective
|
| 575 | 576 |
# max-jobs value seems to be around 8-10 if we have enough cores
|
| 576 | 577 |
# users should set values based on workload and build infrastructure
|
| 577 |
- output.base_variables['max-jobs'] = str(min(len(os.sched_getaffinity(0)), 8))
|
|
| 578 |
+ if sys.platform.startswith('darwin'):
|
|
| 579 |
+ output.base_variables['max-jobs'] = str(min(os.cpu_count(), 8))
|
|
| 580 |
+ else:
|
|
| 581 |
+ output.base_variables['max-jobs'] = str(min(len(os.sched_getaffinity(0)), 8))
|
|
| 578 | 582 |
|
| 579 | 583 |
# Export options into variables, if that was requested
|
| 580 | 584 |
output.options.export_variables(output.base_variables)
|
| ... | ... | @@ -267,8 +267,11 @@ class Stream(): |
| 267 | 267 |
except_targets=None,
|
| 268 | 268 |
cross_junctions=False):
|
| 269 | 269 |
|
| 270 |
+ # We pass no target to build. Only to track. Passing build targets
|
|
| 271 |
+ # would fully load project configuration which might not be
|
|
| 272 |
+ # possible before tracking is done.
|
|
| 270 | 273 |
_, elements = \
|
| 271 |
- self._load(targets, targets,
|
|
| 274 |
+ self._load([], targets,
|
|
| 272 | 275 |
selection=selection, track_selection=selection,
|
| 273 | 276 |
except_targets=except_targets,
|
| 274 | 277 |
track_except_targets=except_targets,
|
| ... | ... | @@ -824,6 +827,12 @@ class Stream(): |
| 824 | 827 |
#
|
| 825 | 828 |
# A convenience method for loading element lists
|
| 826 | 829 |
#
|
| 830 |
+ # If `targets` is not empty used project configuration will be
|
|
| 831 |
+ # fully loaded. If `targets` is empty, tracking will still be
|
|
| 832 |
+ # resolved for elements in `track_targets`, but no build pipeline
|
|
| 833 |
+ # will be resolved. This is behavior is import for track() to
|
|
| 834 |
+ # not trigger full loading of project configuration.
|
|
| 835 |
+ #
|
|
| 827 | 836 |
# Args:
|
| 828 | 837 |
# targets (list of str): Main targets to load
|
| 829 | 838 |
# track_targets (list of str): Tracking targets
|
| ... | ... | @@ -871,7 +880,7 @@ class Stream(): |
| 871 | 880 |
#
|
| 872 | 881 |
# This can happen with `bst build --track`
|
| 873 | 882 |
#
|
| 874 |
- if not self._pipeline.targets_include(elements, track_elements):
|
|
| 883 |
+ if targets and not self._pipeline.targets_include(elements, track_elements):
|
|
| 875 | 884 |
raise StreamError("Specified tracking targets that are not "
|
| 876 | 885 |
"within the scope of primary targets")
|
| 877 | 886 |
|
| ... | ... | @@ -907,6 +916,10 @@ class Stream(): |
| 907 | 916 |
for element in track_selected:
|
| 908 | 917 |
element._schedule_tracking()
|
| 909 | 918 |
|
| 919 |
+ if not targets:
|
|
| 920 |
+ self._pipeline.resolve_elements(track_selected)
|
|
| 921 |
+ return [], track_selected
|
|
| 922 |
+ |
|
| 910 | 923 |
# ArtifactCache.setup_remotes expects all projects to be fully loaded
|
| 911 | 924 |
for project in self._context.get_projects():
|
| 912 | 925 |
project.ensure_fully_loaded()
|
| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 |
# This version is bumped whenever enhancements are made
|
| 24 | 24 |
# to the `project.conf` format or the core element format.
|
| 25 | 25 |
#
|
| 26 |
-BST_FORMAT_VERSION = 13
|
|
| 26 |
+BST_FORMAT_VERSION = 14
|
|
| 27 | 27 |
|
| 28 | 28 |
|
| 29 | 29 |
# The base BuildStream artifact version
|
| ... | ... | @@ -98,6 +98,68 @@ relative filename to the elements they depend on here. |
| 98 | 98 |
See :ref:`format_dependencies` for more information on the dependency model.
|
| 99 | 99 |
|
| 100 | 100 |
|
| 101 |
+.. _format_build_depends:
|
|
| 102 |
+ |
|
| 103 |
+Build-Depends
|
|
| 104 |
+~~~~~~~~~~~~~
|
|
| 105 |
+ |
|
| 106 |
+.. code:: yaml
|
|
| 107 |
+ |
|
| 108 |
+ # Specify some build-dependencies
|
|
| 109 |
+ build-depends:
|
|
| 110 |
+ - element1.bst
|
|
| 111 |
+ - element2.bst
|
|
| 112 |
+ |
|
| 113 |
+Build dependencies between elements can be specified with the ``build-depends`` attribute.
|
|
| 114 |
+The above code snippet is equivalent to:
|
|
| 115 |
+ |
|
| 116 |
+.. code:: yaml
|
|
| 117 |
+ |
|
| 118 |
+ # Specify some build-dependencies
|
|
| 119 |
+ depends:
|
|
| 120 |
+ - filename: element1.bst
|
|
| 121 |
+ type: build
|
|
| 122 |
+ - filename: element2.bst
|
|
| 123 |
+ type: build
|
|
| 124 |
+ |
|
| 125 |
+See :ref:`format_dependencies` for more information on the dependency model.
|
|
| 126 |
+ |
|
| 127 |
+.. note::
|
|
| 128 |
+ |
|
| 129 |
+ The ``build-depends`` configuration is available since :ref:`format version 14 <project_format_version>`
|
|
| 130 |
+ |
|
| 131 |
+ |
|
| 132 |
+.. _format_runtime_depends:
|
|
| 133 |
+ |
|
| 134 |
+Runtime-Depends
|
|
| 135 |
+~~~~~~~~~~~~~~~
|
|
| 136 |
+ |
|
| 137 |
+.. code:: yaml
|
|
| 138 |
+ |
|
| 139 |
+ # Specify some runtime-dependencies
|
|
| 140 |
+ runtime-depends:
|
|
| 141 |
+ - element1.bst
|
|
| 142 |
+ - element2.bst
|
|
| 143 |
+ |
|
| 144 |
+Runtime dependencies between elements can be specified with the ``runtime-depends`` attribute.
|
|
| 145 |
+The above code snippet is equivalent to:
|
|
| 146 |
+ |
|
| 147 |
+.. code:: yaml
|
|
| 148 |
+ |
|
| 149 |
+ # Specify some runtime-dependencies
|
|
| 150 |
+ depends:
|
|
| 151 |
+ - filename: element1.bst
|
|
| 152 |
+ type: runtime
|
|
| 153 |
+ - filename: element2.bst
|
|
| 154 |
+ type: runtime
|
|
| 155 |
+ |
|
| 156 |
+See :ref:`format_dependencies` for more information on the dependency model.
|
|
| 157 |
+ |
|
| 158 |
+.. note::
|
|
| 159 |
+ |
|
| 160 |
+ The ``runtime-depends`` configuration is available since :ref:`format version 14 <project_format_version>`
|
|
| 161 |
+ |
|
| 162 |
+ |
|
| 101 | 163 |
.. _format_sources:
|
| 102 | 164 |
|
| 103 | 165 |
Sources
|
| ... | ... | @@ -276,8 +338,8 @@ attributes are suitable. |
| 276 | 338 |
|
| 277 | 339 |
.. note::
|
| 278 | 340 |
|
| 279 |
- Note the order in which element dependencies are declared in the ``depends``
|
|
| 280 |
- list is not meaningful.
|
|
| 341 |
+ Note the order in which element dependencies are declared in the ``depends``,
|
|
| 342 |
+ ``build-depends`` and ``runtime-depends`` lists are not meaningful.
|
|
| 281 | 343 |
|
| 282 | 344 |
Dependency dictionary:
|
| 283 | 345 |
|
| ... | ... | @@ -299,6 +361,8 @@ Attributes: |
| 299 | 361 |
* ``type``
|
| 300 | 362 |
|
| 301 | 363 |
This attribute is used to express the :ref:`dependency type <format_dependencies_types>`.
|
| 364 |
+ This field is not permitted in :ref:`Build-Depends <format_build_depends>` or
|
|
| 365 |
+ :ref:`Runtime-Depends <format_runtime_depends>`.
|
|
| 302 | 366 |
|
| 303 | 367 |
* ``junction``
|
| 304 | 368 |
|
| ... | ... | @@ -258,7 +258,7 @@ setup(name='BuildStream', |
| 258 | 258 |
install_requires=[
|
| 259 | 259 |
'setuptools',
|
| 260 | 260 |
'psutil',
|
| 261 |
- 'ruamel.yaml <= 0.15',
|
|
| 261 |
+ 'ruamel.yaml < 0.15.52',
|
|
| 262 | 262 |
'pluginbase',
|
| 263 | 263 |
'Click',
|
| 264 | 264 |
'blessings',
|
| ... | ... | @@ -612,3 +612,25 @@ def test_track_include_junction(cli, tmpdir, datafiles, ref_storage, kind): |
| 612 | 612 |
# Assert that we are now buildable because the source is
|
| 613 | 613 |
# now cached.
|
| 614 | 614 |
assert cli.get_element_state(project, element_name) == 'buildable'
|
| 615 |
+ |
|
| 616 |
+ |
|
| 617 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
| 618 |
+@pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')])
|
|
| 619 |
+@pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS])
|
|
| 620 |
+def test_track_junction_included(cli, tmpdir, datafiles, ref_storage, kind):
|
|
| 621 |
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
| 622 |
+ element_path = os.path.join(project, 'elements')
|
|
| 623 |
+ subproject_path = os.path.join(project, 'files', 'sub-project')
|
|
| 624 |
+ sub_element_path = os.path.join(subproject_path, 'elements')
|
|
| 625 |
+ junction_path = os.path.join(element_path, 'junction.bst')
|
|
| 626 |
+ |
|
| 627 |
+ configure_project(project, {
|
|
| 628 |
+ 'ref-storage': ref_storage,
|
|
| 629 |
+ '(@)': ['junction.bst:test.yml']
|
|
| 630 |
+ })
|
|
| 631 |
+ |
|
| 632 |
+ generate_junction(str(tmpdir.join('junction_repo')),
|
|
| 633 |
+ subproject_path, junction_path, store_ref=False)
|
|
| 634 |
+ |
|
| 635 |
+ result = cli.run(project=project, args=['track', 'junction.bst'])
|
|
| 636 |
+ result.assert_success()
|
| ... | ... | @@ -3,6 +3,7 @@ import pytest |
| 3 | 3 |
|
| 4 | 4 |
from buildstream._exceptions import LoadError, LoadErrorReason
|
| 5 | 5 |
from buildstream._loader import Loader, MetaElement
|
| 6 |
+from tests.testutils import cli
|
|
| 6 | 7 |
from . import make_loader
|
| 7 | 8 |
|
| 8 | 9 |
DATA_DIR = os.path.join(
|
| ... | ... | @@ -27,7 +28,7 @@ def test_two_files(datafiles): |
| 27 | 28 |
assert(len(element.dependencies) == 1)
|
| 28 | 29 |
firstdep = element.dependencies[0]
|
| 29 | 30 |
assert(isinstance(firstdep, MetaElement))
|
| 30 |
- assert(firstdep.kind == 'thefirstdep')
|
|
| 31 |
+ assert(firstdep.kind == 'manual')
|
|
| 31 | 32 |
|
| 32 | 33 |
|
| 33 | 34 |
@pytest.mark.datafiles(DATA_DIR)
|
| ... | ... | @@ -47,7 +48,7 @@ def test_shared_dependency(datafiles): |
| 47 | 48 |
#
|
| 48 | 49 |
firstdep = element.dependencies[0]
|
| 49 | 50 |
assert(isinstance(firstdep, MetaElement))
|
| 50 |
- assert(firstdep.kind == 'thefirstdep')
|
|
| 51 |
+ assert(firstdep.kind == 'manual')
|
|
| 51 | 52 |
assert(len(firstdep.dependencies) == 0)
|
| 52 | 53 |
|
| 53 | 54 |
# The second specified dependency is 'shareddep'
|
| ... | ... | @@ -86,7 +87,7 @@ def test_dependency_dict(datafiles): |
| 86 | 87 |
assert(len(element.dependencies) == 1)
|
| 87 | 88 |
firstdep = element.dependencies[0]
|
| 88 | 89 |
assert(isinstance(firstdep, MetaElement))
|
| 89 |
- assert(firstdep.kind == 'thefirstdep')
|
|
| 90 |
+ assert(firstdep.kind == 'manual')
|
|
| 90 | 91 |
|
| 91 | 92 |
|
| 92 | 93 |
@pytest.mark.datafiles(DATA_DIR)
|
| ... | ... | @@ -186,3 +187,49 @@ def test_all_dependency(datafiles): |
| 186 | 187 |
assert(isinstance(firstdep, MetaElement))
|
| 187 | 188 |
firstbuilddep = element.build_dependencies[0]
|
| 188 | 189 |
assert(firstdep == firstbuilddep)
|
| 190 |
+ |
|
| 191 |
+ |
|
| 192 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
| 193 |
+def test_list_build_dependency(cli, datafiles):
|
|
| 194 |
+ project = str(datafiles)
|
|
| 195 |
+ |
|
| 196 |
+ # Check that the pipeline includes the build dependency
|
|
| 197 |
+ deps = cli.get_pipeline(project, ['elements/builddep-list.bst'], scope="build")
|
|
| 198 |
+ assert "elements/firstdep.bst" in deps
|
|
| 199 |
+ |
|
| 200 |
+ |
|
| 201 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
| 202 |
+def test_list_runtime_dependency(cli, datafiles):
|
|
| 203 |
+ project = str(datafiles)
|
|
| 204 |
+ |
|
| 205 |
+ # Check that the pipeline includes the runtime dependency
|
|
| 206 |
+ deps = cli.get_pipeline(project, ['elements/runtimedep-list.bst'], scope="run")
|
|
| 207 |
+ assert "elements/firstdep.bst" in deps
|
|
| 208 |
+ |
|
| 209 |
+ |
|
| 210 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
| 211 |
+def test_list_dependencies_combined(cli, datafiles):
|
|
| 212 |
+ project = str(datafiles)
|
|
| 213 |
+ |
|
| 214 |
+ # Check that runtime deps get combined
|
|
| 215 |
+ rundeps = cli.get_pipeline(project, ['elements/list-combine.bst'], scope="run")
|
|
| 216 |
+ assert "elements/firstdep.bst" not in rundeps
|
|
| 217 |
+ assert "elements/seconddep.bst" in rundeps
|
|
| 218 |
+ assert "elements/thirddep.bst" in rundeps
|
|
| 219 |
+ |
|
| 220 |
+ # Check that build deps get combined
|
|
| 221 |
+ builddeps = cli.get_pipeline(project, ['elements/list-combine.bst'], scope="build")
|
|
| 222 |
+ assert "elements/firstdep.bst" in builddeps
|
|
| 223 |
+ assert "elements/seconddep.bst" not in builddeps
|
|
| 224 |
+ assert "elements/thirddep.bst" in builddeps
|
|
| 225 |
+ |
|
| 226 |
+ |
|
| 227 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
| 228 |
+def test_list_overlap(cli, datafiles):
|
|
| 229 |
+ project = str(datafiles)
|
|
| 230 |
+ |
|
| 231 |
+ # Check that dependencies get merged
|
|
| 232 |
+ rundeps = cli.get_pipeline(project, ['elements/list-overlap.bst'], scope="run")
|
|
| 233 |
+ assert "elements/firstdep.bst" in rundeps
|
|
| 234 |
+ builddeps = cli.get_pipeline(project, ['elements/list-overlap.bst'], scope="build")
|
|
| 235 |
+ assert "elements/firstdep.bst" in builddeps
|
| 1 |
+kind: stack
|
|
| 2 |
+description: This element has a build-only dependency specified via build-depends
|
|
| 3 |
+build-depends:
|
|
| 4 |
+ - elements/firstdep.bst
|
| 1 |
-kind: thefirstdep
|
|
| 1 |
+kind: manual
|
|
| 2 | 2 |
description: This is the first dependency
|
| 1 |
+kind: stack
|
|
| 2 |
+description: This element depends on three elements in different ways
|
|
| 3 |
+build-depends:
|
|
| 4 |
+- elements/firstdep.bst
|
|
| 5 |
+runtime-depends:
|
|
| 6 |
+- elements/seconddep.bst
|
|
| 7 |
+depends:
|
|
| 8 |
+- elements/thirddep.bst
|
| 1 |
+kind: stack
|
|
| 2 |
+description: This element depends on two elements in different ways
|
|
| 3 |
+build-depends:
|
|
| 4 |
+- elements/firstdep.bst
|
|
| 5 |
+depends:
|
|
| 6 |
+- filename: elements/firstdep.bst
|
|
| 7 |
+ type: runtime
|
| 1 |
+kind: stack
|
|
| 2 |
+description: This element has a runtime-only dependency
|
|
| 3 |
+runtime-depends:
|
|
| 4 |
+ - elements/firstdep.bst
|
| 1 |
+kind: manual
|
|
| 2 |
+description: This is the second dependency
|
| 1 |
+kind: manual
|
|
| 2 |
+description: This is the third dependency
|
| ... | ... | @@ -20,12 +20,12 @@ class Bzr(Repo): |
| 20 | 20 |
def create(self, directory):
|
| 21 | 21 |
branch_dir = os.path.join(self.repo, 'trunk')
|
| 22 | 22 |
|
| 23 |
- subprocess.call(['bzr', 'init-repo', self.repo], env=BZR_ENV)
|
|
| 24 |
- subprocess.call(['bzr', 'init', branch_dir], env=BZR_ENV)
|
|
| 23 |
+ subprocess.call(['bzr', 'init-repo', self.repo], env=BZR_ENV, shell=True)
|
|
| 24 |
+ subprocess.call(['bzr', 'init', branch_dir], env=BZR_ENV, shell=True)
|
|
| 25 | 25 |
self.copy_directory(directory, branch_dir)
|
| 26 |
- subprocess.call(['bzr', 'add', '.'], env=BZR_ENV, cwd=branch_dir)
|
|
| 26 |
+ subprocess.call(['bzr', 'add', '.'], env=BZR_ENV, cwd=branch_dir, shell=True)
|
|
| 27 | 27 |
subprocess.call(['bzr', 'commit', '--message="Initial commit"'],
|
| 28 |
- env=BZR_ENV, cwd=branch_dir)
|
|
| 28 |
+ env=BZR_ENV, cwd=branch_dir, shell=True)
|
|
| 29 | 29 |
|
| 30 | 30 |
return self.latest_commit()
|
| 31 | 31 |
|
| ... | ... | @@ -45,5 +45,5 @@ class Bzr(Repo): |
| 45 | 45 |
'bzr', 'version-info',
|
| 46 | 46 |
'--custom', '--template={revno}',
|
| 47 | 47 |
os.path.join(self.repo, 'trunk')
|
| 48 |
- ], env=BZR_ENV)
|
|
| 48 |
+ ], env=BZR_ENV, shell=True)
|
|
| 49 | 49 |
return output.decode('UTF-8').strip()
|
