Skip to content

Commit 462954f

Browse files
authored
Merge pull request #587 from jkloetzke/polish-layers
Polish layers
2 parents 3277746 + b392e6b commit 462954f

4 files changed

Lines changed: 26 additions & 24 deletions

File tree

‎doc/manpages/bob-build-dev.rst‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ Options
9494
given regular expression (``--download`` option will be overwritten for
9595
matching modules).
9696
Can be used multiple times (if regex is used also multiple times the last mode wins).
97-
A sub layer is separated with a ``/``.
9897

9998
no=<layer regex>
10099
build modules of a layer that match a given regular expression from sources

‎doc/manual/configuration.rst‎

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,15 @@ recipes may reference each other freely. The only restriction is that a
9292
particular recipe or class must only be defined by one layer. It is not allowed
9393
to "overwrite" a recipe in a layer above.
9494

95-
Layers must be configured in ``config.yaml`` to be picked up. This is just a
96-
simple list of layer names that are then expected in the ``layers`` directory::
95+
Layers must be configured in ``config.yaml`` to be picked up. This is a list of
96+
either simple layer names that are then expected in the ``layers`` directory or
97+
an SCM specification where the layer is fetched from::
9798

9899
layers:
99100
- myapp
100-
- bsp
101+
- name: bsp
102+
scm: git
103+
url: git@github.com:...
101104

102105
The order of layers is important with respect to settings made by
103106
``default.yaml`` in the various layers. The project root has the highest
@@ -1927,10 +1930,10 @@ equal.
19271930
layers
19281931
~~~~~~
19291932

1930-
Type: List of strings or SCM-Dictionary or List of SCM-Dictionaries
1933+
Type: List of strings or SCM-Dictionaries
19311934

19321935
The ``layers`` section consists of a list of layer names that are then expected
1933-
in the ``layers`` directory relative to the ``conig.yaml`` referencing them::
1936+
in the ``layers`` directory of the project root directory::
19341937

19351938
layers:
19361939
- myapp
@@ -1949,9 +1952,10 @@ of lower precedence.
19491952

19501953
See :ref:`configuration` for more information.
19511954

1952-
Typically layers have their own VCS. To provide them to the root-recipes common
1953-
VCS-methods like git-submodules can be used. Another possibility is to provide a
1954-
SCM-Dictionary (see :ref:`configuration-recipes-scm`)::
1955+
Typically, layers are stored in their own SCM. To provide them to the root
1956+
recipes, common SCM-methods like git-submodules can be used. Another
1957+
possibility is to provide an SCM-Dictionary (see
1958+
:ref:`configuration-recipes-scm`) and let Bob manage the layer::
19551959

19561960
layers:
19571961
- name: myapp
@@ -1960,17 +1964,17 @@ SCM-Dictionary (see :ref:`configuration-recipes-scm`)::
19601964
commit: ...
19611965
- bsp
19621966

1963-
Only `git`,`svn`,`url` and `cvs` scm's are supported for layers. During layers
1964-
checkout the regular ``whitelist`` and ``scmOverrides`` settings are not used.
1965-
Instead the checkout could be controlled by ``layersWhitelist`` and
1966-
``layersScmOverrides``.
1967-
1968-
If a scmSpec is given Bob takes care of the layer management:
1967+
If a layer SCM specification is given, Bob takes care of the layer management:
19691968

1970-
- layers are checked out / updated during bob-build (except build-only)
1971-
- bob layers command to update / show status (see :ref:`manpage-layers`).
1969+
- Layers are checked out / updated during bob-build (except build-only).
1970+
- The ``bob layers`` command can update layers or show their status (see
1971+
:ref:`manpage-layers`).
19721972

1973-
.. _configuration-config-plugins:
1973+
Only git, svn, url and cvs SCMs are supported for layers. Because layers are
1974+
fetched and updated before any :ref:`configuration-config-usr` is parsed, the
1975+
regular ``whitelist`` and ``scmOverrides`` settings are not used. Instead,
1976+
layer checkouts are controlled by ``layersWhitelist`` and
1977+
``layersScmOverrides``.
19741978

19751979
layersWhitelist
19761980
~~~~~~~~~~~~~~~
@@ -1983,6 +1987,8 @@ layersScmOverrides
19831987
:ref:`configuration-config-scmOverrides` used by layers checkout / update.
19841988
Conditional overrides are not supported.
19851989

1990+
.. _configuration-config-plugins:
1991+
19861992
plugins
19871993
~~~~~~~
19881994

‎pym/bob/cmds/layers.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def doLayers(argv, bobRoot):
3737
updateLayers(recipes, loop, defines, args.verbose,
3838
args.attic, args.layerConfig)
3939

40-
recipes.parse(defines)
40+
recipes.parse(defines, noLayers=True)
4141

4242
layers = Layers(recipes, loop, defines, args.attic)
4343
layers.setLayerConfig(args.layerConfig)

‎pym/bob/layers.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import shutil
55
from .errors import BuildError
66
from .invoker import CmdFailedError, InvocationError, Invoker
7-
from .scm import ScmOverride
7+
from .scm import getScm, ScmOverride
88
from .state import BobState
99
from .stringparser import Env
1010
from .input import RecipeSet, Scm, YamlCache
@@ -81,10 +81,7 @@ async def __checkoutTask(self, verbose):
8181
if not created and oldState is not None and \
8282
newState["digest"] != oldState["digest"]:
8383

84-
canSwitch = self.__scm.canSwitch(Scm(oldState["prop"],
85-
Env(self.__defines),
86-
overrides=self.__overrides,
87-
recipeSet=self.__recipes))
84+
canSwitch = self.__scm.canSwitch(getScm(oldState["prop"]))
8885
if canSwitch:
8986
log("SWITCH: Layer '{}' .. ok".format(self.getName()), EXECUTED, INFO)
9087
ret = await invoker.executeScmSwitch(self.__scm, oldState["prop"])

0 commit comments

Comments
 (0)