Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2903)

Unified Diff: bin/cbuildbot.py

Issue 5689003: Add ability to store the manifest in the manifest directory. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Issues while testing Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | bin/cbuildbot_unittest.py » ('j') | bin/cbuildbot_unittest.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/cbuildbot.py
diff --git a/bin/cbuildbot.py b/bin/cbuildbot.py
index 8b44fdf2539105737e7d1470221c66f8849a61be..c91194110831e1d8056a682709d03d88774e58e6 100755
--- a/bin/cbuildbot.py
+++ b/bin/cbuildbot.py
@@ -25,6 +25,8 @@ _DEFAULT_RETRIES = 3
_PACKAGE_FILE = '%(buildroot)s/src/scripts/cbuildbot_package.list'
ARCHIVE_BASE = '/var/www/archive'
ARCHIVE_COUNT = 10
+PUBLIC_OVERLAY = '%(buildroot)s/src/third_party/chromiumos-overlay'
+PRIVATE_OVERLAY = '%(buildroot)s/src/private-overlays/chromeos-overlay'
# Currently, both the full buildbot and the preflight buildbot store their
# data in a variable named PORTAGE_BINHOST, but they're in different files.
@@ -76,9 +78,6 @@ def RepoSync(buildroot, retries=_DEFAULT_RETRIES):
Warning('CBUILDBOT -- Retries exhausted')
raise
- # Output manifest
- RunCommand(['repo', 'manifest', '-r', '-o', '-'], cwd=buildroot)
-
# =========================== Command Helpers =================================
def _GetAllGitRepos(buildroot, debug=False):
@@ -278,6 +277,31 @@ def _WipeOldOutput(buildroot):
RunCommand(['rm', '-rf', 'src/build/images'], cwd=buildroot)
+def _GetChromeOSVersion(buildroot):
+ """Returns the tuple version of the Chrome OS version of the buildroot."""
+ cwd = os.path.join(buildroot, 'src', 'scripts')
+ version_cmd = './chromeos_version.sh'
+ output = RunCommand(version_cmd, cwd=cwd, redirect_stdout=True,
+ redirect_stderr=True)
+ version_re = re.compile('\s+CHROMEOS_VERSION_STRING='
+ '(\d+)\.(\d+)\.(\d+)\.(\w+)')
+ for line in output.splitlines():
+ match = version_re.match(line)
+ if match:
+ return match.group(1), match.group(2), match.group(3), match.group(4)
+
+ raise Exception('Chrome OS version not found.')
+
+
+def _GetManifestPath(buildroot):
+ """Returns the relative path that a manifest should be saved into."""
+ version_tuple = _GetChromeOSVersion(buildroot)
+ (major, minor, branch, patch) = version_tuple
+ relative_path = os.path.join('.'.join([major, minor]),
+ '%s.xml' % '.'.join(version_tuple))
+ return relative_path
+
+
# =========================== Main Commands ===================================
@@ -306,6 +330,36 @@ def _IncrementalCheckout(buildroot, retries=_DEFAULT_RETRIES):
RepoSync(buildroot, retries)
+def _DumpManifest(buildroot, url):
+ """Stores the manifest in the public | private overlay depending on url."""
+ public_overlay = PUBLIC_OVERLAY % {'buildroot': buildroot}
scottz 2010/12/11 00:01:53 since you use {'buildroot': buildroot] in so many
sosa 2010/12/13 18:46:39 Rather not since buildroot would have to be define
+ private_overlay = PRIVATE_OVERLAY % {'buildroot': buildroot}
+ if url.endswith('manifest-internal'):
+ overlay = PRIVATE_OVERLAY % {'buildroot': buildroot}
+ else:
+ overlay = PUBLIC_OVERLAY % {'buildroot': buildroot}
+
+ # Generate paths for manifests.
+ relative_path = _GetManifestPath(buildroot)
+ manifest_path = os.path.join(overlay, 'manifests', relative_path)
+ symlink_path = os.path.join(overlay, 'manifests', 'LATEST')
+ if not os.path.isdir(os.path.dirname(manifest_path)):
+ os.makedirs(os.path.dirname(manifest_path))
+
+ # Dump the manifest and create a symlink to it.
+ RunCommand(['repo', 'manifest', '-r', '-o', manifest_path], cwd=buildroot)
+ if os.path.exists(symlink_path):
+ os.unlink(symlink_path)
+
+ os.symlink(relative_path, symlink_path)
+
+ # Add it to git and print it to stderr.
+ RunCommand(['git', 'add', os.path.join('manifests', relative_path)],
+ cwd=overlay)
+ RunCommand(['git', 'add', os.path.join('manifests', 'LATEST')], cwd=overlay)
+ shutil.copy(manifest_path, '/dev/stderr')
scottz 2010/12/11 00:01:53 Why are we doing this?
sosa 2010/12/13 18:46:39 Moved out to a function that does standard open, r
+
+
def _MakeChroot(buildroot):
"""Wrapper around make_chroot."""
cwd = os.path.join(buildroot, 'src', 'scripts')
@@ -527,8 +581,8 @@ def _ResolveOverlays(buildroot, overlays):
'public': Just the public overlay.
'both': Both the public and private overlays.
"""
- public_overlay = '%s/src/third_party/chromiumos-overlay' % buildroot
- private_overlay = '%s/src/private-overlays/chromeos-overlay' % buildroot
+ public_overlay = PUBLIC_OVERLAY % {'buildroot': buildroot}
+ private_overlay = PRIVATE_OVERLAY % {'buildroot': buildroot}
if overlays == 'private':
paths = [private_overlay]
elif overlays == 'public':
@@ -657,6 +711,8 @@ def main():
if not os.path.isdir(path):
Die('Missing overlay: %s' % path)
+ _DumpManifest(buildroot, options.url)
+
if not os.path.isdir(chroot_path):
_MakeChroot(buildroot)
« no previous file with comments | « no previous file | bin/cbuildbot_unittest.py » ('j') | bin/cbuildbot_unittest.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698