summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2017-03-26 13:19:18 +1100
committerChris Johns <chrisj@rtems.org>2017-03-26 13:19:18 +1100
commitdca7ab285321d788f3f7f419ef8f2f4d3cf77a12 (patch)
tree66b2c156fccb5c8618c1b7a1f5c0b62e41c4290b
parent97b4399d1a59cb9c9bea1fc095b9bfd531964e95 (diff)
downloadrtems-source-builder-dca7ab285321d788f3f7f419ef8f2f4d3cf77a12.tar.bz2
sb: Add the `release_path` key to the `version` section in the VERSION file.
A release can specify a custom releaase URL path. Closes #2952.
-rw-r--r--source-builder/sb/download.py7
-rw-r--r--source-builder/sb/options.py4
-rw-r--r--source-builder/sb/version.py22
3 files changed, 25 insertions, 8 deletions
diff --git a/source-builder/sb/download.py b/source-builder/sb/download.py
index 1bd132e..c9cb792 100644
--- a/source-builder/sb/download.py
+++ b/source-builder/sb/download.py
@@ -296,6 +296,11 @@ parsers = { 'http': _http_parser,
'cvs': _cvs_parser,
'file': _file_parser }
+def set_release_path(release_path, macros):
+ if release_path is None:
+ release_path = '%{rtems_release_url}/%{rsb_version}/sources'
+ macros.define('release_path', release_path)
+
def parse_url(url, pathkey, config, opts):
#
# Split the source up into the parts we need.
@@ -575,7 +580,7 @@ def get_file(url, local, opts, config):
#
url_bases = opts.urls()
try:
- rtems_release_url_value = config.macros.expand('%{rtems_release_url}/%{rsb_version}/sources')
+ rtems_release_url_value = config.macros.expand('%{release_path}')
except:
rtems_release_url_value = None
log.output('RTEMS release URL could not be expanded')
diff --git a/source-builder/sb/options.py b/source-builder/sb/options.py
index 7791329..089d5a7 100644
--- a/source-builder/sb/options.py
+++ b/source-builder/sb/options.py
@@ -641,9 +641,9 @@ def load(args, optargs = None, defaults = '%{_sbdir}/defaults.mc'):
o.post_process()
#
- # Load the release hashes
+ # Load the release settings
#
- version.load_release_hashes(o.defaults)
+ version.load_release_settings(o.defaults)
return o
diff --git a/source-builder/sb/version.py b/source-builder/sb/version.py
index d1daeec..ec6bde7 100644
--- a/source-builder/sb/version.py
+++ b/source-builder/sb/version.py
@@ -26,6 +26,7 @@ from __future__ import print_function
import sys
+import download
import error
import git
import path
@@ -55,7 +56,10 @@ def _load_released_version_config():
except ImportError:
import ConfigParser as configparser
v = configparser.SafeConfigParser()
- v.read(path.join(ver, 'VERSION'))
+ try:
+ v.read(path.join(ver, 'VERSION'))
+ except:
+ raise error.general('Invalid VERSION file')
return v
return None
@@ -64,7 +68,10 @@ def _load_released_version():
global _version_str
v = _load_released_version_config()
if v is not None:
- _version_str = v.get('version', 'release')
+ try:
+ _version_str = v.get('version', 'release')
+ except:
+ raise error.general('Invalid VERSION file')
_released = True
return _released
@@ -94,8 +101,8 @@ def str():
_load_git_version()
return _version_str
-def load_release_hashes(macros):
- def hash_error(msg):
+def load_release_settings(macros):
+ def setting_error(msg):
raise error.general(msg)
if released():
@@ -105,11 +112,16 @@ def load_release_hashes(macros):
hashes = v.items('hashes')
except:
hashes = []
+ try:
+ release_path = v.get('version', 'release_path', raw = True)
+ except:
+ release_path = None
for hash in 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)
+ sources.hash((hs[0], hash[0], hs[1]), macros, setting_error)
+ download.set_release_path(release_path, macros)
def version():
return _version