From 93fd9bb1428935ea62442438c6fb3d7e7aebcaba Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Tue, 22 May 2012 17:59:44 +0200 Subject: [PATCH] Adjust cfgupgrade for new minor version Also does some abstracting of the versions. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- test/cfgupgrade_unittest.py | 8 +++++++- tools/cfgupgrade | 15 +++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/test/cfgupgrade_unittest.py b/test/cfgupgrade_unittest.py index ba54b881f..a8eb8bcd1 100755 --- a/test/cfgupgrade_unittest.py +++ b/test/cfgupgrade_unittest.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -# Copyright (C) 2010 Google Inc. +# Copyright (C) 2010, 2012 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -285,6 +285,9 @@ class TestCfgupgrade(unittest.TestCase): def testUpgradeFrom_2_5(self): self._TestSimpleUpgrade(constants.BuildVersion(2, 5, 0), False) + def testUpgradeFrom_2_6(self): + self._TestSimpleUpgrade(constants.BuildVersion(2, 6, 0), False) + def testUpgradeCurrent(self): self._TestSimpleUpgrade(constants.CONFIG_VERSION, False) @@ -306,6 +309,9 @@ class TestCfgupgrade(unittest.TestCase): def testUpgradeDryRunFrom_2_5(self): self._TestSimpleUpgrade(constants.BuildVersion(2, 5, 0), True) + def testUpgradeDryRunFrom_2_6(self): + self._TestSimpleUpgrade(constants.BuildVersion(2, 6, 0), True) + def testUpgradeCurrentDryRun(self): self._TestSimpleUpgrade(constants.CONFIG_VERSION, True) diff --git a/tools/cfgupgrade b/tools/cfgupgrade index 5ea49a6e8..05022c906 100755 --- a/tools/cfgupgrade +++ b/tools/cfgupgrade @@ -1,7 +1,7 @@ #!/usr/bin/python # -# Copyright (C) 2007, 2008, 2009, 2010 Google Inc. +# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -46,6 +46,12 @@ options = None args = None +#: Target major version we will upgrade to +TARGET_MAJOR = 2 +#: Target minor version we will upgrade to +TARGET_MINOR = 6 + + class Error(Exception): """Generic exception""" pass @@ -175,13 +181,14 @@ def main(): " configuration file") # Upgrade from 2.0/2.1/2.2/2.3 to 2.4 - if config_major == 2 and config_minor in (0, 1, 2, 3, 4): + if config_major == 2 and config_minor in (0, 1, 2, 3, 4, 5): if config_revision != 0: logging.warning("Config revision is %s, not 0", config_revision) - config_data["version"] = constants.BuildVersion(2, 5, 0) + config_data["version"] = constants.BuildVersion(TARGET_MAJOR, + TARGET_MINOR, 0) - elif config_major == 2 and config_minor == 5: + elif config_major == TARGET_MAJOR and config_minor == TARGET_MINOR: logging.info("No changes necessary") else: -- GitLab