repo.py: fix TypeError

This commit is contained in:
JerryXiao 2019-04-03 12:39:33 +08:00
parent 3864a17b60
commit ca00ac4ecd
Signed by: Jerry
GPG Key ID: 9D9CE43650FF2BAA
2 changed files with 2 additions and 1 deletions

View File

@ -155,7 +155,7 @@ def _update():
if pkg_to_add.name.endswith(PKG_SUFFIX):
sigfile = Path(f"{str(pkg_to_add)}.sig")
if sigfile.exists():
arch = get_pkg_details_from_name(pkg_to_add).arch
arch = get_pkg_details_from_name(pkg_to_add.name).arch
pkg_nlocation = pkg_to_add.parent / '..' / 'www' / arch / pkg_to_add.name
sig_nlocation = Path(f'{str(pkg_nlocation)}.sig')
logger.info(f'Moving {pkg_to_add} to {pkg_nlocation}, {sigfile} to {sig_nlocation}')

View File

@ -102,6 +102,7 @@ class Pkg:
self.arch = arch
def get_pkg_details_from_name(name):
assert type(name) is str
if name.endswith(f'pkg.tar.{PKG_COMPRESSION}'):
m = re.match(r'(.+)-([^-]+)-([^-]+)-([^-]+)\.pkg\.tar\.\w+', name)
assert m and m.groups() and len(m.groups()) == 4