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))) 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 # 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 # released push the release path URLs to the start the RTEMS URL list
# line option --with-release-url. The variant --without-release-url can # unless overriden by the command line option --without-release-url. The
# override the released check. # variant --without-release-url can override the released check.
# #
url_bases = opts.urls() url_bases = opts.urls()
if url_bases is None:
url_bases = []
try: try:
rtems_release_url_value = config.macros.expand('%{release_path}') rtems_release_url_value = config.macros.expand('%{release_path}')
except: except:
rtems_release_url_value = None rtems_release_url_value = None
rtems_release_url = None rtems_release_url = None
rtems_release_urls = []
if version.released() and rtems_release_url_value: if version.released() and rtems_release_url_value:
rtems_release_url = rtems_release_url_value rtems_release_url = rtems_release_url_value
with_rel_url = opts.with_arg('release-url') 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': elif with_rel_url[0] == 'without_release-url' and with_rel_url[1] == 'yes':
rtems_release_url = None rtems_release_url = None
if rtems_release_url is not None: if rtems_release_url is not None:
log.trace('release url: %s' % (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 # If the URL being fetched is under the release path do not add
# sources release path because it is already there. # the sources release path because it is already there.
# #
if not url.startswith(rtems_release_url): if not url.startswith(release_url):
if url_bases is None: url_bases = [release_url] + url_bases
url_bases = [rtems_release_url]
else:
url_bases.append(rtems_release_url)
urls = [] urls = []
if url_bases is not None: if len(url_bases) > 0:
# #
# Split up the URL we are being asked to download. # 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 # Hack to fix #3064 where --rsb-file is being used. This code is a
# mess and should be refactored. # 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) url_file = path.basename(local)
if base[-1:] != '/': if base[-1:] != '/':
base += '/' base += '/'

View File

@@ -112,15 +112,16 @@ def load_release_settings(macros):
hashes = v.items('hashes') hashes = v.items('hashes')
except: except:
hashes = [] hashes = []
try:
release_path = v.get('version', 'release_path', raw = True)
except:
release_path = None
for hash in hashes: for hash in hashes:
hs = hash[1].split() hs = hash[1].split()
if len(hs) != 2: if len(hs) != 2:
raise error.general('invalid release hash in VERSION') raise error.general('invalid release hash in VERSION')
sources.hash((hs[0], hash[0], hs[1]), macros, setting_error) 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) download.set_release_path(release_path, macros)
def version(): def version():