[Piuparts-devel] Bug#359154: [PATCH] add --install-remove-install option
Andreas Beckmann
debian at abeckmann.de
Wed Nov 9 19:17:18 UTC 2011
git://github.com/anbe42/piuparts.git feature/359154-install-remove-install
----- 8< -----
The --install-remove-install option modifies the three piuparts
tests in order to test package installation while config files
from a previous installation are remaining, but the package itself
was removed inbetween.
This exercises different code paths in the maintainer scripts.
Closes: #359154
Signed-off-by: Andreas Beckmann <debian at abeckmann.de>
---
README.txt | 11 +++++++++++
piuparts.py | 23 ++++++++++++++++++++++-
2 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/README.txt b/README.txt
index 43921b3..e4b2509 100644
--- a/README.txt
+++ b/README.txt
@@ -112,6 +112,17 @@ purges.
If you only want to perfom the first test, you can use the
option: '--no-upgrade-test'
+=== Testing packages in the config-files-remaining state
+
+The --install-remove-install option modifies the three piuparts
+tests in order to test package installation while config files
+from a previous installation are remaining, but the package itself
+was removed inbetween.
+This exercises different code paths in the maintainer scripts.
+
+. Installation and purging test: install, remove, install again and purge.
+. Installation, upgrade and purging test: install the old version, remove, install the new version and purge.
+. Distupgrade test: install the version from the first distribution, remove, distupgrade to the last distribution, install the new version.
=== Analyzing piuparts results
diff --git a/piuparts.py b/piuparts.py
index 2fcc97f..9fe7f4e 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -151,6 +151,7 @@ class Settings:
self.list_installed_files = False
self.no_install_purge_test = False
self.no_upgrade_test = False
+ self.install_remove_install = False
self.skip_cronfiles_test = False
self.skip_logrotatefiles_test = False
self.check_broken_symlinks = True
@@ -1737,6 +1738,12 @@ def install_purge_test(chroot, root_info, selections, package_files, packages):
chroot.install_packages_by_name(packages)
chroot.run(["apt-get", "clean"])
+ if settings.install_remove_install:
+ chroot.remove_packages(packages)
+ if package_files:
+ chroot.install_package_files(package_files)
+ else:
+ chroot.install_packages_by_name(packages)
chroot.check_for_no_processes()
chroot.check_for_broken_symlinks()
@@ -1764,6 +1771,9 @@ def install_upgrade_test(chroot, root_info, selections, package_files, packages)
chroot.check_for_broken_symlinks()
+ if settings.install_remove_install:
+ chroot.remove_packages(packages)
+
# Then from the package files.
chroot.install_package_files(package_files)
@@ -1862,12 +1872,18 @@ def install_and_upgrade_between_distros(package_files, packages):
chroot.run(["apt-get", "update"])
chroot.install_packages_by_name(packages)
+ if settings.install_remove_install:
+ chroot.remove_packages(packages)
+
if settings.scriptsdir is not None:
chroot.run_scripts("pre_upgrade")
chroot.check_for_no_processes()
- chroot.upgrade_to_distros(settings.debian_distros[1:], packages)
+ if not settings.install_remove_install:
+ chroot.upgrade_to_distros(settings.debian_distros[1:], packages)
+ else:
+ chroot.upgrade_to_distros(settings.debian_distros[1:], [])
chroot.check_for_no_processes()
@@ -2045,6 +2061,10 @@ def parse_command_line():
action="store_true", default=False,
help="Skip install and purge test.")
+ parser.add_option("--install-remove-install",
+ action="store_true", default=False,
+ help="Remove package after installation and reinstall. For testing installation in config-files-remaining state.")
+
parser.add_option("-p", "--pbuilder", action="callback",
callback=set_basetgz_to_pbuilder,
help="Use /var/cache/pbuilder/base.tgz as the base " +
@@ -2138,6 +2158,7 @@ def parse_command_line():
settings.list_installed_files = opts.list_installed_files
settings.no_install_purge_test = opts.no_install_purge_test
settings.no_upgrade_test = opts.no_upgrade_test
+ settings.install_remove_install = opts.install_remove_install
settings.skip_cronfiles_test = opts.skip_cronfiles_test
settings.skip_logrotatefiles_test = opts.skip_logrotatefiles_test
settings.keyring = opts.keyring
--
1.7.7.1
More information about the Piuparts-devel
mailing list