Skip to content

Commit

Permalink
Add yiffOS support (fixes #1217)
Browse files Browse the repository at this point in the history
  • Loading branch information
AMDmi3 committed Jan 19, 2022
1 parent 5e86fa3 commit aff7fe9
Show file tree
Hide file tree
Showing 4 changed files with 81 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 @@ -123,6 +123,7 @@
'wikidata',
'winget',
'yacp',
'yiffos',
]

rulesets = families + [
Expand Down
2 changes: 2 additions & 0 deletions repology/packagemaker/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ class NameType:

BAULK_NAME: ClassVar[int] = GENERIC_GEN_NAME

YIFFOS_NAME: ClassVar[int] = GENERIC_SRC_NAME

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

Expand Down
50 changes: 50 additions & 0 deletions repology/parsers/parsers/yiffos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright (C) 2022 Dmitry Marakasov <[email protected]>
#
# 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/>.

import json
import os
from typing import Iterable

from repology.package import LinkType
from repology.packagemaker import NameType, PackageFactory, PackageMaker
from repology.parsers import Parser
from repology.parsers.maintainers import extract_maintainers
from repology.parsers.walk import walk_tree


class YiffOSJsonParser(Parser):
def iter_parse(self, path: str, factory: PackageFactory) -> Iterable[PackageMaker]:
for pkginfo_path_abs in walk_tree(path, name='PKGINFO'):
pkginfo_path_rel = os.path.relpath(pkginfo_path_abs, path)

with factory.begin(pkginfo_path_rel) as pkg:
subdir = os.path.dirname(pkginfo_path_rel)

with open(pkginfo_path_abs) as fd:
pkginfo = json.loads(fd.read())

if subdir != pkginfo['name']:
raise RuntimeError(f'subdir "{subdir}" != name "{pkginfo["name"]}"')

pkg.add_name(pkginfo['name'], NameType.YIFFOS_NAME)
pkg.set_version(pkginfo['version'])
pkg.set_summary(pkginfo['description'])
pkg.add_links(LinkType.UPSTREAM_HOMEPAGE, pkginfo['url'])
pkg.add_licenses(pkginfo['license'])
pkg.add_maintainers(map(extract_maintainers, pkginfo['maintainers']))

yield pkg
28 changes: 28 additions & 0 deletions repos.d/yiffos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
###########################################################################
# yiffOS
###########################################################################
- name: yiffos_knot
type: repository
desc: yiffOS Knot
family: yiffos
ruleset: yiffos
minpackages: 100
sources:
- name: packages
fetcher:
class: GitFetcher
url: https://gitlab.com/yiffos/packaging/packages.git
branch: knot
parser:
class: YiffOSJsonParser
repolinks:
- desc: yiffOS home
url: https://yiffos.gay/
packagelinks:
- type: PACKAGE_SOURCES
url: 'https://gitlab.com/yiffos/packaging/packages/-/tree/knot/{srcname}'
- type: PACKAGE_RECIPE
url: 'https://gitlab.com/yiffos/packaging/packages/-/blob/knot/{srcname}/PKGSCRIPT'
- type: PACKAGE_RECIPE_RAW
url: 'https://gitlab.com/yiffos/packaging/packages/-/raw/knot/{srcname}/PKGSCRIPT'
groups: [ all, production, yiffos ]

0 comments on commit aff7fe9

Please sign in to comment.