* [Buildroot] [git commit] support/scripts/pkg-stats: add better checking in check_package_get_latest_version_by_guess()
@ 2022-07-27 21:12 Thomas Petazzoni via buildroot
2022-08-30 22:34 ` Peter Korsgaard
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-07-27 21:12 UTC (permalink / raw)
To: buildroot
commit: https://git.buildroot.net/buildroot/commit/?id=f1e3b2bb01903faf7595ed3151140bbf767681e0
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master
The 'rtl8723ds' name, when queried from release-monitoring.org at
https://release-monitoring.org/api/projects/?pattern=rtl8723ds returns
one project, with one "stable_versions" array, which is empty. This
was not expected by the pkg-stats code, causing an exception:
Task exception was never retrieved
future: <Task finished name='Task-764' coro=<check_package_latest_version_get() done, defined at /home/thomas/projets/buildroot/./support/scripts/pkg-stats:558> exception=IndexError('list index out of range')>
Traceback (most recent call last):
File "/home/thomas/projets/buildroot/./support/scripts/pkg-stats", line 566, in check_package_latest_version_get
if await check_package_get_latest_version_by_guess(session, pkg):
File "/home/thomas/projets/buildroot/./support/scripts/pkg-stats", line 544, in check_package_get_latest_version_by_guess
projects[0]['stable_versions'][0],
IndexError: list index out of range
This commit therefore improves the checks done on the results received
from release-monitoring.org to avoid this issue.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
support/scripts/pkg-stats | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index fe549ce1ca..9c37506cd4 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -537,12 +537,17 @@ async def check_package_get_latest_version_by_guess(session, pkg, retry=True):
projects = [p for p in data['projects'] if p['name'] == pkg.name and 'stable_versions' in p]
projects.sort(key=lambda x: x['id'])
- if len(projects) > 0:
- check_package_latest_version_set_status(pkg,
- RM_API_STATUS_FOUND_BY_PATTERN,
- projects[0]['stable_versions'][0],
- projects[0]['id'])
- return True
+ if len(projects) == 0:
+ return False
+
+ if len(projects[0]['stable_versions']) == 0:
+ return False
+
+ check_package_latest_version_set_status(pkg,
+ RM_API_STATUS_FOUND_BY_PATTERN,
+ projects[0]['stable_versions'][0],
+ projects[0]['id'])
+ return True
except (aiohttp.ClientError, asyncio.TimeoutError):
if retry:
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Buildroot] [git commit] support/scripts/pkg-stats: add better checking in check_package_get_latest_version_by_guess()
2022-07-27 21:12 [Buildroot] [git commit] support/scripts/pkg-stats: add better checking in check_package_get_latest_version_by_guess() Thomas Petazzoni via buildroot
@ 2022-08-30 22:34 ` Peter Korsgaard
0 siblings, 0 replies; 2+ messages in thread
From: Peter Korsgaard @ 2022-08-30 22:34 UTC (permalink / raw)
To: Thomas Petazzoni via buildroot; +Cc: Thomas Petazzoni
>>>>> "Thomas" == Thomas Petazzoni via buildroot <buildroot@buildroot.org> writes:
> commit: https://git.buildroot.net/buildroot/commit/?id=f1e3b2bb01903faf7595ed3151140bbf767681e0
> branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master
> The 'rtl8723ds' name, when queried from release-monitoring.org at
> https://release-monitoring.org/api/projects/?pattern=rtl8723ds returns
> one project, with one "stable_versions" array, which is empty. This
> was not expected by the pkg-stats code, causing an exception:
> Task exception was never retrieved
> future: <Task finished name='Task-764' coro=<check_package_latest_version_get() done, defined at /home/thomas/projets/buildroot/./support/scripts/pkg-stats:558> exception=IndexError('list index out of range')>
> Traceback (most recent call last):
> File "/home/thomas/projets/buildroot/./support/scripts/pkg-stats", line 566, in check_package_latest_version_get
> if await check_package_get_latest_version_by_guess(session, pkg):
> File "/home/thomas/projets/buildroot/./support/scripts/pkg-stats", line 544, in check_package_get_latest_version_by_guess
> projects[0]['stable_versions'][0],
> IndexError: list index out of range
> This commit therefore improves the checks done on the results received
> from release-monitoring.org to avoid this issue.
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Committed to 2022.05.x and 2022.02.x, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-30 22:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27 21:12 [Buildroot] [git commit] support/scripts/pkg-stats: add better checking in check_package_get_latest_version_by_guess() Thomas Petazzoni via buildroot
2022-08-30 22:34 ` Peter Korsgaard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.