Skip to content

Commit 7f1f973

Browse files
committed
Add chromebrew support (not enabled yet pending data issues) (#1236)
1 parent 46bd0e2 commit 7f1f973

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed

repology-schemacheck.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
'centos',
4242
'chakra',
4343
'chimera',
44+
'chromebrew',
4445
'chocolatey',
4546
'conan',
4647
'conda',

repology/packagemaker/names.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ class NameType:
135135
OS4DEPOT_FILENAME_EXT: ClassVar[int] = 321 # baz.lha
136136
OS4DEPOT_FILENAME_NO_EXT: ClassVar[int] = 322 # baz
137137

138+
CHROMEBREW_NAME: ClassVar[int] = 330
139+
138140
# Note that packages reside in subdirs such as packages/,
139141
# root-packages/, x11-packages/ and it may be that srcname
140142
# should include directory as well. However these are names
@@ -534,6 +536,13 @@ class MappedNames:
534536
visiblename=NameType.OS4DEPOT_FILENAME_EXT,
535537
projectname_seed=NameType.OS4DEPOT_FILENAME_NO_EXT,
536538
),
539+
# Chromebrew
540+
_NameMapping(
541+
srcname=NameType.CHROMEBREW_NAME,
542+
trackname=NameType.CHROMEBREW_NAME,
543+
visiblename=NameType.CHROMEBREW_NAME,
544+
projectname_seed=NameType.CHROMEBREW_NAME,
545+
),
537546
]
538547

539548

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright (C) 2024 Dmitry Marakasov <[email protected]>
2+
#
3+
# This file is part of repology
4+
#
5+
# repology is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation, either version 3 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# repology is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with repology. If not, see <http://www.gnu.org/licenses/>.
17+
18+
from typing import Iterable
19+
20+
from repology.packagemaker import NameType, PackageFactory, PackageMaker
21+
from repology.package import PackageFlags
22+
from repology.parsers import Parser
23+
from repology.parsers.json import iter_json_list
24+
25+
26+
class ChromebrewJsonParser(Parser):
27+
def iter_parse(self, path: str, factory: PackageFactory) -> Iterable[PackageMaker]:
28+
for pkgdata in iter_json_list(path, (None,)):
29+
with factory.begin() as pkg:
30+
pkg.add_name(pkgdata['name'], NameType.CHROMEBREW_NAME)
31+
pkg.set_version(pkgdata['version'])
32+
pkg.set_summary(pkgdata['description'])
33+
pkg.add_homepages(pkgdata['homepage'])
34+
pkg.add_licenses(pkgdata['license'])
35+
if '-' in pkgdata['version']:
36+
# no way to tell whether these are revisions, snapshots or parts of actual version
37+
pkg.set_flags(PackageFlags.UNTRUSTED)
38+
yield pkg

repos.d/chromebrew.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
###########################################################################
2+
# Chromebrew
3+
###########################################################################
4+
- name: chromebrew
5+
type: repository
6+
desc: Chromebrew
7+
family: chromebrew
8+
ruleset: chromebrew
9+
minpackages: 2000
10+
sources:
11+
# note: dump is claimed to be updated weekly https://github.com/repology/repology-updater/issues/1236#issuecomment-2171019435
12+
- name: repology.json
13+
fetcher:
14+
class: FileFetcher
15+
url: https://raw.githubusercontent.com/chromebrew/chromebrew/master/tools/repology.json
16+
parser:
17+
class: ChromebrewJsonParser
18+
repolinks:
19+
- desc: Chromebrew home
20+
url: https://chromebrew.github.io/
21+
- desc: Chromebrew repository on GitHub
22+
url: https://github.com/chromebrew/chromebrew
23+
packagelinks:
24+
- type: PACKAGE_RECIPE
25+
url: 'https://github.com/chromebrew/chromebrew/blob/master/packages/{srcname}.rb'
26+
- type: PACKAGE_RECIPE_RAW
27+
url: 'https://raw.githubusercontent.com/chromebrew/chromebrew/master/packages/{srcname}.rb'
28+
groups: [ all ]

0 commit comments

Comments
 (0)