OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """This module uprevs Chrome for cbuildbot. | 7 """This module uprevs Chrome for cbuildbot. |
8 | 8 |
9 After calling, it prints outs CHROME_VERSION_ATOM=(version atom string). A | 9 After calling, it prints outs CHROME_VERSION_ATOM=(version atom string). A |
10 caller could then use this atom with emerge to build the newly uprevved version | 10 caller could then use this atom with emerge to build the newly uprevved version |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 | 139 |
140 def __cmp__(self, other): | 140 def __cmp__(self, other): |
141 """Use ebuild paths for comparison.""" | 141 """Use ebuild paths for comparison.""" |
142 if self.ebuild_path == other.ebuild_path: | 142 if self.ebuild_path == other.ebuild_path: |
143 return 0 | 143 return 0 |
144 elif self.ebuild_path > other.ebuild_path: | 144 elif self.ebuild_path > other.ebuild_path: |
145 return 1 | 145 return 1 |
146 else: | 146 else: |
147 return (-1) | 147 return (-1) |
148 | 148 |
149 def __str__(self): | |
150 return self.ebuild_path | |
151 | |
149 | 152 |
150 def FindChromeCandidates(overlay_dir): | 153 def FindChromeCandidates(overlay_dir): |
151 """Return a tuple of chrome's unstable ebuild and stable ebuilds. | 154 """Return a tuple of chrome's unstable ebuild and stable ebuilds. |
152 | 155 |
153 Args: | 156 Args: |
154 overlay_dir: The path to chrome's portage overlay dir. | 157 overlay_dir: The path to chrome's portage overlay dir. |
155 Returns: | 158 Returns: |
156 Tuple [unstable_ebuild, stable_ebuilds]. | 159 Tuple [unstable_ebuild, stable_ebuilds]. |
157 Raises: | 160 Raises: |
158 Exception: if no unstable ebuild exists for Chrome. | 161 Exception: if no unstable ebuild exists for Chrome. |
159 """ | 162 """ |
160 stable_ebuilds = [] | 163 stable_ebuilds = [] |
161 unstable_ebuilds = [] | 164 unstable_ebuilds = [] |
162 for path in [ | 165 for path in [ |
163 os.path.join(overlay_dir, entry) for entry in os.listdir(overlay_dir)]: | 166 os.path.join(overlay_dir, entry) for entry in os.listdir(overlay_dir)]: |
164 if path.endswith('.ebuild'): | 167 if path.endswith('.ebuild'): |
165 ebuild = ChromeEBuild(path) | 168 ebuild = ChromeEBuild(path) |
166 if not ebuild.chrome_version: | 169 if not ebuild.chrome_version: |
167 Warning('Poorly formatted ebuild found at %s' % path) | 170 Warning('Poorly formatted ebuild found at %s' % path) |
168 else: | 171 else: |
169 if not ebuild.is_stable: | 172 if '9999' in ebuild.version: |
sosa
2010/12/16 19:11:34
Since we're commiting unstable ebuilds until we ha
| |
170 unstable_ebuilds.append(ebuild) | 173 unstable_ebuilds.append(ebuild) |
171 else: | 174 else: |
172 stable_ebuilds.append(ebuild) | 175 stable_ebuilds.append(ebuild) |
173 | 176 |
174 # Apply some sanity checks. | 177 # Apply some sanity checks. |
175 if not unstable_ebuilds: | 178 if not unstable_ebuilds: |
176 raise Exception('Missing 9999 ebuild for %s' % overlay_dir) | 179 raise Exception('Missing 9999 ebuild for %s' % overlay_dir) |
177 if not stable_ebuilds: | 180 if not stable_ebuilds: |
178 Warning('Missing stable ebuild for %s' % overlay_dir) | 181 Warning('Missing stable ebuild for %s' % overlay_dir) |
179 | 182 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
265 unstable_ebuild.ebuild_path, new_ebuild_path, 'CROS_SVN_COMMIT', commit, | 268 unstable_ebuild.ebuild_path, new_ebuild_path, 'CROS_SVN_COMMIT', commit, |
266 make_stable=False) | 269 make_stable=False) |
267 new_ebuild = ChromeEBuild(new_ebuild_path) | 270 new_ebuild = ChromeEBuild(new_ebuild_path) |
268 if stable_candidate and ( | 271 if stable_candidate and ( |
269 stable_candidate.chrome_version == new_ebuild.chrome_version): | 272 stable_candidate.chrome_version == new_ebuild.chrome_version): |
270 if 0 == RunCommand(['diff', '-Bu', stable_candidate.ebuild_path, | 273 if 0 == RunCommand(['diff', '-Bu', stable_candidate.ebuild_path, |
271 new_ebuild_path], | 274 new_ebuild_path], |
272 redirect_stderr=True, | 275 redirect_stderr=True, |
273 redirect_stdout=True, | 276 redirect_stdout=True, |
274 exit_code=True): | 277 exit_code=True): |
278 Info('Previous ebuild with same version found and no 9999 changes found.' | |
279 ' Nothing to do.') | |
275 os.unlink(new_ebuild_path) | 280 os.unlink(new_ebuild_path) |
276 return None | 281 return None |
277 | 282 |
278 RunCommand(['git', 'add', new_ebuild_path]) | 283 RunCommand(['git', 'add', new_ebuild_path]) |
279 if stable_candidate and stable_candidate != sticky_ebuild: | 284 if stable_candidate and stable_candidate != sticky_ebuild: |
280 RunCommand(['git', 'rm', stable_candidate.ebuild_path]) | 285 RunCommand(['git', 'rm', stable_candidate.ebuild_path]) |
281 | 286 |
282 cros_mark_as_stable.EBuildStableMarker.CommitChange( | 287 cros_mark_as_stable.EBuildStableMarker.CommitChange( |
283 _GIT_COMMIT_MESSAGE % {'chrome_rev': chrome_rev, | 288 _GIT_COMMIT_MESSAGE % {'chrome_rev': chrome_rev, |
284 'chrome_version': chrome_version}) | 289 'chrome_version': chrome_version}) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 print 'CHROME_VERSION_ATOM=%s' % chrome_version_atom | 340 print 'CHROME_VERSION_ATOM=%s' % chrome_version_atom |
336 else: | 341 else: |
337 work_branch.Delete() | 342 work_branch.Delete() |
338 except: | 343 except: |
339 work_branch.Delete() | 344 work_branch.Delete() |
340 raise | 345 raise |
341 | 346 |
342 | 347 |
343 if __name__ == '__main__': | 348 if __name__ == '__main__': |
344 main() | 349 main() |
OLD | NEW |