Skip to content

Commit

Permalink
Add Buildroot (fixes #1081)
Browse files Browse the repository at this point in the history
  • Loading branch information
AMDmi3 committed Aug 23, 2023
1 parent c73df45 commit 1a9b3b4
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
1 change: 1 addition & 0 deletions repology-schemacheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
'arch',
'ataraxia',
'baulk',
'buildroot',
'carbs',
'centos',
'chakra',
Expand Down
2 changes: 2 additions & 0 deletions repology/packagemaker/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ class NameType:

YIFFOS_NAME: ClassVar[int] = GENERIC_SRC_NAME

BUILDROOT_NAME: ClassVar[int] = GENERIC_SRC_NAME

MSYS2_NAME: ClassVar[int] = GENERIC_NOBN_NAME
MSYS2_BASENAME: ClassVar[int] = GENERIC_NOBN_BASENAME

Expand Down
45 changes: 45 additions & 0 deletions repology/parsers/parsers/buildroot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright (C) 2023 Dmitry Marakasov <amdmi3@amdmi3.ru>
#
# This file is part of repology
#
# repology is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# repology is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with repology. If not, see <http://www.gnu.org/licenses/>.

from typing import Iterable

from repology.logger import Logger
from repology.package import LinkType
from repology.packagemaker import NameType, PackageFactory, PackageMaker
from repology.parsers import Parser
from repology.parsers.json import iter_json_dict


class BuildrootJsonParser(Parser):
def iter_parse(self, path: str, factory: PackageFactory) -> Iterable[PackageMaker]:
for pkgname, pkgdata in iter_json_dict(path, ('packages', None)):
with factory.begin(pkgname) as pkg:
if not pkgdata['current_version']:
pkg.log('no version', Logger.ERROR)
continue

pkg.add_name(pkgname, NameType.BUILDROOT_NAME)
pkg.set_version(pkgdata['current_version'])
pkg.add_links(LinkType.UPSTREAM_HOMEPAGE, pkgdata['url'])
pkg.add_licenses(pkgdata['license'])
pkg.set_extra_field('path', pkgdata['path'])

if cpeid := pkgdata['cpeid']:
cpe_components = cpeid.split(':')
pkg.add_cpe(cpe_components[3], cpe_components[4])

yield pkg
34 changes: 34 additions & 0 deletions repos.d/buildroot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
###########################################################################
# Buildroot
###########################################################################
{% macro buildroot(branch) %}
- name: buildroot_{{branch}}
type: repository
desc: Buildroot {{branch}}
family: buildroot
ruleset: buildroot
minpackages: 2900
sources:
- name: {{branch}}.json
fetcher:
class: FileFetcher
url: http://autobuild.buildroot.net/stats/{{branch}}.json
parser:
class: BuildrootJsonParser
repolinks:
- desc: Buildroot home
url: https://buildroot.org/
- desc: Buildroot git repository
url: https://git.busybox.net/buildroot/
packagelinks:
- type: PACKAGE_RECIPE
url: https://git.busybox.net/buildroot/tree/{path}?h={{branch}}
- type: PACKAGE_RECIPE_RAW
url: https://git.busybox.net/buildroot/plain/{path}?h={{branch}}
groups: [ all, production, buildroot ]
{% endmacro %}

# http://autobuild.buildroot.net/stats/
{{ buildroot('master') }}
{{ buildroot('2023.02.x') }}
{{ buildroot('2023.05.x') }}

0 comments on commit 1a9b3b4

Please sign in to comment.