Skip to content

Commit

Permalink
Tweak naming for GoboLinux (#944)
Browse files Browse the repository at this point in the history
  • Loading branch information
AMDmi3 committed Nov 13, 2019
1 parent 9de6390 commit 26fc67f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
9 changes: 9 additions & 0 deletions repology/packagemaker/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class NameType:

VCPKG_SOURCE: ClassVar[int] = 120

GOBOLINUX_RECIPE: ClassVar[int] = 130

# Common pattern "NOBN" = Name + Optional BaseName
PATTERN_NOBN_NAME: ClassVar[int] = 200
PATTERN_NOBN_BASENAME: ClassVar[int] = 201
Expand Down Expand Up @@ -109,6 +111,13 @@ class MappedNames:
visiblename=NameType.GENERIC_PKGNAME,
projectname_seed=NameType.GENERIC_PKGNAME,
),
# GoboLinux
_NameMapping(
name=NameType.GOBOLINUX_RECIPE,
trackname=NameType.GOBOLINUX_RECIPE,
visiblename=NameType.GOBOLINUX_RECIPE,
projectname_seed=NameType.GOBOLINUX_RECIPE,
),
# vcpkg
_NameMapping(
name=NameType.VCPKG_SOURCE,
Expand Down
10 changes: 5 additions & 5 deletions repology/parsers/parsers/gobolinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ def _expand_mirrors(url: str) -> str:
class GoboLinuxGitParser(Parser):
def iter_parse(self, path: str, factory: PackageFactory, transformer: PackageTransformer) -> Iterable[PackageMaker]:
trunk_path = os.path.join(path, 'trunk')
for package_name in os.listdir(trunk_path):
for recipe_name in os.listdir(trunk_path):
pkg = factory.begin()

pkg.add_name(package_name, NameType.GENERIC_PKGNAME)
pkg.add_name(recipe_name, NameType.GOBOLINUX_RECIPE)

package_path = os.path.join(trunk_path, package_name)
package_path = os.path.join(trunk_path, recipe_name)

maxversion: Optional[str] = None
for version_name in os.listdir(package_path):
Expand All @@ -70,7 +70,7 @@ def iter_parse(self, path: str, factory: PackageFactory, transformer: PackageTra
if '$' not in download:
pkg.add_downloads(download.strip('"'))
else:
factory.log('Recipe for {}/{} skipped, unhandled URL substitute found'.format(package_name, maxversion), severity=Logger.ERROR)
factory.log('Recipe for {}/{} skipped, unhandled URL substitute found'.format(recipe_name, maxversion), severity=Logger.ERROR)

if os.path.isfile(description_path):
with open(description_path, 'r', encoding='utf-8', errors='ignore') as description:
Expand All @@ -83,7 +83,7 @@ def iter_parse(self, path: str, factory: PackageFactory, transformer: PackageTra
current_tag = match.group(1)
data[current_tag] = match.group(2)
elif current_tag is None:
factory.log('Description for {}/{} skipped, dumb format'.format(package_name, maxversion), severity=Logger.ERROR)
factory.log('Description for {}/{} skipped, dumb format'.format(recipe_name, maxversion), severity=Logger.ERROR)
break
elif line:
if data[current_tag]:
Expand Down
1 change: 1 addition & 0 deletions repology/test/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ def test_gobolinux(self) -> None:
'repo': 'gobolinux',
'family': 'gobolinux',
'name': 'AutoFS',
'trackname': 'AutoFS',
'visiblename': 'AutoFS',
'projectname_seed': 'AutoFS',
'version': '5.0.5',
Expand Down

0 comments on commit 26fc67f

Please sign in to comment.