From 841120ec9598bae88c1ee745c7574e46f759212e Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Thu, 19 Sep 2019 09:40:36 +1000 Subject: sb: Detect duplicate adds of patches. --- source-builder/sb/sources.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source-builder/sb/sources.py b/source-builder/sb/sources.py index c5f0037..a619778 100644 --- a/source-builder/sb/sources.py +++ b/source-builder/sb/sources.py @@ -34,15 +34,21 @@ def add(label, args, macros, error): if len(args) < 2: error('%%%s requires at least 2 arguments' % (label)) _map = '%s-%s' % (label, args[0]) + _value = ' '.join(args[1:]) macros.create_map(_map) index = 0 while True: key = _make_key(label, index) if key not in macros.map_keys(_map): break + macros.set_read_map(_map) + value = macros.get_value(key) + macros.unset_read_map(_map) + if value == _value: + error('%%%s duplicate add: %s' % (label, _value)) index += 1 macros.set_write_map(_map) - macros.define(key, ' '.join(args[1:])) + macros.define(key, _value) macros.unset_write_map() return None -- cgit v1.2.3