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

Side by Side Diff: slave/skia_slave_scripts/utils/upload_to_bucket.py

Issue 648353002: Remove Skia's forked buildbot code (Closed) Base URL: https://skia.googlesource.com/buildbot.git@master
Patch Set: Fix launch_slaves, remove more stuff Created 6 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Upload a single file to a Google Storage Bucket.
7
8 To test:
9 cd .../buildbot/slave/skia_slave_scripts/utils
10 CR_BUILDBOT_PATH=../../../third_party/chromium_buildbot
11 PYTHONPATH=$CR_BUILDBOT_PATH/scripts:$CR_BUILDBOT_PATH/site_config \
12 python upload_to_bucket.py \
13 --source_filepath=../../../DEPS --dest_gsbase=gs://chromium-skia-gm
14 """
15
16 from py.utils import misc
17 import optparse
18 import os
19 import sys
20
21 from slave import slave_utils
22
23 def upload_to_bucket(source_filepath, dest_gsbase, subdir=None):
24 abs_source_filepath = misc.GetAbsPath(source_filepath)
25 print 'translated source_filepath %s to absolute path %s' % (
26 source_filepath, abs_source_filepath)
27 if not os.path.exists(abs_source_filepath):
28 raise Exception('ERROR: file not found: %s' % abs_source_filepath)
29 status = slave_utils.GSUtilCopyFile(abs_source_filepath, dest_gsbase,
30 subdir=subdir,
31 gs_acl='public-read')
32 if status != 0:
33 raise Exception('ERROR: GSUtilCopyFile error %d. "%s" -> "%s"' % (
34 status, abs_source_filepath, dest_gsbase))
35 return 0
36
37
38 def main(argv):
39 option_parser = optparse.OptionParser()
40 option_parser.add_option(
41 '', '--source_filepath',
42 help='full path of the file we wish to upload')
43 option_parser.add_option(
44 '', '--dest_gsbase',
45 help='gs:// bucket_name, the bucket to upload the file to')
46 option_parser.add_option(
47 '', '--subdir',
48 help='optional subdirectory within the bucket',
49 default=None)
50 (options, _args) = option_parser.parse_args()
51 return upload_to_bucket(source_filepath=options.source_filepath,
52 dest_gsbase=options.dest_gsbase,
53 subdir=options.subdir)
54
55
56 if '__main__' == __name__:
57 sys.exit(main(None))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698