[Piuparts-commits] [SCM] piuparts git repository branch, piatti, updated. 0.44-598-gace668e

Andreas Beckmann debian at abeckmann.de
Sun May 27 13:47:16 UTC 2012


The following commit has been merged in the piatti branch:
commit 09082a19d89725d8471c611028dd5d3084315588
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Wed May 23 16:32:08 2012 +0200

    add --install-remove-install option
    
    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>

diff --git a/README.txt b/README.txt
index 20542de..684bec8 100644
--- a/README.txt
+++ b/README.txt
@@ -120,6 +120,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/debian/changelog b/debian/changelog
index 63df4d1..6b901a2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,11 @@ piuparts (0.45) UNRELEASED; urgency=low
     - Release Section object when section processing is complete. 
       (Closes: #673919)
 
+  [ Andreas Beckmann ]
+  * piuparts.py:
+    - Implement --install-remove-install option to test installation in
+      config-files-remaining state.  (Closes: #359154)
+
  -- Holger Levsen <holger at debian.org>  Thu, 17 May 2012 21:08:16 +0200
 
 piuparts (0.44) unstable; urgency=low
diff --git a/piuparts.py b/piuparts.py
index 9015aa4..6d45357 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -153,6 +153,7 @@ class Settings:
         # tests and checks
         self.no_install_purge_test = False
         self.no_upgrade_test = False
+        self.install_remove_install = False
         self.list_installed_files = False
         self.extra_old_packages = []
         self.skip_cronfiles_test = False
@@ -1978,6 +1979,12 @@ def install_purge_test(chroot, chroot_state, package_files, packages):
     else:
         chroot.install_packages_by_name(packages)
 
+    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()
@@ -2007,6 +2014,9 @@ def install_upgrade_test(chroot, chroot_state, package_files, packages, old_pack
     chroot.check_for_no_processes()
     chroot.check_for_broken_symlinks()
 
+    if settings.install_remove_install:
+        chroot.remove_packages(packages)
+
     # Then from the package files.
     os.environ["PIUPARTS_PHASE"] = "upgrade"
     chroot.install_package_files(package_files, packages)
@@ -2120,16 +2130,25 @@ def install_and_upgrade_between_distros(package_files, packages):
     known_packages = chroot.get_known_packages(packages + settings.extra_old_packages)
     chroot.install_packages_by_name(known_packages)
 
+    if settings.install_remove_install:
+        chroot.remove_packages(packages)
+
     chroot.check_for_no_processes()
 
     os.environ["PIUPARTS_PHASE"] = "distupgrade"
 
-    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()
 
     os.environ["PIUPARTS_PHASE"] = "upgrade"
 
+    if settings.install_remove_install:
+        chroot.install_packages_by_name(packages)
+
     chroot.install_package_files(package_files, packages)
 
     chroot.check_for_no_processes()
@@ -2308,6 +2327,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("--extra-old-packages",
                       action="append", default=[],
                       help="Install these additional packages along with the old packages from the archive. " +
@@ -2425,6 +2448,7 @@ def parse_command_line():
     # tests and checks
     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.list_installed_files = opts.list_installed_files
     [settings.extra_old_packages.extend([i.strip() for i in csv.split(",")]) for csv in opts.extra_old_packages]
     settings.skip_cronfiles_test = opts.skip_cronfiles_test

-- 
piuparts git repository



More information about the Piuparts-commits mailing list