Changeset c07ee80 in rtems-source-builder


Ignore:
Timestamp:
Dec 11, 2015, 5:22:00 AM (4 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.11
Children:
4dce089
Parents:
8b1fd2b
Message:

VERSION is an INI format file.

VERSION is an INI format file with 2 sections:

  1. version The version of the release. It contains: release = version-string
  2. hashes A list of hashes for packages that are formed when creating a release. A hash entry is: file-name = hash-type checksum

The approach means we do not need to hold hash values in configuration files
which need to be updated when a release is made. The release scripts can
generate the hashes when creating the release.

Location:
source-builder/sb
Files:
2 edited

Legend:

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

    r8b1fd2b rc07ee80  
    625625    o.post_process()
    626626
     627    #
     628    # Load the release hashes
     629    #
     630    version.load_release_hashes(o.defaults)
     631
    627632    return o
    628633
  • source-builder/sb/version.py

    r8b1fd2b rc07ee80  
    2828import git
    2929import path
    30 
    31 major = 4
    32 minor = 11
    33 revision = 0
     30import sources
    3431
    3532#
    3633# Default to an internal string.
    3734#
    38 _version_str =  '%d.%d.%d' % (major, minor, revision)
     35_version = '4.11'
     36_revision = 'not_released'
     37_version_str = '%s.%s' % (_version, _revision)
    3938_released = False
    4039_git = False
     
    4645    return top
    4746
     47def _load_released_version_config():
     48    top = _top()
     49    for ver in [top, '..']:
     50        if path.exists(path.join(ver, 'VERSION')):
     51            import ConfigParser
     52            v = ConfigParser.SafeConfigParser()
     53            v.read(path.join(ver, 'VERSION'))
     54            return v
     55    return None
     56
    4857def _load_released_version():
    4958    global _released
    5059    global _version_str
    51     top = _top()
    52     for ver in [top, '..']:
    53         if path.exists(path.join(ver, 'VERSION')):
    54             try:
    55                 with open(path.join(ver, 'VERSION')) as v:
    56                     _version_str = v.readline().strip()
    57                 v.close()
    58                 _released = True
    59             except:
    60                 raise error.general('Cannot access the VERSION file')
     60    v = _load_released_version_config()
     61    if v is not None:
     62        _version_str = v.get('version', 'release')
     63        _released = True
    6164    return _released
    6265
     
    7174        else:
    7275            modified = ''
    73         _version_str = '%d.%d.%d (%s%s)' % (major, minor, revision, head[0:12], modified)
     76        _version_str = '%s (%s%s)' % (_version, head[0:12], modified)
    7477        _git = True
    7578    return _git
     
    8790    return _version_str
    8891
     92def load_release_hashes(macros):
     93    def hash_error(msg):
     94        raise error.general(msg)
     95
     96    if released():
     97        v = _load_released_version_config()
     98        if v is not None:
     99            for hash in v.items('hashes'):
     100                hs = hash[1].split()
     101                if len(hs) != 2:
     102                    raise error.general('invalid release hash in VERSION')
     103                sources.hash((hs[0], hash[0], hs[1]), macros, hash_error)
     104
    89105if __name__ == '__main__':
    90     print 'major = %d' % (major)
    91     print 'minor = %d' % (minor)
    92     print 'revision = %d' % (revision)
    93106    print 'Version: %s' % (str())
Note: See TracChangeset for help on using the changeset viewer.