mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-15 06:55:48 +00:00
add patches to clean command
This commit is contained in:
@ -300,6 +300,7 @@ def _set_repo_clean_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
parser.add_argument("--no-chroot", help="do not clear build chroot", action="store_true")
|
||||
parser.add_argument("--no-manual", help="do not clear directory with manually added packages", action="store_true")
|
||||
parser.add_argument("--no-packages", help="do not clear directory with built packages", action="store_true")
|
||||
parser.add_argument("--no-patches", help="do not clear directory with patches", action="store_true")
|
||||
parser.set_defaults(handler=handlers.Clean, quiet=True, unsafe=True)
|
||||
return parser
|
||||
|
||||
|
@ -162,7 +162,8 @@ class Application:
|
||||
for name in names:
|
||||
process_single(name)
|
||||
|
||||
def clean(self, no_build: bool, no_cache: bool, no_chroot: bool, no_manual: bool, no_packages: bool) -> None:
|
||||
def clean(self, no_build: bool, no_cache: bool, no_chroot: bool, no_manual: bool, no_packages: bool,
|
||||
no_patches: bool) -> None:
|
||||
"""
|
||||
run all clean methods. Warning: some functions might not be available under non-root
|
||||
:param no_build: do not clear directory with package sources
|
||||
@ -170,6 +171,7 @@ class Application:
|
||||
:param no_chroot: do not clear build chroot
|
||||
:param no_manual: do not clear directory with manually added packages
|
||||
:param no_packages: do not clear directory with built packages
|
||||
:param no_patches: do not clear directory with patches
|
||||
"""
|
||||
if not no_build:
|
||||
self.repository.clear_build()
|
||||
@ -181,6 +183,8 @@ class Application:
|
||||
self.repository.clear_manual()
|
||||
if not no_packages:
|
||||
self.repository.clear_packages()
|
||||
if not no_patches:
|
||||
self.repository.clear_patches()
|
||||
|
||||
def remove(self, names: Iterable[str]) -> None:
|
||||
"""
|
||||
|
@ -41,5 +41,5 @@ class Clean(Handler):
|
||||
:param configuration: configuration instance
|
||||
:param no_report: force disable reporting
|
||||
"""
|
||||
Application(architecture, configuration, no_report).clean(args.no_build, args.no_cache, args.no_chroot,
|
||||
args.no_manual, args.no_packages)
|
||||
Application(architecture, configuration, no_report).clean(
|
||||
args.no_build, args.no_cache, args.no_chroot, args.no_manual, args.no_packages, args.no_patches)
|
||||
|
@ -76,3 +76,11 @@ class Cleaner(Properties):
|
||||
self.logger.info("clear built packages directory")
|
||||
for package in self.packages_built():
|
||||
package.unlink()
|
||||
|
||||
def clear_patches(self) -> None:
|
||||
"""
|
||||
clear directory with patches
|
||||
"""
|
||||
self.logger.info("clear patches directory")
|
||||
for package in self.paths.patches.iterdir():
|
||||
shutil.rmtree(package)
|
||||
|
Reference in New Issue
Block a user