Skip to content

Commit

Permalink
ros: follow review
Browse files Browse the repository at this point in the history
  • Loading branch information
nim65s committed Dec 19, 2024
1 parent 7432164 commit 0c2ce9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions repology/parsers/parsers/ros.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from repology.package import LinkType
from repology.packagemaker import NameType, PackageFactory, PackageMaker
from repology.parsers import Parser
from yaml import load
from yaml import safe_load

try:
from yaml import CLoader as Loader
Expand All @@ -45,23 +45,23 @@ def ros_extract_recipe_url(key, /, *, url, tags, version, **kwargs):
class RosYamlParser(Parser):
def iter_parse(self, path: str, factory: PackageFactory) -> Iterable[PackageMaker]:
with open(path) as f:
data = load(f, Loader=Loader)
data = safe_load(f, Loader=Loader)
for key, packagedata in data['repositories'].items():
with factory.begin(key) as pkg:
# Some included packages are not yet released,
# and only available as source
if 'release' not in packagedata:
pkg.log(f'dropping {pkg}: no release', severity=Logger.ERROR)
pkg.log(f'dropping {key}: no release', severity=Logger.ERROR)
continue

release = packagedata['release']

if 'version' not in release:
pkg.log(f'dropping {pkg}: has no version.', severity=Logger.ERROR)
pkg.log(f'dropping {key}: has no version.', severity=Logger.ERROR)
continue

if 'bitbucket' in release['url']:
pkg.log(f'dropping {pkg}: RIP bitbucket', severity=Logger.ERROR)
pkg.log(f'dropping {key}: RIP bitbucket', severity=Logger.ERROR)
continue

pkg.add_name(key, NameType.ROS_NAME)
Expand All @@ -70,12 +70,12 @@ def iter_parse(self, path: str, factory: PackageFactory) -> Iterable[PackageMake
if recipe_url := ros_extract_recipe_url(key, **release):
pkg.add_links(LinkType.PACKAGE_RECIPE, recipe_url)
else:
pkg.log(f'{pkg} has no known recipe url', severity=Logger.WARNING)
pkg.log(f'{key} has no known recipe url', severity=Logger.WARNING)

if source := packagedata.get('source'):
pkg.add_links(LinkType.UPSTREAM_HOMEPAGE, source['url'])
else:
pkg.log(f'{pkg} has no source', severity=Logger.WARNING)
pkg.log(f'{key} has no source', severity=Logger.WARNING)

if doc := packagedata.get('doc'):
pkg.add_links(LinkType.UPSTREAM_DOCUMENTATION, doc['url'])
Expand Down
4 changes: 2 additions & 2 deletions repos.d/ros.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% macro ros(version, name, minpackages, valid_till) %}
- name: ros_{{version}}_{{name}}
type: repository
desc: ROS {{name}} {% if version > 1 %}(ROS {{version}}){% endif %}
desc: ROS {% if version > 1 %}{{ version }} {% endif %}{{name}}
statsgroup: ros
family: ros
ruleset: ros
Expand Down Expand Up @@ -40,7 +40,7 @@
{{ ros(1, 'kinetic', minpackages=950, valid_till='2021-04-30') }}
{{ ros(1, 'lunar', minpackages=350, valid_till='2019-05-31') }}
{{ ros(1, 'melodic', minpackages=850, valid_till='2023-06-27') }}
{{ ros(1, 'noetic', minpackages=750, valid_till='2025-05-31') }}
{{ ros(1, 'noetic', minpackages=700, valid_till='2025-05-31') }}

{{ ros(2, 'ardent', minpackages=50, valid_till='2018-12-31') }}
{{ ros(2, 'bouncy', minpackages=50, valid_till='2019-06-30') }}
Expand Down

0 comments on commit 0c2ce9c

Please sign in to comment.