mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
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.
This commit is contained in:
parent
8b1fd2be60
commit
c07ee80c2c
@ -624,6 +624,11 @@ def load(args, optargs = None, defaults = '%{_sbdir}/defaults.mc'):
|
|||||||
o.process()
|
o.process()
|
||||||
o.post_process()
|
o.post_process()
|
||||||
|
|
||||||
|
#
|
||||||
|
# Load the release hashes
|
||||||
|
#
|
||||||
|
version.load_release_hashes(o.defaults)
|
||||||
|
|
||||||
return o
|
return o
|
||||||
|
|
||||||
def run(args):
|
def run(args):
|
||||||
|
@ -27,15 +27,14 @@ import sys
|
|||||||
import error
|
import error
|
||||||
import git
|
import git
|
||||||
import path
|
import path
|
||||||
|
import sources
|
||||||
major = 4
|
|
||||||
minor = 11
|
|
||||||
revision = 0
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Default to an internal string.
|
# Default to an internal string.
|
||||||
#
|
#
|
||||||
_version_str = '%d.%d.%d' % (major, minor, revision)
|
_version = '4.11'
|
||||||
|
_revision = 'not_released'
|
||||||
|
_version_str = '%s.%s' % (_version, _revision)
|
||||||
_released = False
|
_released = False
|
||||||
_git = False
|
_git = False
|
||||||
|
|
||||||
@ -45,19 +44,23 @@ def _top():
|
|||||||
top = '.'
|
top = '.'
|
||||||
return top
|
return top
|
||||||
|
|
||||||
def _load_released_version():
|
def _load_released_version_config():
|
||||||
global _released
|
|
||||||
global _version_str
|
|
||||||
top = _top()
|
top = _top()
|
||||||
for ver in [top, '..']:
|
for ver in [top, '..']:
|
||||||
if path.exists(path.join(ver, 'VERSION')):
|
if path.exists(path.join(ver, 'VERSION')):
|
||||||
try:
|
import ConfigParser
|
||||||
with open(path.join(ver, 'VERSION')) as v:
|
v = ConfigParser.SafeConfigParser()
|
||||||
_version_str = v.readline().strip()
|
v.read(path.join(ver, 'VERSION'))
|
||||||
v.close()
|
return v
|
||||||
|
return None
|
||||||
|
|
||||||
|
def _load_released_version():
|
||||||
|
global _released
|
||||||
|
global _version_str
|
||||||
|
v = _load_released_version_config()
|
||||||
|
if v is not None:
|
||||||
|
_version_str = v.get('version', 'release')
|
||||||
_released = True
|
_released = True
|
||||||
except:
|
|
||||||
raise error.general('Cannot access the VERSION file')
|
|
||||||
return _released
|
return _released
|
||||||
|
|
||||||
def _load_git_version():
|
def _load_git_version():
|
||||||
@ -70,7 +73,7 @@ def _load_git_version():
|
|||||||
modified = ' modified'
|
modified = ' modified'
|
||||||
else:
|
else:
|
||||||
modified = ''
|
modified = ''
|
||||||
_version_str = '%d.%d.%d (%s%s)' % (major, minor, revision, head[0:12], modified)
|
_version_str = '%s (%s%s)' % (_version, head[0:12], modified)
|
||||||
_git = True
|
_git = True
|
||||||
return _git
|
return _git
|
||||||
|
|
||||||
@ -86,8 +89,18 @@ def str():
|
|||||||
_load_git_version()
|
_load_git_version()
|
||||||
return _version_str
|
return _version_str
|
||||||
|
|
||||||
|
def load_release_hashes(macros):
|
||||||
|
def hash_error(msg):
|
||||||
|
raise error.general(msg)
|
||||||
|
|
||||||
|
if released():
|
||||||
|
v = _load_released_version_config()
|
||||||
|
if v is not None:
|
||||||
|
for hash in v.items('hashes'):
|
||||||
|
hs = hash[1].split()
|
||||||
|
if len(hs) != 2:
|
||||||
|
raise error.general('invalid release hash in VERSION')
|
||||||
|
sources.hash((hs[0], hash[0], hs[1]), macros, hash_error)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print 'major = %d' % (major)
|
|
||||||
print 'minor = %d' % (minor)
|
|
||||||
print 'revision = %d' % (revision)
|
|
||||||
print 'Version: %s' % (str())
|
print 'Version: %s' % (str())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user