mirror of
https://github.com/archlinux-jerry/buildbot
synced 2024-12-05 03:10:41 +08:00
some improvements
This commit is contained in:
parent
1509183847
commit
3984d68a6a
2 changed files with 16 additions and 8 deletions
18
repo.py
18
repo.py
|
@ -53,10 +53,13 @@ def checkenv():
|
|||
checkenv()
|
||||
|
||||
|
||||
def repo_add(fpath):
|
||||
assert issubclass(type(fpath), os.PathLike) and fpath.name.endswith(f'.pkg.tar.{PKG_COMPRESSION}')
|
||||
def repo_add(fpaths):
|
||||
assert type(fpaths) is list
|
||||
for fpath in fpaths:
|
||||
assert issubclass(type(fpath), os.PathLike) and \
|
||||
fpath.name.endswith(f'.pkg.tar.{PKG_COMPRESSION}')
|
||||
dbpath = fpath.parent / f'{REPO_NAME}.db.tar.gz'
|
||||
return bash(f'{REPO_CMD} {dbpath} {fpath}')
|
||||
return bash(f'{REPO_CMD} {dbpath} {" ".join([str(fpath for fpath in fpaths)])}')
|
||||
|
||||
def throw_away(fpath):
|
||||
assert issubclass(type(fpath), os.PathLike)
|
||||
|
@ -91,6 +94,7 @@ def _check_repo():
|
|||
for arch in ARCHS:
|
||||
basedir = Path('www') / arch
|
||||
repo_files_count = list()
|
||||
pkg_to_add = list()
|
||||
if not basedir.exists():
|
||||
logger.error(f'{arch} dir does not exist!')
|
||||
continue
|
||||
|
@ -119,12 +123,16 @@ def _check_repo():
|
|||
assert not newSigpath.exists()
|
||||
sigfile.rename(newSigpath)
|
||||
logger.info(f'Moving {pkgfile} to {newpath}, {sigfile} to {newSigpath}')
|
||||
logger.debug("repo-add: %s", repo_add(newpath))
|
||||
pkg_to_add.append(newpath)
|
||||
else:
|
||||
logger.debug("repo-add: %s", repo_add(pkgfile))
|
||||
pkg_to_add.append(pkgfile)
|
||||
else:
|
||||
logger.warning(f"{pkgfile} is garbage!")
|
||||
throw_away(pkgfile)
|
||||
if pkg_to_add:
|
||||
logger.info("repo-add: %s", repo_add(pkg_to_add))
|
||||
else:
|
||||
logger.warning('repo-add: Nothing to do in %s', arch)
|
||||
for rfile in repo_files_essential:
|
||||
if rfile not in repo_files_count:
|
||||
logger.error(f'{rfile} does not exist in {arch}!')
|
||||
|
|
6
utils.py
6
utils.py
|
@ -101,8 +101,8 @@ class Pkg:
|
|||
|
||||
def get_pkg_details_from_name(name):
|
||||
if name.endswith(f'pkg.tar.{PKG_COMPRESSION}'):
|
||||
arch = re.match(r'(.+)-([^-]+)-([^-]+)-([^-]+)\.pkg\.tar\.\w+', name)
|
||||
assert arch and arch.groups() and len(arch.groups()) == 4
|
||||
(pkgname, pkgver, pkgrel, arch) = arch.groups()
|
||||
m = re.match(r'(.+)-([^-]+)-([^-]+)-([^-]+)\.pkg\.tar\.\w+', name)
|
||||
assert m and m.groups() and len(m.groups()) == 4
|
||||
(pkgname, pkgver, pkgrel, arch) = m.groups()
|
||||
return Pkg(pkgname, pkgver, pkgrel, arch)
|
||||
|
||||
|
|
Loading…
Reference in a new issue