Changeset 4934771 in rtems-source-builder


Ignore:
Timestamp:
Aug 9, 2014, 1:49:29 PM (5 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.11, 4.9, master
Children:
c21f09e
Parents:
aaa015e
Message:

sb: Add support to get sources and hashses.

Location:
source-builder/sb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • source-builder/sb/download.py

    raaa015e r4934771  
    5454def _hash_check(file_, absfile, macros, remove = True):
    5555    failed = False
    56     if file_.lower() in macros.map_keys('hashes'):
    57         m1, m2, hash = macros.get(file_.lower(), globals = False, maps = 'hashes')
     56    hash = sources.get_hash(file_.lower(), macros)
     57    if hash is not None:
    5858        hash = hash.split()
    5959        if len(hash) != 2:
  • source-builder/sb/sources.py

    raaa015e r4934771  
    6363        error('invalid source type: %s' % (label))
    6464    args = _args(args)
    65     log.output('sources: %s' % (' '.join(args)))
     65    log.trace('sources: %s' % (' '.join(args)))
    6666    if len(args) < 3:
    6767        error('%%%s requires at least 3 arguments: %s' % (label, ' '.join(args)))
     
    8787    macros.unset_write_map()
    8888    return None
     89
     90def get(type_, name, macros, error):
     91    _map = '%s-%s' % (type_, name)
     92    keys = macros.map_keys(_map)
     93    if len(keys) == 0:
     94        error('no %s set: %s (%s)' % (type_, name, _map))
     95    srcs = []
     96    for s in keys:
     97        sm = macros.get(s, globals = False, maps = _map)
     98        if sm is None:
     99            error('source macro not found: %s in %s (%s)' % (s, name, _map))
     100        srcs += [sm[2]]
     101    return srcs
     102
     103def get_sources(name, macros, error):
     104    return get('source', name, macros, error)
     105
     106def get_patches(name, macros, error):
     107    return get('patch', name, macros, error)
     108
     109def get_names(type_, macros, error):
     110    names = []
     111    for m in macros.maps():
     112        if m.startswith('%s-' % (type_)):
     113            names += [m[len('%s-' % (type_)):]]
     114    return names
     115
     116def get_source_names(macros, error):
     117    return get_names('source', macros, error)
     118
     119def get_patch_names(macros, error):
     120    return get_names('patch', macros, error)
     121
     122def get_hash(name, macros):
     123    hash = None
     124    if name in macros.map_keys('hashes'):
     125        m1, m2, hash = macros.get(name, globals = False, maps = 'hashes')
     126    return hash
Note: See TracChangeset for help on using the changeset viewer.