Commit c81aa895 authored by Dan McGee's avatar Dan McGee
Browse files

reporead: rename Pkg to RepoPackage



The bytes saved on the shorter name aren't worth it.

Also ensure 'desc' is always initialized to None in case packages do not
provide one.

Signed-off-by: default avatarDan McGee <dan@archlinux.org>
parent 6ee65265
......@@ -70,7 +70,7 @@ def handle(self, arch=None, filename=None, **options):
return read_repo(arch, filename, options)
class Pkg(object):
class RepoPackage(object):
"""An interim 'container' object for holding Arch package data."""
bare = ( 'name', 'base', 'arch', 'filename',
'md5sum', 'sha256sum', 'url', 'packager' )
......@@ -85,6 +85,7 @@ def __init__(self, repo):
self.ver = None
self.rel = None
self.epoch = 0
self.desc = None
self.pgpsig = None
for k in self.bare + self.number:
setattr(self, k, None)
......@@ -458,7 +459,7 @@ def parse_info(iofile):
def parse_repo(repopath):
"""
Parses an Arch repo db file, and returns a list of Pkg objects.
Parses an Arch repo db file, and returns a list of RepoPackage objects.
Arguments:
repopath -- The path of a repository db file.
......@@ -480,7 +481,7 @@ def parse_repo(repopath):
repodb = tarfile.open(repopath, "r")
logger.debug("Starting package parsing")
dbfiles = ('desc', 'depends', 'files')
newpkg = lambda: Pkg(reponame)
newpkg = lambda: RepoPackage(reponame)
pkgs = defaultdict(newpkg)
for tarinfo in repodb.getmembers():
if tarinfo.isreg():
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment