mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
sb: Add support to get sources and hashses.
This commit is contained in:
parent
aaa015eda0
commit
4934771892
@ -53,8 +53,8 @@ def _humanize_bytes(bytes, precision = 1):
|
|||||||
|
|
||||||
def _hash_check(file_, absfile, macros, remove = True):
|
def _hash_check(file_, absfile, macros, remove = True):
|
||||||
failed = False
|
failed = False
|
||||||
if file_.lower() in macros.map_keys('hashes'):
|
hash = sources.get_hash(file_.lower(), macros)
|
||||||
m1, m2, hash = macros.get(file_.lower(), globals = False, maps = 'hashes')
|
if hash is not None:
|
||||||
hash = hash.split()
|
hash = hash.split()
|
||||||
if len(hash) != 2:
|
if len(hash) != 2:
|
||||||
raise error.internal('invalid hash format: %s' % (file_))
|
raise error.internal('invalid hash format: %s' % (file_))
|
||||||
|
@ -62,7 +62,7 @@ def process(label, args, macros, error):
|
|||||||
if label != 'source' and label != 'patch':
|
if label != 'source' and label != 'patch':
|
||||||
error('invalid source type: %s' % (label))
|
error('invalid source type: %s' % (label))
|
||||||
args = _args(args)
|
args = _args(args)
|
||||||
log.output('sources: %s' % (' '.join(args)))
|
log.trace('sources: %s' % (' '.join(args)))
|
||||||
if len(args) < 3:
|
if len(args) < 3:
|
||||||
error('%%%s requires at least 3 arguments: %s' % (label, ' '.join(args)))
|
error('%%%s requires at least 3 arguments: %s' % (label, ' '.join(args)))
|
||||||
if args[0] == 'set':
|
if args[0] == 'set':
|
||||||
@ -86,3 +86,41 @@ def hash(args, macros, error):
|
|||||||
macros.define(_file, '%s %s' % (args[0], args[2]))
|
macros.define(_file, '%s %s' % (args[0], args[2]))
|
||||||
macros.unset_write_map()
|
macros.unset_write_map()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def get(type_, name, macros, error):
|
||||||
|
_map = '%s-%s' % (type_, name)
|
||||||
|
keys = macros.map_keys(_map)
|
||||||
|
if len(keys) == 0:
|
||||||
|
error('no %s set: %s (%s)' % (type_, name, _map))
|
||||||
|
srcs = []
|
||||||
|
for s in keys:
|
||||||
|
sm = macros.get(s, globals = False, maps = _map)
|
||||||
|
if sm is None:
|
||||||
|
error('source macro not found: %s in %s (%s)' % (s, name, _map))
|
||||||
|
srcs += [sm[2]]
|
||||||
|
return srcs
|
||||||
|
|
||||||
|
def get_sources(name, macros, error):
|
||||||
|
return get('source', name, macros, error)
|
||||||
|
|
||||||
|
def get_patches(name, macros, error):
|
||||||
|
return get('patch', name, macros, error)
|
||||||
|
|
||||||
|
def get_names(type_, macros, error):
|
||||||
|
names = []
|
||||||
|
for m in macros.maps():
|
||||||
|
if m.startswith('%s-' % (type_)):
|
||||||
|
names += [m[len('%s-' % (type_)):]]
|
||||||
|
return names
|
||||||
|
|
||||||
|
def get_source_names(macros, error):
|
||||||
|
return get_names('source', macros, error)
|
||||||
|
|
||||||
|
def get_patch_names(macros, error):
|
||||||
|
return get_names('patch', macros, error)
|
||||||
|
|
||||||
|
def get_hash(name, macros):
|
||||||
|
hash = None
|
||||||
|
if name in macros.map_keys('hashes'):
|
||||||
|
m1, m2, hash = macros.get(name, globals = False, maps = 'hashes')
|
||||||
|
return hash
|
||||||
|
Loading…
x
Reference in New Issue
Block a user