Skip to content

Commit

Permalink
Implement the purge action
Browse files Browse the repository at this point in the history
Signed-off-by: Jose Luis Rivero <jrivero@osrfoundation.org>
  • Loading branch information
j-rivero committed Apr 10, 2024
1 parent 881a94c commit b12a006
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions plugins/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
enable Enable repository in the system
disable Disable repository (if present)
list List repositories enabled
purge Remove all configurations installed by gzdev
Options:
-h --help Show this screen
--version Show gzdev's version
--gpg-check Do run a gpg check for validating the key
downloaded in enable action
(need the gpg binary)
--pre-cleanup Remove all repositories and keys installed
by gzdev from the system before proceding
--pre-cleanup Run 'purge' action before proceeding
"""

import distro
Expand Down Expand Up @@ -225,6 +225,9 @@ def normalize_args(args):
force_linux_distro = args['--force-linux-distro']
gpg_check = args['--gpg_check'] if '--gpg_check' in args else False
pre_cleanup = args['--pre-cleanup'] if '--pre-cleanup' in args else False
if pre_cleanup and action != 'enable':
error('--pre-cleanup is only supported in the "enable" action'
f'(not in {action})')
if force_linux_distro:
linux_distro = force_linux_distro
else:
Expand Down Expand Up @@ -277,6 +280,8 @@ def process_input(args, config):
gpg_check)
elif (action == 'disable'):
disable_repo(repo_name)
elif (action == 'purge'):
remove_all_installed()


def remove_file_by_pattern(directory, pattern):
Expand Down

0 comments on commit b12a006

Please sign in to comment.