diff options
author | iancottrell@chromium.org <iancottrell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-05 12:59:48 +0000 |
---|---|---|
committer | iancottrell@chromium.org <iancottrell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-05 12:59:48 +0000 |
commit | dde3e9cb5128757e35ba5b9fa71cdf2abe01041d (patch) | |
tree | 1aeecade76b6a30af622d71029b9f70c7061ce78 /tools/cr | |
parent | fb158e61a07dc6bbc6ce44a5d672ccd17f317591 (diff) | |
download | chromium_src-dde3e9cb5128757e35ba5b9fa71cdf2abe01041d.zip chromium_src-dde3e9cb5128757e35ba5b9fa71cdf2abe01041d.tar.gz chromium_src-dde3e9cb5128757e35ba5b9fa71cdf2abe01041d.tar.bz2 |
[cr tool] Adding architecture fixups
BUG=316397
Review URL: https://codereview.chromium.org/102043002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238959 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/cr')
-rw-r--r-- | tools/cr/cr/base/client.py | 2 | ||||
-rw-r--r-- | tools/cr/cr/commands/init.py | 2 | ||||
-rw-r--r-- | tools/cr/cr/fixups/__init__.py | 9 | ||||
-rw-r--r-- | tools/cr/cr/fixups/arch.py | 54 |
4 files changed, 66 insertions, 1 deletions
diff --git a/tools/cr/cr/base/client.py b/tools/cr/cr/base/client.py index 6cdd83a..d2511f0 100644 --- a/tools/cr/cr/base/client.py +++ b/tools/cr/cr/base/client.py @@ -18,7 +18,7 @@ import cr.auto.build import cr.auto.client # The config version currently supported. -VERSION = '0.3' +VERSION = '0.4' # The default directory name to store config inside CLIENT_CONFIG_PATH = '.cr' # The partial filename to add to a directory to get it's config file. diff --git a/tools/cr/cr/commands/init.py b/tools/cr/cr/commands/init.py index 50696b1..2cb5ec4 100644 --- a/tools/cr/cr/commands/init.py +++ b/tools/cr/cr/commands/init.py @@ -145,6 +145,8 @@ class InitCommand(cr.Command): # Run all the output directory fixup tasks for fixup in InitFixup.Plugins(): fixup.Fixup(context, old_version, build_package.config) + # Redo activations, they might have changed + cr.plugin.Activate(context) # Write out the new configuration, and select it as the default cr.base.client.WriteConfig(context, context.Get('CR_BUILD_DIR'), diff --git a/tools/cr/cr/fixups/__init__.py b/tools/cr/cr/fixups/__init__.py new file mode 100644 index 0000000..86bfa2a --- /dev/null +++ b/tools/cr/cr/fixups/__init__.py @@ -0,0 +1,9 @@ +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""A package for all the version fixups. + +All the code in this package is there to fix up older output directories and +clients to a form that works with the current version of cr. +""" diff --git a/tools/cr/cr/fixups/arch.py b/tools/cr/cr/fixups/arch.py new file mode 100644 index 0000000..0b250c8b --- /dev/null +++ b/tools/cr/cr/fixups/arch.py @@ -0,0 +1,54 @@ +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""A module for architecture output directory fixups.""" + +import cr + + +class _ArchFixupHelper(cr.InitFixup): + """Base class helper for CR_ARCH value fixups.""" + + def _VersionTest(self, old_version): + _ = old_version + return True + + def _ArchConvert(self, old_arch): + return old_arch + + def Fixup(self, context, old_version, config): + if not self._VersionTest(old_version): + return + old_arch = config.OVERRIDES.Find(cr.Arch.SELECTOR) + new_arch = self._ArchConvert(old_arch) + if new_arch != old_arch: + print '** Fixing architecture from {0} to {1}'.format(old_arch, new_arch) + config.OVERRIDES[cr.Arch.SELECTOR] = new_arch + + +class WrongArchDefaultInitFixup(_ArchFixupHelper): + """Fixes bad initial defaults. + + In the initial versions of cr before output directories were versioned + it was writing invalid architecture defaults. This detects that case and sets + the architecture to the current default instead. + """ + + def _VersionTest(self, old_version): + return old_version is None + + def _ArchConvert(self, _): + return cr.Arch.default.name + + +class MipsAndArmRenameInitFixup(_ArchFixupHelper): + """Fixes rename of Mips and Arm to Mips32 and Arm32.""" + + def _ArchConvert(self, old_arch): + if old_arch == 'mips': + return cr.Mips32Arch.GetInstance().name + if old_arch == 'arm': + return cr.Arm32Arch.GetInstance().name + return old_arch + |