summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-03-01 08:18:07 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-03-01 08:21:01 +0100
commit4f72b95e60eedca772994f740a1fd0c973608632 (patch)
tree9f9a69f8f64878c52d2ad00c8011d97890167027
parent08f709966f970fd10488a799f37ebd528a12c1c7 (diff)
downloadrtems-source-builder-4f72b95e60eedca772994f740a1fd0c973608632.tar.bz2
sb: Bail out only if hash definitions conflict
-rw-r--r--source-builder/sb/sources.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/source-builder/sb/sources.py b/source-builder/sb/sources.py
index fb6d819..967becc 100644
--- a/source-builder/sb/sources.py
+++ b/source-builder/sb/sources.py
@@ -97,13 +97,17 @@ def hash(args, macros, error):
return
_map = 'hashes'
_file = macros.expand(args[1])
- if _file in macros.map_keys(_map):
- error('hash already set: %s' % (args[1]))
- return
- macros.create_map(_map)
- macros.set_write_map(_map)
- macros.define(_file, '%s %s' % (args[0], args[2]))
- macros.unset_write_map()
+ new_value = '%s %s' % (args[0], args[2])
+ existing_value = get_hash(_file, macros)
+ if existing_value is not None:
+ if existing_value != new_value:
+ error('conflicting hash definitions for: %s' % (args[1]))
+ return
+ else:
+ macros.create_map(_map)
+ macros.set_write_map(_map)
+ macros.define(_file, new_value)
+ macros.unset_write_map()
return None
def get(label, name, macros, error):