Skip to content
Snippets Groups Projects
Commit 4c56e9db authored by Louis-Francis Ratté-Boulianne's avatar Louis-Francis Ratté-Boulianne Committed by Guillaume Desmottes
Browse files

Add LatestURL key to sysroot latest command


It returns the remote URL from where the sysroot can be downloaded
so that application integrating the tool can use their own
download manager.

Signed-off-by: default avatarLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: default avatarGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Differential Revision: https://phabricator.apertis.org/D5207
parent 07faf4a5
No related branches found
No related tags found
No related merge requests found
......@@ -18,15 +18,16 @@ from test_util import BASE_TAG, BASE_ARCHIVE, BASE_CONFIG, \
SYSROOTS, LATEST_SYSROOTS, \
CONFIG_FILES, BAD_VERSION_URLS
# Utility functions
def check_version(result, sysroot):
expected = BASE_TAG.format(*sysroot)
return result['LatestVersion'] == expected
# Setup
server = SysrootServer()
server.start()
# Utility functions
def check_version(result, sysroot):
expected_tag = BASE_TAG.format(*sysroot)
expected_url = server.base_archive_url().format(*sysroot)
return result['LatestVersion'] == expected_tag and result['LatestURL'] == expected_url
# Test "ade sysroot latest --url" usage
for sysroot in SYSROOTS:
params = ['--url', server.base_url().format(*sysroot), '--distro', sysroot[0],
......
......@@ -184,6 +184,10 @@ class SysrootServer(http.server.HTTPServer):
url = "http://{}/versions/{}"
return url.format(self.host(), BASE_TAG)
def base_archive_url(self):
url = "http://{}/archives/{}.tar.gz"
return url.format(self.host(), BASE_TAG)
@contextmanager
def templatedconfig(server, config_file):
config = os.path.join(os.getcwd(), "configs", config_file)
......
......@@ -377,6 +377,7 @@ class Ade:
self.info("* Retrieved latest version: {0}{1}{2}" \
.format(Colors.OKGREEN, version, Colors.ENDC))
self.info("* Download URL: {0}".format(version.url))
return version
except URLError as e:
......@@ -510,6 +511,7 @@ class Ade:
version = self.get_latest_version()
if self.format == 'parseable':
print('LatestVersion:' + version.get_tag())
print('LatestURL:' + version.url)
def do_sysroot_download(self):
self.validate_sysroot_id()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment