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

Side by Side Diff: gsd_generate_index/gsd_generate_index.py

Issue 3331006: gsutil ls -l changed format.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/
Patch Set: Created 10 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2008-2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2008-2010 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Generate index.html files for a Google Storage for Developers directory. 6 """Generate index.html files for a Google Storage for Developers directory.
7 7
8 Google Storage for Developers provides only a raw set of objects. 8 Google Storage for Developers provides only a raw set of objects.
9 For some buckets we would like to be able to support browsing of the directory 9 For some buckets we would like to be able to support browsing of the directory
10 tree. This utility will generate the needed index and upload/update it. 10 tree. This utility will generate the needed index and upload/update it.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 elif sz < 1000000000: 43 elif sz < 1000000000:
44 sz = str(int(sz / 100000) / 10.0) + 'M' 44 sz = str(int(sz / 100000) / 10.0) + 'M'
45 else: 45 else:
46 sz = str(int(sz / 100000000) / 10.0) + 'G' 46 sz = str(int(sz / 100000000) / 10.0) + 'G'
47 return sz 47 return sz
48 48
49 49
50 def GetPathInfo(path, options): 50 def GetPathInfo(path, options):
51 """Collect size, date, md5 for a give gsd path.""" 51 """Collect size, date, md5 for a give gsd path."""
52 # Check current state. 52 # Check current state.
53 cmd = [options.gsutil, 'ls', '-l', path] 53 cmd = [options.gsutil, 'ls', '-L', path]
54 p = subprocess.Popen(cmd, stdout=subprocess.PIPE) 54 p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
55 p_stdout, _ = p.communicate() 55 p_stdout, _ = p.communicate()
56 assert p.returncode == 0 56 assert p.returncode == 0
57 # Extract intersting fields. 57 # Extract intersting fields.
58 fields = {} 58 fields = {}
59 fields['size'] = FixupSize(re.search('\tObject size:\t([0-9]+)\n', 59 fields['size'] = FixupSize(re.search('\tObject size:\t([0-9]+)\n',
60 p_stdout).group(1)) 60 p_stdout).group(1))
61 fields['md5'] = re.search('\tMD5:\t([^\n]+)\n', p_stdout).group(1) 61 fields['md5'] = re.search('\tMD5:\t([^\n]+)\n', p_stdout).group(1)
62 fields['date'] = re.search('\tLast mod:\t([^\n]+)\n', p_stdout).group(1) 62 fields['date'] = re.search('\tLast mod:\t([^\n]+)\n', p_stdout).group(1)
63 return fields 63 return fields
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 dest='gsutil', help='path to gsutil') 201 dest='gsutil', help='path to gsutil')
202 options, args = parser.parse_args(argv) 202 options, args = parser.parse_args(argv)
203 if len(args) != 2 or not args[1].startswith('gs://'): 203 if len(args) != 2 or not args[1].startswith('gs://'):
204 parser.print_help() 204 parser.print_help()
205 return 1 205 return 1
206 return GenerateIndexes(args[1], options) 206 return GenerateIndexes(args[1], options)
207 207
208 208
209 if __name__ == '__main__': 209 if __name__ == '__main__':
210 sys.exit(main(sys.argv)) 210 sys.exit(main(sys.argv))
OLDNEW
« 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