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 <[email protected]> --- README.txt | 9 +++++++-- piuparts.py | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.txt b/README.txt index ff83ae7..5a0c16a 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 8209e41..feffca7 100644 --- a/piuparts.py +++ b/piuparts.py @@ -747,6 +747,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() @@ -761,11 +762,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 -- 1.7.7.1 -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

