Skip to content
Snippets Groups Projects
Unverified Commit ff3d9a04 authored by Max Gautier's avatar Max Gautier
Browse files

download: Support for gvisor (part 2)

Gvisor releases, besides only being tags, have some particularities:
- they are of the form yyyymmdd.p -> this get interpreted as a yaml
  float, so we need to explicitely convert to string to make it work.
- there is no semver-like attached to the version numbers, but the API
  (= OCI container runtime interface) is expected to be stable (see
  linked discussion)
- some older tags don't have hashs for some archs

Link: https://groups.google.com/g/gvisor-users/c/SxMeHt0Yb6Y/m/Xtv7seULCAAJ
parent 6608efb2
No related branches found
No related tags found
No related merge requests found
...@@ -239,17 +239,22 @@ def download_hash(only_downloads: [str]) -> None: ...@@ -239,17 +239,22 @@ def download_hash(only_downloads: [str]) -> None:
new_versions = { new_versions = {
c: c:
{v for v in github_versions[c] {v for v in github_versions[c]
if any(v > version and (v.major, v.minor) == (version.major, version.minor) if any(v > version
for version in [max(minors) for _, minors in groupby(cur_v, lambda v: (v.minor, v.major))]) and (
# only get: (v.major, v.minor) == (version.major, version.minor)
# - patch versions (no minor or major bump) or c.startswith('gvisor')
# - newer ones (don't get old patch version) )
for version in [max(minors) for _, minors in groupby(cur_v, lambda v: (v.minor, v.major))]
)
# only get:
# - patch versions (no minor or major bump) (exception for gvisor which does not have a major.minor.patch scheme
# - newer ones (don't get old patch version)
} }
- set(cur_v) - set(cur_v)
for component, archs in data.items() for component, archs in data.items()
if (c := component.removesuffix('_checksums')) in downloads.keys() if (c := component.removesuffix('_checksums')) in downloads.keys()
# this is only to bound cur_v in the scope # this is only to bound cur_v in the scope
and (cur_v := sorted(Version(k) for k in next(archs.values().__iter__()).keys())) and (cur_v := sorted(Version(str(k)) for k in next(archs.values().__iter__()).keys()))
} }
def get_hash(component: str, version: Version, arch: str): def get_hash(component: str, version: Version, arch: str):
...@@ -280,7 +285,7 @@ def download_hash(only_downloads: [str]) -> None: ...@@ -280,7 +285,7 @@ def download_hash(only_downloads: [str]) -> None:
data[c] = {arch : data[c] = {arch :
{v : {v :
versions[v] for v in sorted(versions.keys(), versions[v] for v in sorted(versions.keys(),
key=Version, key=lambda v: Version(str(v)),
reverse=True) reverse=True)
} }
for arch, versions in data[c].items() for arch, versions in data[c].items()
......
...@@ -19,7 +19,7 @@ query($repoWithReleases: [ID!]!, $repoWithTags: [ID!]!) { ...@@ -19,7 +19,7 @@ query($repoWithReleases: [ID!]!, $repoWithTags: [ID!]!) {
... on Repository { ... on Repository {
nameWithOwner nameWithOwner
refs(refPrefix: "refs/tags/", last: 100) { refs(refPrefix: "refs/tags/", last: 25) {
nodes { nodes {
name name
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment