tools: add new outdated option for idf_tools.py list

This adds a new outdated option, which only lists outdated
packages installed in IDF_TOOLS_PATH. It searches for the
latest installed tool version in the IDF_TOOLS_PATH/tools path and
compares it against the latest available version in the tools.json
file. If the latest version of a tool installed in IDF_TOOLS_PATH/tools
is smaller, it's reported as outdated. Nothing is reported if the tool
is up to date.

Two new tests are added. First just checks if nothing is reported in
case there is no update available. The second artificially generates
new tools.json file called tools.outdated.json and sets XTENSA_ESP32_ELF
version to 'zzzzzz'. It then checks if the XTENSA_ESP32_ELF tool
is reported as outdated by the 'zzzzzz' version.

Description of the new outdated option is addedd to docs as well.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata
2023-02-05 16:29:03 +01:00
parent 770961d2b8
commit 08c9a7b520
3 changed files with 86 additions and 2 deletions

View File

@@ -190,6 +190,37 @@ class TestUsage(unittest.TestCase):
self.assertIn('%s/tools/esp-rom-elfs/%s/' %
(self.temp_tools_dir, ESP_ROM_ELFS_VERSION), output)
output = self.run_idf_tools_with_action(['list', '--outdated'])
self.assertEqual('', output)
tools_json_outdated = os.path.join(self.temp_tools_dir, 'tools', 'tools.outdated.json')
new_version = 'zzzzzz'
self.run_idf_tools_with_action(
[
'add-version',
'--tool',
XTENSA_ESP32_ELF,
'--url-prefix',
'http://test.com',
'--version',
new_version,
'--override',
'--checksum-file',
'add_version/checksum.sha256',
'--output',
tools_json_outdated
])
output = self.run_idf_tools_with_action(
[
'--tools-json',
tools_json_outdated,
'list',
'--outdated'
])
self.assertIn((f'{XTENSA_ESP32_ELF}: version {XTENSA_ESP32_ELF_VERSION} '
f'is outdated by {new_version}'), output)
def test_tools_for_esp32(self):
required_tools_installed = 5
output = self.run_idf_tools_with_action(['install', '--targets=esp32'])