sb: Bail out only if hash definitions conflict

This commit is contained in:
Sebastian Huber 2017-03-01 08:18:07 +01:00
parent 08f709966f
commit 4f72b95e60

View File

@ -97,13 +97,17 @@ def hash(args, macros, error):
return return
_map = 'hashes' _map = 'hashes'
_file = macros.expand(args[1]) _file = macros.expand(args[1])
if _file in macros.map_keys(_map): new_value = '%s %s' % (args[0], args[2])
error('hash already set: %s' % (args[1])) existing_value = get_hash(_file, macros)
return if existing_value is not None:
macros.create_map(_map) if existing_value != new_value:
macros.set_write_map(_map) error('conflicting hash definitions for: %s' % (args[1]))
macros.define(_file, '%s %s' % (args[0], args[2])) return
macros.unset_write_map() else:
macros.create_map(_map)
macros.set_write_map(_map)
macros.define(_file, new_value)
macros.unset_write_map()
return None return None
def get(label, name, macros, error): def get(label, name, macros, error):