repo: remove archived packages when a pkg is removed from repo

This commit is contained in:
JerryXiao 2019-09-07 12:07:22 +08:00
parent a6f4f160b2
commit 91a7c2edfb
Signed by: Jerry
GPG key ID: 9D9CE43650FF2BAA

View file

@ -317,6 +317,12 @@ def _remove(pkgnames, target_archs=[a for a in ARCHS if a != 'any']):
logger.info("repo-remove: %s", repo_remove(remove_pkgs))
else:
logger.warning(f'Nothing to remove in {arch}')
archive_dir = Path('archive')
for fpath in archive_dir.iterdir():
nosigname = fpath.name[:-4] if fpath.name.endswith('.sig') else fpath.name
if nosigname.endswith(PKG_SUFFIX) and \
get_pkg_details_from_name(nosigname).pkgname in pkgnames:
throw_away(fpath)
logger.info('finished remove')
return True