empty 'set' in scmOverrides not handled
rhubert opened this issue · 1 comments
rhubert commented
recipes/root.yaml
root: True
checkoutSCM:
scm: git
url: http://foo/bar
buildScript: /bin/true
packageScript: /bin/true
default.yaml
scmOverrides:
-
match:
url: "http://foo/bar"
del: [tag, commit]
set:
An internal Exception has occured. This should not have happenend.
Please open an issue at https://github.com/BobBuildTool/bob with the following backtrace:
Bob version 0.22.0rc2.dev2+gcb7ebf0f
Traceback (most recent call last):
File "/home/hubert/projects/bob/pym/bob/scripts.py", line 146, in catchErrors
ret = fun(*args, **kwargs)
File "/home/hubert/projects/bob/pym/bob/scripts.py", line 254, in cmd
ret = cmd(args.args, bobRoot)
File "/home/hubert/projects/bob/pym/bob/scripts.py", line 59, in __ls
doLS(*args, **kwargs)
File "/home/hubert/projects/bob/pym/bob/cmds/misc.py", line 108, in doLS
for (stack, root) in packages.queryTreePath(args.package, showAlternates):
File "/home/hubert/projects/bob/pym/bob/pathspec.py", line 910, in queryTreePath
(nodes, valid) = self.__query(path)
File "/home/hubert/projects/bob/pym/bob/pathspec.py", line 887, in __query
root = self.__getGraphRoot()
File "/home/hubert/projects/bob/pym/bob/pathspec.py", line 838, in __getGraphRoot
self.__graph = PkgGraphNode.init(".bob-tree.sqlite3", self.__cacheKey,
File "/home/hubert/projects/bob/pym/bob/pathspec.py", line 592, in init
root = PkgGraphNode.__convertPackageToGraph(db, rootGenerator())
File "/home/hubert/projects/bob/pym/bob/pathspec.py", line 901, in getRootPackage
self.__root = self.__generator()
File "/home/hubert/projects/bob/pym/bob/input.py", line 3774, in <lambda>
lambda: self.__generatePackages(nameFormatter, cacheKey, sandboxEnabled),
File "/home/hubert/projects/bob/pym/bob/input.py", line 3747, in __generatePackages
result = self.__rootRecipe.prepare(self.__rootEnv, sandboxEnabled, states)[0]
File "/home/hubert/projects/bob/pym/bob/input.py", line 2390, in prepare
p, s = r.prepare(thisDepEnv, sandboxEnabled, depStates,
File "/home/hubert/projects/bob/pym/bob/input.py", line 2565, in prepare
srcCoreStep = p.createCoreCheckoutStep(self.__checkout,
File "/home/hubert/projects/bob/pym/bob/input.py", line 1520, in createCoreCheckoutStep
ret = self.checkoutStep = CoreCheckoutStep(self, checkout, checkoutSCMs,
File "/home/hubert/projects/bob/pym/bob/input.py", line 1269, in __init__
self.scmList = [ Scm(scm, fullEnv, overrides, recipeSet)
File "/home/hubert/projects/bob/pym/bob/input.py", line 1269, in <listcomp>
self.scmList = [ Scm(scm, fullEnv, overrides, recipeSet)
File "/home/hubert/projects/bob/pym/bob/input.py", line 387, in Scm
matched, spec = override.mangle(spec, env)
File "/home/hubert/projects/bob/pym/bob/scm/scm.py", line 75, in mangle
rm, set = self.__applyEnv(env)
File "/home/hubert/projects/bob/pym/bob/scm/scm.py", line 68, in __applyEnv
for (k,v) in self.__set.items()
AttributeError: 'NoneType' object has no attribute 'items'
rhubert commented
possible fix:
diff --git a/pym/bob/input.py b/pym/bob/input.py
index 31cc3bae..b0b526bb 100644
--- a/pym/bob/input.py
+++ b/pym/bob/input.py
@@ -2883,6 +2883,15 @@ class MountValidator:
raise schema.SchemaError(None, "Mount entry must be a string or a two/three items list!")
+class DummyValidator:
+ def __init__(self, name):
+ self.__name = name
+
+ def validate(self, data):
+ if data is not None:
+ return data
+ raise schema.SchemaError(None, self.__name + " should not be empty")
+
class RecipeSet:
"""The RecipeSet corresponds to the project root directory.
@@ -3139,7 +3148,7 @@ class RecipeSet:
schema.Optional('if') : schema.Or(str, IfExpression),
schema.Optional('match') : schema.Schema({ str: object }),
schema.Optional('del') : [str],
- schema.Optional('set') : object,
+ schema.Optional('set') : schema.Schema(DummyValidator("scmOverrides: set")),
schema.Optional('replace') : schema.Schema({
str : schema.Schema({
'pattern' : str,