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

Unified Diff: bin/cbuildbot.py

Issue 5344002: Update cbuildbot.py and prebuilt.py to deduplicate preflight prebuilts. (Closed) Base URL: None@preflight_upload
Patch Set: Address comments by dianders. Created 10 years, 1 month 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') | chromite/lib/binpkg.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 0c2f2eaa4f4a1a7e8aecafdd46ef6f14b5a98ca2..b73a72409ffa5bddc3214fc0a38ec7d0d025c9a5 100755
--- a/bin/cbuildbot.py
+++ b/bin/cbuildbot.py
@@ -310,17 +310,20 @@ def _GetPortageEnvVar(buildroot, board, envvar):
buildroot: The root directory where the build occurs. Must be an absolute
path.
- board: Board type that was built on this machine. E.g. x86-generic.
- envvar: The environment variable to get. E.g. "PORTAGE_BINHOST".
+ board: Board type that was built on this machine. E.g. x86-generic. If this
+ is None, get the env var from the host.
+ envvar: The environment variable to get. E.g. 'PORTAGE_BINHOST'.
Returns:
The value of the environment variable, as a string. If no such variable
can be found, return the empty string.
"""
cwd = os.path.join(buildroot, 'src', 'scripts')
- binhost = RunCommand(['portageq-%s' % board, 'envvar', envvar],
- cwd=cwd, redirect_stdout=True, enter_chroot=True,
- error_ok=True)
+ portageq = 'portageq'
+ if board:
+ portageq += '-%s' % board
+ binhost = RunCommand([portageq, 'envvar', envvar], cwd=cwd,
+ redirect_stdout=True, enter_chroot=True, error_ok=True)
return binhost.rstrip('\n')
@@ -522,7 +525,7 @@ def _ResolveOverlays(buildroot, overlays):
return paths
-def _UploadPrebuilts(buildroot, board, overlay_config):
+def _UploadPrebuilts(buildroot, board, overlay_config, binhosts):
"""Upload prebuilts.
Args:
@@ -532,14 +535,20 @@ def _UploadPrebuilts(buildroot, board, overlay_config):
'private': Just the private overlay.
'public': Just the public overlay.
'both': Both the public and private overlays.
+ binhosts: The URLs of the current binhosts. Binaries that are already
+ present will not be uploaded twice. Empty URLs will be ignored.
"""
cmd = ['%s/src/scripts/prebuilt.py' % buildroot,
'--sync-binhost-conf',
+ '--sync-host',
'--build-path', buildroot,
'--board', board,
'--prepend-version', 'preflight',
'--key', _PREFLIGHT_BINHOST]
+ for binhost in binhosts:
+ if binhost:
+ cmd.extend(['--previous-binhost-url', binhost])
if overlay_config == 'public':
cmd.extend(['--upload', 'gs://chromeos-prebuilt'])
else:
@@ -595,12 +604,14 @@ def main():
boardpath = os.path.join(chroot_path, 'build', board)
if options.clobber or not os.path.isdir(buildroot):
_FullCheckout(buildroot, tracking_branch, url=options.url)
+ new_binhost = _GetPortageEnvVar(buildroot, board, _FULL_BINHOST),
else:
old_binhost = _GetPortageEnvVar(buildroot, board, _FULL_BINHOST)
_IncrementalCheckout(buildroot)
new_binhost = _GetPortageEnvVar(buildroot, board, _FULL_BINHOST)
if old_binhost != new_binhost:
RunCommand(['sudo', 'rm', '-rf', boardpath])
+ binhosts = [new_binhost, _GetPortageEnvVar(buildroot, None, _FULL_BINHOST)]
# Check that all overlays can be found.
for path in overlays:
@@ -641,7 +652,8 @@ def main():
if buildconfig['master']:
# Master bot needs to check if the other slaves completed.
if cbuildbot_comm.HaveSlavesCompleted(config):
- _UploadPrebuilts(buildroot, board, buildconfig['overlays'])
+ _UploadPrebuilts(buildroot, board, buildconfig['overlays'],
+ binhosts)
_UprevPush(buildroot, tracking_branch, buildconfig['board'],
overlays)
else:
« no previous file with comments | « no previous file | bin/cbuildbot_unittest.py » ('j') | chromite/lib/binpkg.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698