-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ecosystems): add support for Mageia ecosystem (#3101)
This commit duplicates the RedHat ecosystem class, as I believe Mageia is distantly based off Red Hat and follows RPM version conventions.
- Loading branch information
1 parent
d6f398c
commit c2e9e5f
Showing
6 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright 2024 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
"""Mageia ecosystem helper.""" | ||
|
||
from ..third_party.univers.rpm import RpmVersion | ||
from .helper_base import Ecosystem | ||
|
||
|
||
class Mageia(Ecosystem): | ||
"""Mageia ecosystem""" | ||
|
||
@property | ||
def name(self): | ||
return 'Mageia' | ||
|
||
def sort_key(self, version): | ||
return RpmVersion.from_string(version) | ||
|
||
def enumerate_versions(self, | ||
package, | ||
introduced, | ||
fixed=None, | ||
last_affected=None, | ||
limits=None): | ||
raise NotImplementedError('Ecosystem helper does not support enumeration') | ||
|
||
@property | ||
def supports_comparing(self): | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2024 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
"""Mageia ecosystem helper tests.""" | ||
|
||
import unittest | ||
from .. import ecosystems | ||
|
||
|
||
class MageiaEcosystemTest(unittest.TestCase): | ||
"""Mageia ecosystem helper tests.""" | ||
|
||
def test_mageia(self): | ||
"""Test sort_key""" | ||
ecosystem = ecosystems.get('Mageia') | ||
self.assertEqual('Mageia', ecosystem.name) | ||
self.assertGreater( | ||
ecosystem.sort_key('3.2.7-1.2.mga9'), | ||
ecosystem.sort_key('3.2.7-1.mga9')) | ||
self.assertGreater( | ||
ecosystem.sort_key('3.2.7-1.2.mga9'), ecosystem.sort_key('0')) | ||
self.assertLess(ecosystem.sort_key('invalid'), ecosystem.sort_key('0')) | ||
self.assertGreater( | ||
ecosystem.sort_key('1:1.8.11-1.mga9'), | ||
ecosystem.sort_key('0:1.9.1-2.mga9')) |
Submodule osv-schema
updated
35 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters