qvm-template: remove downloaded package after installation

At least by default. Otherwise they will pile up in the cache dir.
This commit is contained in:
Marek Marczykowski-Górecki 2021-01-30 06:07:24 +01:00
parent fe369ce523
commit f053f51644
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -124,6 +124,8 @@ def get_parser() -> argparse.ArgumentParser:
help='Set repository metadata as expired before running the command.')
parser_main.add_argument('--cachedir', default=CACHE_DIR,
help='Specify cache directory.')
parser_main.add_argument('--keep-cache', default=False,
help='Keep downloaded packages in cache dir')
parser_main.add_argument('--yes', action='store_true',
help='Assume "yes" to questions.')
parser_main.add_argument('--quiet', action='store_true',
@ -982,6 +984,8 @@ def install(
package_hdr[rpm.RPMTAG_SUMMARY]
tpl.features['template-description'] = \
package_hdr[rpm.RPMTAG_DESCRIPTION].replace('\n', '|')
if rpmfile.startswith(args.cachedir) and not args.keep_cache:
os.remove(rpmfile)
def list_templates(args: argparse.Namespace,
app: qubesadmin.app.QubesBase, operation: str) -> None: