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

Unified Diff: scripts/slave/bot_update.py

Issue 170843003: Apply patch for bot_update (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Rebased Created 6 years, 10 months 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/bot_update.py
diff --git a/scripts/slave/bot_update.py b/scripts/slave/bot_update.py
index ace5d60890d2d531e001b8933541eafd99a99bf1..76f69b113026b421f17ebe2d2ff3ce1170b224a4 100644
--- a/scripts/slave/bot_update.py
+++ b/scripts/slave/bot_update.py
@@ -340,8 +340,30 @@ def git_checkout(solutions, revision):
first_solution = False
+def _download(url):
+ """Fetch url and return content, with retries for flake."""
+ attempts_left = 3
agable 2014/02/18 22:36:10 This should use the same RETRIES mechanism as call
Ryan Tseng 2014/02/19 22:05:40 Done.
+ while attempts_left:
+ attempts_left -= 1
+ try:
+ return urllib2.urlopen(url).read()
+ except Exception:
+ if not attempts_left:
+ raise
+ pass
+
+
def apply_issue(issue, patchset, root, server):
- pass
+ print 'Fetching patch from %s' % patch_url
+ patch_url = 'https://%s/download/issue%s_%s.diff' % (server, issue, patchset)
+ patch_data = _download(patch_url)
+ # Git patches have a/ at the beginning of source paths. We strip that out
+ # with a sed script rather than the -p flag to patch so we can feed either
+ # Git or svn-style patches into the same apply command.
+ patch_data = re.sub(r'^(---|\+\+\+) a/', r'\1 ', patch_data, re.MULTILINE)
agable 2014/02/18 22:36:10 So we are supporting svn-style patches? I guess we
Ryan Tseng 2014/02/19 22:05:40 Copypasta from here: https://code.google.com/p/chr
+ print 'Patch contents:'
+ print patch_data
+ git('apply', '--index', '-p0', '--3way', stdin=patch_data)
agable 2014/02/18 22:36:10 No need to specify --index when --3way is passed.
Ryan Tseng 2014/02/19 22:05:40 Also copypasta'ed, probably from a more simpler ti
def check_flag(flag_file):
@@ -435,9 +457,8 @@ def main():
print 'Fetching Git checkout'
git_checkout(git_solutions, options.revision)
- # TODO(hinoka): This must be implemented before we can turn this on for TS.
- # if options.issue:
- # apply_issue(options.issue, options.patchset, options.root, options.server)
+ if options.issue:
+ apply_issue(options.issue, options.patchset, options.root, options.server)
# Magic to get deps2git to work with internal DEPS.
shutil.copyfile(S2G_INTERNAL_FROM_PATH, S2G_INTERNAL_DEST_PATH)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698