-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
93 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,6 +111,7 @@ | |
'salix', | ||
'sclo', | ||
'scoop', | ||
'serpentos', | ||
'sisyphus', | ||
'slackbuilds', | ||
'spack', | ||
|
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,60 @@ | ||
# Copyright (C) 2024 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 os | ||
from typing import Iterable | ||
|
||
import yaml | ||
|
||
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.walk import walk_tree | ||
|
||
|
||
class SerpentOsGitParser(Parser): | ||
def iter_parse(self, path: str, factory: PackageFactory) -> Iterable[PackageMaker]: | ||
for filename in walk_tree(path, suffix='stone.yaml'): | ||
relpath = os.path.relpath(filename, path) | ||
subdir = os.path.basename(os.path.dirname(relpath)) | ||
|
||
with factory.begin(relpath) as pkg: | ||
with open(filename, 'r') as fd: | ||
pkgdata = yaml.safe_load(fd) | ||
|
||
if pkgdata['name'] != subdir: | ||
RuntimeError(f'subdir "{subdir}" != name "{pkgdata["name"]}"') | ||
|
||
if isinstance(pkgdata['version'], float): | ||
pkg.log(f'version "{pkgdata["version"]}" is a floating point, should be quoted in YAML', Logger.ERROR) | ||
|
||
pkg.add_name(pkgdata['name'], NameType.SERPENTOS_NAME) | ||
pkg.set_version(str(pkgdata['version'])) | ||
pkg.add_links(LinkType.UPSTREAM_HOMEPAGE, pkgdata.get('homepage')) | ||
pkg.add_licenses(pkgdata.get('license')) | ||
pkg.set_summary(pkgdata.get('summary')) | ||
|
||
if upstreams := pkgdata.get('upstreams'): | ||
for upstream in upstreams: | ||
for url, checksum in upstream.items(): | ||
if url.startswith('git|'): | ||
pkg.add_links(LinkType.UPSTREAM_REPOSITORY, url[4:]) | ||
else: | ||
pkg.add_links(LinkType.UPSTREAM_DOWNLOAD, url) | ||
|
||
yield pkg |
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,30 @@ | ||
########################################################################### | ||
# SerpentOs | ||
########################################################################### | ||
- name: serpentos | ||
type: repository | ||
desc: Serpent OS | ||
family: serpentos | ||
ruleset: serpentos | ||
minpackages: 400 | ||
sources: | ||
- name: recipes | ||
fetcher: | ||
class: GitFetcher | ||
url: 'https://github.com/serpent-os/recipes.git' | ||
branch: main | ||
parser: | ||
class: SerpentOsGitParser | ||
repolinks: | ||
- desc: Serpent OS home | ||
url: https://serpentos.com/ | ||
- desc: Recipes repository | ||
url: https://github.com/serpent-os/recipes | ||
packagelinks: | ||
- type: PACKAGE_SOURCES | ||
url: 'https://github.com/serpent-os/recipes/tree/main/{srcname|first_letter}/{srcname}' | ||
- type: PACKAGE_RECIPE | ||
url: 'https://github.com/serpent-os/recipes/blob/main/{srcname|first_letter}/{srcname}/stone.yaml' | ||
- type: PACKAGE_RECIPE_RAW | ||
url: 'https://raw.githubusercontent.com/serpent-os/recipes/main/{srcname|first_letter}/{srcname}/stone.yaml' | ||
groups: [ all, production ] |