[rtems-source-builder commit] sb: Bail out only if hash definitions conflict

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Mar 2 06:29:47 UTC 2017



On 02/03/17 00:11, Chris Johns wrote:
>  [ correct list this time ]
>
> On 01/03/2017 23:33, Sebastian Huber wrote:
>> Module:    rtems-source-builder
>> Branch:    master
>> Commit:    4f72b95e60eedca772994f740a1fd0c973608632
>> Changeset: 
>> http://git.rtems.org/rtems-source-builder/commit/?id=4f72b95e60eedca772994f740a1fd0c973608632
>>
>> Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
>> Date:      Wed Mar  1 08:18:07 2017 +0100
>
> Can all future commits to the RSB please be posted to the devel list 
> for review? This is changes to packages and changes to the code. Thanks.

Ok.

>
>> sb: Bail out only if hash definitions conflict
>
> This patch is wrong and should raise an exception if it is an error.

I didn't change the error handling. All errors in this file call the 
error() function. The is no "raise" in this file.

>
>>
>> ---
>>
>>  source-builder/sb/sources.py | 18 +++++++++++-------
>>  1 file 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
>
> This looks wrong (I know it is existing :)) ...
>
>> -    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
>
> ... and the same with this ...
>
>> +    else:
>> +        macros.create_map(_map)
>> +        macros.set_write_map(_map)
>> +        macros.define(_file, new_value)
>> +        macros.unset_write_map()
>>      return None
>
> ... cause None is returned.

Yes, just like before.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the devel mailing list