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

Add 'installed' command to show currently installed sysroot version


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/D5208
parent 4c56e9db
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,8 @@ ade-sysroot \- Manage set of installed Apertis sysroots
.nf
\fIade sysroot\fR [--config=<config>] [--path=<path>]
\fIade sysroot list\fR
\fIade sysroot installed\fR
\fIade sysroot installed\fR --distro=<distro> --release=<release> [--arch=<arch>]
\fIade sysroot latest\fR
\fIade sysroot latest\fR --distro=<distro> --release=<release> [--arch=<arch>]
\fIade sysroot latest\fR --url=<url>
......@@ -90,6 +92,15 @@ Shows a list of the currently installed sysroots\&.
.sp
.RE
.PP
\fIinstalled\fR
.RS 4
Retrieves the currently installed version of a sysroot\&.
.sp
See \fBSYSROOT SELECTION\fR for details about how the target sysroot
is selected\&.
.sp
.RE
.PP
\fIlatest\fR
.RS 4
Retrieves the latest available version for a sysroot\&.
......
......@@ -21,7 +21,7 @@ short = $(firstword $(subst _, $(space), $(1)))
sedrule = 's/@DISTRO@/$(call distro,$(1))/; s/@RELEASE@/$(call release,$(1))/; s/@ARCH@/$(call arch,$(1))/; s/@BUILD@/$(call build,$(1))/'
TESTS = \
test-list \
test-installed \
test-latest \
test-download \
test-verify \
......
......@@ -12,9 +12,13 @@
import os
from test_util import should_succeed, should_fail, split_elements
from test_util import BASE_TAG, BASE_INSTALL, LATEST_SYSROOTS
from test_util import BASE_INSTALL, BASE_TAG, LATEST_SYSROOTS
# Utility functions
def check_sysroot(result, sysroot):
expected = BASE_TAG.format(*sysroot)
return result['InstalledVersion'] == expected
def check_list(result, expected_sysroots):
result_sysroots = split_elements(result['InstalledSysroots'])
if len(expected_sysroots) != len(result_sysroots):
......@@ -27,10 +31,19 @@ def check_list(result, expected_sysroots):
return False
return True
# Test "ade installed" usage
for sysroot in LATEST_SYSROOTS:
params = ['--distro', sysroot[0], '--release', sysroot[1], '--arch', sysroot[2]]
should_succeed('installed', *params, path=BASE_INSTALL,
check=lambda x: check_sysroot(x, sysroot))
# Test "ade list" usage
should_succeed('list', path=BASE_INSTALL,
check=lambda x: check_list(x, LATEST_SYSROOTS))
# Empty directory
should_succeed('list', path=os.path.join(BASE_INSTALL, 'missing'),
should_succeed('installed', '--distro', 'eraroj', '--release', '16.09',
path=os.path.join(os.getcwd(), 'missing'),
check=lambda x: not x)
should_succeed('list', path=os.path.join(os.getcwd(), 'missing'),
check=lambda x: check_list(x, []))
......@@ -505,6 +505,18 @@ class Ade:
l = [version.get_tag() for version in versions]
print('InstalledSysroots:' + ';'.join(l))
def do_sysroot_installed(self):
self.validate_install_path()
self.validate_sysroot_id()
version = self.get_installed_version()
if version:
self.info("* Retrieved current version: {0}{1}{2}".format(Colors.WARNING, version, Colors.ENDC))
if self.format == 'parseable':
print('InstalledVersion:' + version.get_tag())
else:
self.info("* Sysroot {0}{1} {2} ({3}){4} is not currently installed"
.format(Colors.OKBLUE, self.distro, self.release, self.arch, Colors.ENDC))
def do_sysroot_latest(self):
self.validate_sysroot_id()
self.validate_url()
......@@ -689,6 +701,8 @@ if __name__ == '__main__':
# Sysroot subcommands
parser = sysroot_subparsers.add_parser('list', help='List all installed sysroots')
parser = sysroot_subparsers.add_parser('installed', help='Retrieve version of currently installed sysroot',
parents=[sysroot_id_parser])
parser = sysroot_subparsers.add_parser('latest', help='Retrieve version of latest available sysroot',
parents=[sysroot_id_parser, sysroot_url_parser])
parser = sysroot_subparsers.add_parser('download', help='Download latest sysroot archive',
......
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