Skip to content

Commit eac34c2

Browse files
authored
feat: add MinimOS ecosystem helper (#3430)
ref: #3400 Adding a ecosystem helper for the new `MinimOS` ecosystem, which appears to use standard APK-based versioning. This is identical to the `Wolfi`/`Chainguard` helpers. Also updated the osvschema submodule to pick up the `MinimOS` ecosystem.
1 parent eda37bc commit eac34c2

File tree

4 files changed

+82
-1
lines changed

4 files changed

+82
-1
lines changed

osv/ecosystems/_ecosystems.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from .haskell import Hackage, GHC
2727
from .mageia import Mageia
2828
from .maven import Maven
29+
from .minimos import MinimOS
2930
from .nuget import NuGet
3031
from .packagist import Packagist
3132
from .pub import Pub
@@ -53,6 +54,7 @@
5354
'GHC': GHC(),
5455
'Hackage': Hackage(),
5556
'Maven': Maven(),
57+
'MinimOS': MinimOS(),
5658
'NuGet': NuGet(),
5759
'Packagist': Packagist(),
5860
'Pub': Pub(),

osv/ecosystems/minimos.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
"""MinimOS ecosystem helper."""
15+
16+
from ..third_party.univers.alpine import AlpineLinuxVersion
17+
18+
from .helper_base import Ecosystem
19+
20+
21+
class MinimOS(Ecosystem):
22+
"""MinimOS packages ecosystem"""
23+
24+
def sort_key(self, version):
25+
# MinimOS uses `apk` package format
26+
if not AlpineLinuxVersion.is_valid(version):
27+
# If version is not valid, it is most likely an invalid input
28+
# version then sort it to the last/largest element
29+
return AlpineLinuxVersion('999999')
30+
return AlpineLinuxVersion(version)
31+
32+
def enumerate_versions(self,
33+
package,
34+
introduced,
35+
fixed=None,
36+
last_affected=None,
37+
limits=None):
38+
raise NotImplementedError('Ecosystem helper does not support enumeration')
39+
40+
@property
41+
def supports_comparing(self):
42+
return True

osv/ecosystems/minimos_test.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
"""MinimOS ecosystem helper tests."""
15+
16+
import unittest
17+
from .. import ecosystems
18+
19+
20+
class MinimOSEcosystemTest(unittest.TestCase):
21+
"""MinimOS ecosystem helper tests."""
22+
23+
def test_minimos(self):
24+
"""Test sort_key"""
25+
ecosystem = ecosystems.get('MinimOS')
26+
self.assertGreater(
27+
ecosystem.sort_key('38.52.0-r0'), ecosystem.sort_key('37.52.0-r0'))
28+
self.assertLess(ecosystem.sort_key('453'), ecosystem.sort_key('453-r1'))
29+
self.assertGreater(ecosystem.sort_key('5.4.13-r1'), ecosystem.sort_key('0'))
30+
self.assertGreater(
31+
ecosystem.sort_key('1.4.0-r1'), ecosystem.sort_key('1.4.0-r0'))
32+
self.assertGreater(
33+
ecosystem.sort_key('invalid'), ecosystem.sort_key('1.4.0-r0'))
34+
self.assertGreater(
35+
ecosystem.sort_key('13.0.14.5-r1'), ecosystem.sort_key('7.64.3-r2'))
36+
self.assertLess(
37+
ecosystem.sort_key('13.0.14.5-r1'), ecosystem.sort_key('16.6-r0'))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy