[Piuparts-commits] [SCM] piuparts git repository branch, master, updated. eda668423fa87898c59d1075118693714aa5a053

Andreas Beckmann debian at abeckmann.de
Fri Dec 23 10:27:15 UTC 2011


The following commit has been merged in the master branch:
commit 72c953bed2341ce82866487bb1e88140cb742978
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Fri Nov 11 12:11:02 2011 +0100

    add PIUPARTS_DISTRIBUTION to the environment
    
    Make the current distribution available to the custom scripts in
    the PIUPARTS_DISTRIBUTION environment variable. For the
    distupgrade tests, make PIUPARTS_DISTRIBUTION_NEXT and
    PIUPARTS_DISTRIBUTION_PREV available to pre_distupgrade_* and
    post_distupgrade_*.
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/README.txt b/README.txt
index e81d4c2..2f2b243 100644
--- a/README.txt
+++ b/README.txt
@@ -165,6 +165,9 @@ PIUPARTS_PHASE is set to one of the following values:
 During the 'install' test, the PIUPARTS_PHASE variable is set to
 'install'.
 
+The current distribution is available in the variable
+PIUPARTS_DISTRIBUTION.
+
 The following prefixes for scripts are recognized:
 
 'post_setup_' - after the *setup* of the chroot is finished.
@@ -189,10 +192,12 @@ current version in the archive has been installed (this is done
 in the second test, "Installation, upgrade and purging test").
 
 'pre_distupgrade_' - before *upgrading* the chroot to the *next
-distribution*.
+distribution*. The next distribution is available in the variable
+PIUPARTS_DISTRIBUTION_NEXT.
 
 'post_distupgrade_' - after *upgrading* the chroot to the *next
-distribution*.
+distribution*. The previous distribution is available in the
+variable PIUPARTS_DISTRIBUTION_PREV.
 
 
 === Example custom scripts:
diff --git a/piuparts.py b/piuparts.py
index 33a9997..f3855ae 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -896,6 +896,7 @@ class Chroot:
 
     def configure_chroot(self):
         """Configure a chroot according to current settings"""
+        os.environ["PIUPARTS_DISTRIBUTION"] = settings.debian_distros[0]
         if not settings.keep_sources_list:
             self.create_apt_sources(settings.debian_distros[0])
         self.create_apt_conf()
@@ -910,11 +911,14 @@ class Chroot:
         """Upgrade a chroot installation to each successive distro."""
         for distro in distros:
             logging.debug("Upgrading %s to %s" % (self.name, distro))
+            os.environ["PIUPARTS_DISTRIBUTION_NEXT"] = distro
             self.create_apt_sources(distro)
             # Run custom scripts before upgrade
             self.run_scripts("pre_distupgrade")
             self.run(["apt-get", "update"])
             self.run(["apt-get", "-yf", "dist-upgrade"])
+            os.environ["PIUPARTS_DISTRIBUTION_PREV"] = os.environ["PIUPARTS_DISTRIBUTION"]
+            os.environ["PIUPARTS_DISTRIBUTION"] = distro
             # Sometimes dist-upgrade won't upgrade the packages we want
             # to test because the new version depends on a newer library,
             # and installing that would require removing the old version

-- 
piuparts git repository



More information about the Piuparts-commits mailing list