| OLD | NEW |
| 1 #!/usr/bin/env python2.7 | 1 #!/usr/bin/env python2.7 |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ | 6 """ |
| 7 This module wraps ChromeOS's Chromite configuration, providing retrieval | 7 This module wraps ChromeOS's Chromite configuration, providing retrieval |
| 8 methods and Infra-aware introspection. | 8 methods and Infra-aware introspection. |
| 9 | 9 |
| 10 For any given ChromeOS build, Chromite may be pinned to a specific ChromeOS | 10 For any given ChromeOS build, Chromite may be pinned to a specific ChromeOS |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 # The name of the branch associated with tip-of-tree. | 40 # The name of the branch associated with tip-of-tree. |
| 41 TOT_BRANCH = 'master' | 41 TOT_BRANCH = 'master' |
| 42 | 42 |
| 43 | 43 |
| 44 # A map of branch names to their pinned commits. These are maintained through | 44 # A map of branch names to their pinned commits. These are maintained through |
| 45 # a DEPS hook in <build>/DEPS. In order to update a pinned revision: | 45 # a DEPS hook in <build>/DEPS. In order to update a pinned revision: |
| 46 # - Update the value here. | 46 # - Update the value here. |
| 47 # - Run "gclient runhooks --force". | 47 # - Run "gclient runhooks --force". |
| 48 PINS = collections.OrderedDict(( | 48 PINS = collections.OrderedDict(( |
| 49 (TOT_BRANCH, '785cb2b424efc25cbcfc7064929342f663f24386'), | 49 (TOT_BRANCH, 'e1691aede93ab3fd28df7e88c28c98842146e569'), |
| 50 ('release-R41-6680.B', 'c646e387feb48aa2a8a78908798fa40379da6ba1'), | 50 ('release-R41-6680.B', 'c646e387feb48aa2a8a78908798fa40379da6ba1'), |
| 51 ('release-R40-6457.B', '418ae60c87c0299670725b755a87e2d71fadb897'), | 51 ('release-R40-6457.B', '418ae60c87c0299670725b755a87e2d71fadb897'), |
| 52 ('release-R39-6310.B', '45f459eaf5ffcfb34469824e9e751bd1491175df'), | 52 ('release-R39-6310.B', '45f459eaf5ffcfb34469824e9e751bd1491175df'), |
| 53 )) | 53 )) |
| 54 | 54 |
| 55 | 55 |
| 56 class ChromiteError(RuntimeError): | 56 class ChromiteError(RuntimeError): |
| 57 pass | 57 pass |
| 58 | 58 |
| 59 | 59 |
| 60 # Slave pool allocation types. | 60 # Slave pool allocation types. |
| 61 class SlaveType(object): | 61 class SlaveType(object): |
| 62 """Slave configuration expression enumeration.""" | 62 """Slave configuration expression enumeration.""" |
| 63 BAREMETAL = 'baremetal' | 63 BAREMETAL = 'baremetal' |
| 64 VM = 'vm' | 64 VM = 'vm' |
| 65 GCE = 'gce' | 65 GCE = 'gce' |
| 66 | 66 |
| 67 | 67 |
| 68 class ChromiteTarget(object): | 68 class ChromiteTarget(object): |
| 69 """Wraps a single Chromite target. | 69 """Wraps a single Chromite target. |
| 70 | 70 |
| 71 Reproduces some core logic from Chromite's 'cbuildbot' libraries to access | 71 Reproduces some core logic from Chromite's 'cbuildbot' libraries to access |
| 72 various configuration parameters. | 72 various configuration parameters. |
| 73 """ | 73 """ |
| 74 | 74 |
| 75 ASAN = 'asan' |
| 76 CANARY = 'canary' |
| 77 FACTORY = 'factory' |
| 78 FIRMWARE = 'firmware' |
| 79 FULL = 'full' |
| 80 INCREMENTAL = 'incremental' |
| 81 PALADIN = 'paladin' |
| 82 PFQ = 'pfq' |
| 83 PRE_CQ = 'pre-cq' |
| 75 PRE_CQ_LAUNCHER = 'pre-cq-launcher' | 84 PRE_CQ_LAUNCHER = 'pre-cq-launcher' |
| 76 PRE_CQ = 'pre-cq' | 85 REFRESH_PACKAGES = 'refresh-packages' |
| 77 PFQ = 'pfq' | |
| 78 PALADIN = 'paladin' | |
| 79 CANARY = 'canary' | |
| 80 FIRMWARE = 'firmware' | |
| 81 INCREMENTAL = 'incremental' | |
| 82 FACTORY = 'factory' | |
| 83 SDK = 'sdk' | 86 SDK = 'sdk' |
| 84 TOOLCHAIN = 'toolchain' | 87 TOOLCHAIN = 'toolchain' |
| 85 | 88 |
| 86 # Maps cbuildbot's "build_type" field to target constants. This is used in the | 89 # Maps cbuildbot's "build_type" field to target constants. This is used in the |
| 87 # first pass prior to attempting to infer the class from the target's name. | 90 # first pass prior to attempting to infer the class from the target's name. |
| 88 # (see Categorize) | 91 # (see Categorize) |
| 89 BUILD_TYPE_CATEGORY_MAP = { | 92 BUILD_TYPE_CATEGORY_MAP = { |
| 90 'priest': PRE_CQ_LAUNCHER, | 93 'priest': PRE_CQ_LAUNCHER, |
| 91 'paladin': PALADIN, | 94 'paladin': PALADIN, |
| 92 'canary': CANARY, | 95 'canary': CANARY, |
| 93 'chrome': PFQ, | 96 'chrome': PFQ, |
| 94 } | 97 } |
| 95 | 98 |
| 96 # Maps configuration name suffixes to target type constants. | 99 # Maps configuration name suffixes to target type constants. |
| 97 # (see Categorize) | 100 # (see Categorize) |
| 98 SUFFIX_MAP = collections.OrderedDict(( | 101 SUFFIX_MAP = collections.OrderedDict(( |
| 102 (ASAN, ('asan',)), |
| 103 (CANARY, ('release', 'release-group',)), |
| 104 (FACTORY, ('factory',)), |
| 105 (FIRMWARE, ('firmware',)), |
| 106 (FULL, ('full',)), |
| 107 (INCREMENTAL, ('incremental',)), |
| 108 (PALADIN, ('paladin',)), |
| 109 (PFQ, ('chrome-pfq', 'chromium-pfq',)), |
| 99 (PRE_CQ, ('pre-cq',)), | 110 (PRE_CQ, ('pre-cq',)), |
| 100 (PFQ, ('chrome-pfq', 'chromium-pfq',)), | 111 (REFRESH_PACKAGES, ('refresh-packages',)), |
| 101 (PALADIN, ('paladin',)), | |
| 102 (CANARY, ('release', 'release-group',)), | |
| 103 (FIRMWARE, ('firmware',)), | |
| 104 (INCREMENTAL, ('incremental',)), | |
| 105 (FACTORY, ('factory',)), | |
| 106 (SDK, ('sdk',)), | 112 (SDK, ('sdk',)), |
| 107 (TOOLCHAIN, ('toolchain-major', 'toolchain-minor',)), | 113 (TOOLCHAIN, ('toolchain-major', 'toolchain-minor',)), |
| 108 )) | 114 )) |
| 109 | 115 |
| 110 # Sentinel value to indicate a missing key. | 116 # Sentinel value to indicate a missing key. |
| 111 _MISSING = object() | 117 _MISSING = object() |
| 112 | 118 |
| 113 def __init__(self, name, config, children=None, default=None): | 119 def __init__(self, name, config, children=None, default=None): |
| 114 self._name = name | 120 self._name = name |
| 115 self._config = config | 121 self._config = config |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 557 |
| 552 # Allow this script to be used as a bootstrap to fetch/cache Chromite | 558 # Allow this script to be used as a bootstrap to fetch/cache Chromite |
| 553 # artifacts (gclient runhooks). | 559 # artifacts (gclient runhooks). |
| 554 if __name__ == '__main__': | 560 if __name__ == '__main__': |
| 555 logging.basicConfig() | 561 logging.basicConfig() |
| 556 try: | 562 try: |
| 557 sys.exit(main()) | 563 sys.exit(main()) |
| 558 except Exception as e: | 564 except Exception as e: |
| 559 logging.exception("Uncaught execption: %s", e) | 565 logging.exception("Uncaught execption: %s", e) |
| 560 sys.exit(1) | 566 sys.exit(1) |
| OLD | NEW |