Skip to content

Commit

Permalink
Add new name fields: trackname, binname, srcname (#944)
Browse files Browse the repository at this point in the history
  • Loading branch information
AMDmi3 committed Nov 11, 2019
1 parent dbc9f92 commit db3f57d
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 1 deletion.
12 changes: 12 additions & 0 deletions repology/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ class Package:
'keyname',
'visiblename',
'projectname_seed',
'trackname',
'srcname',
'binname',

'origversion',
'rawversion',
Expand Down Expand Up @@ -170,10 +173,13 @@ class Package:
subrepo: Optional[str]

name: Optional[str]
srcname: Optional[str]
binname: Optional[str]
basename: Optional[str]
keyname: Optional[str]
visiblename: str
projectname_seed: str
trackname: Optional[str]

origversion: str
rawversion: str
Expand Down Expand Up @@ -216,8 +222,11 @@ def __init__(self, *,
subrepo: Optional[str] = None,

name: Optional[str] = None,
srcname: Optional[str] = None,
binname: Optional[str] = None,
basename: Optional[str] = None,
keyname: Optional[str] = None,
trackname: Optional[str] = None,

arch: Optional[str] = None,

Expand All @@ -240,10 +249,13 @@ def __init__(self, *,
self.subrepo = subrepo

self.name = name
self.srcname = srcname
self.binname = binname
self.basename = basename
self.keyname = keyname
self.visiblename = visiblename
self.projectname_seed = projectname_seed
self.trackname = trackname

self.origversion = origversion
self.rawversion = rawversion
Expand Down
3 changes: 3 additions & 0 deletions repology/packagemaker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,13 @@ def spawn(self, repo: str, family: str, subrepo: Optional[str] = None, shadow: b
subrepo=self._package.subrepo or subrepo,

name=names.name,
srcname=names.srcname,
binname=names.binname,
basename=names.basename,
keyname=names.keyname,
visiblename=names.visiblename,
projectname_seed=names.projectname_seed,
trackname=names.trackname,

version=self._package.version,
origversion=self._package.version,
Expand Down
6 changes: 6 additions & 0 deletions repology/packagemaker/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,23 @@ class _NameMapping:
projectname_seed: int

name: Optional[int] = None
srcname: Optional[int] = None
binname: Optional[int] = None
basename: Optional[int] = None
keyname: Optional[int] = None
trackname: Optional[int] = None


@dataclass
class MappedNames:
name: Optional[str] = None
srcname: Optional[str] = None
binname: Optional[str] = None
basename: Optional[str] = None
keyname: Optional[str] = None
visiblename: Optional[str] = None
projectname_seed: Optional[str] = None
trackname: Optional[str] = None


_MAPPINGS = [
Expand Down
5 changes: 4 additions & 1 deletion repology/test/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ def check_package(self, name: str, reference: Dict[str, Any]) -> None:
# family must be filled
'subrepo': None,

# name must be filled
'name': None,
'srcname': None,
'binname': None,
# visiblename must be filled
# proectname_seed must be filled
'basename': None,
'keyname': None,
'trackname': None,

# version must be filled
# origversion must be filled
Expand Down
6 changes: 6 additions & 0 deletions sql.d/update/add_packages.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ INSERT INTO packages(
subrepo,

name,
srcname,
binname,
basename,
keyname,
visiblename,
projectname_seed,
trackname,

origversion,
rawversion,
Expand Down Expand Up @@ -64,10 +67,13 @@ INSERT INTO packages(
%(subrepo)s,

%(name)s,
%(srcname)s,
%(binname)s,
%(basename)s,
%(keyname)s,
%(visiblename)s,
%(projectname_seed)s,
%(trackname)s,

%(origversion)s,
%(rawversion)s,
Expand Down
3 changes: 3 additions & 0 deletions sql.d/update/create_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,13 @@ CREATE TABLE packages (
subrepo text,

name text NULL,
srcname text NULL,
binname text NULL,
basename text NULL,
keyname text NULL,
visiblename text NOT NULL,
projectname_seed text NOT NULL,
trackname text NULL,

origversion text NOT NULL,
rawversion text NOT NULL,
Expand Down

0 comments on commit db3f57d

Please sign in to comment.