Hi holger, On 03/27/18 12:42, Holger Levsen wrote: [...] > So we first now need to do the above code changes and then deprecate > --keep-env after the buster release. > > Filing a bug so we don't forget. >
Please find the patch attached -- TiN
From 5fb5014a799a361de48b7dde1bce79977300d11a Mon Sep 17 00:00:00 2001 From: Agustin Henze <t...@aayy.com.ar> Date: Tue, 10 Apr 2018 15:22:28 -0300 Subject: [PATCH] Deprecate --keep-tmpdir in favor of --keep-env (Closes: #894232) When the user pass --keep-tmpdir as parameter, the following message is printed out: WARNING `--keep-tmpdir` is deprecated, use `--keep-env` instead Signed-off-by: Agustin Henze <t...@aayy.com.ar> --- piuparts.1.txt | 2 +- piuparts.py | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/piuparts.1.txt b/piuparts.1.txt index 7d7c91de..603eaf12 100644 --- a/piuparts.1.txt +++ b/piuparts.1.txt @@ -143,7 +143,7 @@ The tarball can be created with the '-s' option, or you can use one that *pbuild *--install-remove-install*:: Remove package after installation and reinstall. For testing installation in config-files-remaining state. -*-k*, *--keep-tmpdir*:: +*-k*, *--keep-env*:: Depending on which option is passed, keep the environment used for testing after the program ends:: * By default it doesn't remove the temporary directory for the chroot, * or if --schroot is used, the schroot session is not terminated, diff --git a/piuparts.py b/piuparts.py index 90a2851b..46c1c59f 100644 --- a/piuparts.py +++ b/piuparts.py @@ -153,7 +153,7 @@ class Settings: def __init__(self): self.defaults = None self.tmpdir = None - self.keep_tmpdir = False + self.keep_env = False self.shell_on_error = False self.max_command_output_size = 8 * 1024 * 1024 # 8 MB (google-android-ndk-installer on install) (daptup on dist-upgrade) self.max_command_runtime = 60 * 60 # 60 minutes (texlive-full and blends metapackages on dist-upgrade) @@ -826,7 +826,7 @@ class Chroot: def remove(self): """Remove a chroot and all its contents.""" - if not settings.keep_tmpdir and os.path.exists(self.name): + if not settings.keep_env and os.path.exists(self.name): self.terminate_running_processes() self.unmount_all() if settings.lvm_volume: @@ -844,7 +844,7 @@ class Chroot: if os.path.exists(self.name): create_file(os.path.join(self.name, ".piuparts.tmpdir"), "removal failed") logging.debug("Removed directory tree at %s" % self.name) - elif settings.keep_tmpdir: + elif settings.keep_env: if settings.schroot: logging.debug("Keeping schroot session %s at %s" % (self.schroot_session, self.name)) elif settings.docker_image: @@ -2738,10 +2738,16 @@ def parse_command_line(): action="store_true", default=False, help="Enable the installation of Suggests.") - parser.add_option("-k", "--keep-tmpdir", - action="store_true", default=False, - help="Keep the environment used for testing after the " - "program ends.") + def keep_env_parser(option, opt_str, value, parser): + setattr(parser.values, option.dest, True) + if "--keep-tmpdir" == opt_str: + print('WARNING `--keep-tmpdir` is deprecated, use `--keep-env` ' + 'instead') + + parser.add_option("-k", "--keep-env", "--keep-tmpdir", action="callback", + callback=keep_env_parser, default=False, dest='keep_env', + help="It keeps the environment used for testing after " + "the program ends.") parser.add_option("-K", "--keyring", action="store", metavar="FILE", help="Use FILE as the keyring to use with debootstrap when creating chroots.") @@ -2952,7 +2958,7 @@ def parse_command_line(): defaults = DefaultsFactory().new_defaults() settings.tmpdir = opts.tmpdir - settings.keep_tmpdir = opts.keep_tmpdir + settings.keep_env = opts.keep_env settings.shell_on_error = opts.shell_on_error settings.single_changes_list = opts.single_changes_list settings.single_packages = opts.single_packages -- 2.17.0
signature.asc
Description: OpenPGP digital signature