sb: Add support for a comma separated release path list.

Updates #3814
This commit is contained in:
Chris Johns
2019-11-11 15:10:32 +11:00
parent bfae21a67c
commit 6950f22007
2 changed files with 22 additions and 19 deletions

View File

@@ -599,16 +599,19 @@ def get_file(url, local, opts, config):
raise error.general('source not found: %s' % (path.host(local)))
#
# Check if a URL has been provided on the command line. If the package is
# released push to the start the RTEMS URL unless overrided by the command
# line option --with-release-url. The variant --without-release-url can
# override the released check.
# released push the release path URLs to the start the RTEMS URL list
# unless overriden by the command line option --without-release-url. The
# variant --without-release-url can override the released check.
#
url_bases = opts.urls()
if url_bases is None:
url_bases = []
try:
rtems_release_url_value = config.macros.expand('%{release_path}')
except:
rtems_release_url_value = None
rtems_release_url = None
rtems_release_urls = []
if version.released() and rtems_release_url_value:
rtems_release_url = rtems_release_url_value
with_rel_url = opts.with_arg('release-url')
@@ -627,18 +630,17 @@ def get_file(url, local, opts, config):
elif with_rel_url[0] == 'without_release-url' and with_rel_url[1] == 'yes':
rtems_release_url = None
if rtems_release_url is not None:
log.trace('release url: %s' % (rtems_release_url))
#
# If the URL being fetched is under the release path do not add the
# sources release path because it is already there.
#
if not url.startswith(rtems_release_url):
if url_bases is None:
url_bases = [rtems_release_url]
else:
url_bases.append(rtems_release_url)
rtems_release_urls = rtems_release_url.split(',')
for release_url in rtems_release_urls:
log.trace('release url: %s' % (release_url))
#
# If the URL being fetched is under the release path do not add
# the sources release path because it is already there.
#
if not url.startswith(release_url):
url_bases = [release_url] + url_bases
urls = []
if url_bases is not None:
if len(url_bases) > 0:
#
# Split up the URL we are being asked to download.
#
@@ -654,7 +656,7 @@ def get_file(url, local, opts, config):
# Hack to fix #3064 where --rsb-file is being used. This code is a
# mess and should be refactored.
#
if version.released() and base == rtems_release_url:
if version.released() and base in rtems_release_urls:
url_file = path.basename(local)
if base[-1:] != '/':
base += '/'

View File

@@ -112,15 +112,16 @@ def load_release_settings(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, setting_error)
try:
release_path = v.get('version', 'release_path', raw = True)
release_path = ','.join([rp.strip() for rp in release_path.split(',')])
except:
release_path = None
download.set_release_path(release_path, macros)
def version():