| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 import glob | 7 import glob |
| 8 import optparse | 8 import optparse |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 # dartium-win-full-9420.9420.zip | 640 # dartium-win-full-9420.9420.zip |
| 641 # exclude dartium-lucid64-full-trunk-9571.9571.zip | 641 # exclude dartium-lucid64-full-trunk-9571.9571.zip |
| 642 dartiumFiles = gsu.ReadBucket( | 642 dartiumFiles = gsu.ReadBucket( |
| 643 'gs://dartium-archive/latest/dartium-*-full-[0-9]*.zip') | 643 'gs://dartium-archive/latest/dartium-*-full-[0-9]*.zip') |
| 644 | 644 |
| 645 if not dartiumFiles: | 645 if not dartiumFiles: |
| 646 raise Exception("could not find any dartium files") | 646 raise Exception("could not find any dartium files") |
| 647 | 647 |
| 648 tempList = [] | 648 tempList = [] |
| 649 | 649 |
| 650 dartiumFiles = RemoveDuplicateDartiums(dartiumFiles) |
| 651 |
| 650 for dartiumFile in dartiumFiles: | 652 for dartiumFile in dartiumFiles: |
| 651 print ' found dartium: %s' % dartiumFile | 653 print ' found dartium: %s' % dartiumFile |
| 652 tempList.append(RemapDartiumUrl(dartiumFile)) | 654 tempList.append(RemapDartiumUrl(dartiumFile)) |
| 653 | 655 |
| 654 dartiumFiles = tempList | 656 dartiumFiles = tempList |
| 655 | 657 |
| 656 for rcpZipFile in rcpZipFiles: | 658 for rcpZipFile in rcpZipFiles: |
| 657 searchString = None | 659 searchString = None |
| 658 | 660 |
| 659 # dart-editor-linux.gtk.x86.zip | 661 # dart-editor-linux.gtk.x86.zip |
| (...skipping 29 matching lines...) Expand all Loading... |
| 689 else: | 691 else: |
| 690 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos) | 692 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos) |
| 691 | 693 |
| 692 add_path = None | 694 add_path = None |
| 693 | 695 |
| 694 if 'lin' in buildos: | 696 if 'lin' in buildos: |
| 695 paths = glob.glob(os.path.join(unzip_dir, 'dartium-*')) | 697 paths = glob.glob(os.path.join(unzip_dir, 'dartium-*')) |
| 696 add_path = paths[0] | 698 add_path = paths[0] |
| 697 zip_rel_path = 'dart/chromium' | 699 zip_rel_path = 'dart/chromium' |
| 698 # remove extra files | 700 # remove extra files |
| 699 FileDelete(os.path.join(add_path, 'chrome.packed.7z')) | 701 FileDelete(os.path.join(add_path, 'DumpRenderTree')) |
| 702 FileDelete(os.path.join(add_path, 'DumpRenderTree.pak')) |
| 700 if 'win' in buildos: | 703 if 'win' in buildos: |
| 701 paths = glob.glob(os.path.join(unzip_dir, 'dartium-*')) | 704 paths = glob.glob(os.path.join(unzip_dir, 'dartium-*')) |
| 702 add_path = paths[0] | 705 add_path = paths[0] |
| 703 zip_rel_path = 'dart/chromium' | 706 zip_rel_path = 'dart/chromium' |
| 704 # remove extra files | 707 # remove extra files |
| 705 FileDelete(os.path.join(add_path, 'DumpRenderTree.exe')) | 708 FileDelete(os.path.join(add_path, 'DumpRenderTree.exe')) |
| 706 FileDelete(os.path.join(add_path, 'mini_installer.exe')) | 709 FileDelete(os.path.join(add_path, 'mini_installer.exe')) |
| 707 FileDelete(os.path.join(add_path, 'sync_unit_tests.exe')) | 710 FileDelete(os.path.join(add_path, 'sync_unit_tests.exe')) |
| 708 if 'mac' in buildos: | 711 if 'mac' in buildos: |
| 709 paths = glob.glob(os.path.join(unzip_dir, 'dartium-*')) | 712 paths = glob.glob(os.path.join(unzip_dir, 'dartium-*')) |
| 710 add_path = os.path.join(paths[0], 'Chromium.app') | 713 add_path = os.path.join(paths[0], 'Chromium.app') |
| 711 zip_rel_path = 'dart/Chromium.app' | 714 zip_rel_path = 'dart/Chromium.app' |
| 712 | 715 |
| 713 #add to the rcp zip | 716 #add to the rcp zip |
| 714 dart_zip_path = os.path.join(buildout, rcpZipFile) | 717 dart_zip_path = os.path.join(buildout, rcpZipFile) |
| 715 dart_zip = ziputils.ZipUtil(dart_zip_path, buildos) | 718 dart_zip = ziputils.ZipUtil(dart_zip_path, buildos) |
| 716 dart_zip.AddDirectoryTree(add_path, zip_rel_path) | 719 dart_zip.AddDirectoryTree(add_path, zip_rel_path) |
| 717 | 720 |
| 718 shutil.rmtree(tmp_dir, True) | 721 shutil.rmtree(tmp_dir, True) |
| 719 | 722 |
| 723 def RemoveDuplicateDartiums(dartiumFiles): |
| 724 result = [] |
| 725 found = [] |
| 726 |
| 727 dartiumFiles.sort(reverse=True) |
| 728 |
| 729 # dartium-lucid64-full-9420.9420.zip |
| 730 for f in dartiumFiles: |
| 731 index = f.find('-full-') |
| 732 prefix = f[:index] |
| 733 if not prefix in found: |
| 734 found.append(prefix) |
| 735 result.append(f) |
| 736 |
| 737 return result |
| 738 |
| 720 | 739 |
| 721 # convert: | 740 # convert: |
| 722 # gs://dartium-archive/latest/dartium-lucid32-full-9420.9420.zip | 741 # gs://dartium-archive/latest/dartium-lucid32-full-9420.9420.zip |
| 723 # to: | 742 # to: |
| 724 # gs://dartium-archive/dartium-lucid32-full/dartium-lucid32-full-9420.9420.zip
| 743 # gs://dartium-archive/dartium-lucid32-full/dartium-lucid32-full-9420.9420.zip
|
| 725 def RemapDartiumUrl(url): | 744 def RemapDartiumUrl(url): |
| 726 name = os.path.basename(url) | 745 name = os.path.basename(url) |
| 727 | 746 |
| 728 reResult = re.search('(\S*-\S*-full)-.*', name) | 747 reResult = re.search('(\S*-\S*-full)-.*', name) |
| 729 | 748 |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 # create file in dartlang-api-docs/REVISION/index.html | 1046 # create file in dartlang-api-docs/REVISION/index.html |
| 1028 # this lets us do the recursive copy in the next step | 1047 # this lets us do the recursive copy in the next step |
| 1029 | 1048 |
| 1030 localIndexFile = join(dirName, 'index.html') | 1049 localIndexFile = join(dirName, 'index.html') |
| 1031 destIndexFile = GSU_API_DOCS_PATH + '/index.html' | 1050 destIndexFile = GSU_API_DOCS_PATH + '/index.html' |
| 1032 | 1051 |
| 1033 Gsutil(['cp', '-a', 'public-read', localIndexFile, destIndexFile]) | 1052 Gsutil(['cp', '-a', 'public-read', localIndexFile, destIndexFile]) |
| 1034 | 1053 |
| 1035 # copy -R api_docs into dartlang-api-docs/REVISION | 1054 # copy -R api_docs into dartlang-api-docs/REVISION |
| 1036 filesToUpload = glob.glob(join(dirName, '*')) | 1055 filesToUpload = glob.glob(join(dirName, '*')) |
| 1037 result = Gsutil(['-m', 'cp', '-a', 'public-read', '-r'] + filesToUpload + | 1056 result = Gsutil(['-m', 'cp', '-q', '-a', 'public-read', '-r'] + |
| 1038 [GSU_API_DOCS_PATH]) | 1057 filesToUpload + [GSU_API_DOCS_PATH]) |
| 1039 | 1058 |
| 1040 if result == 0: | 1059 if result == 0: |
| 1041 destLatestRevFile = GSU_API_DOCS_BUCKET + '/latest.txt' | 1060 destLatestRevFile = GSU_API_DOCS_BUCKET + '/latest.txt' |
| 1042 localLatestRevFilename = join(dirName, 'latest.txt') | 1061 localLatestRevFilename = join(dirName, 'latest.txt') |
| 1043 with open(localLatestRevFilename, 'w+') as f: | 1062 with open(localLatestRevFilename, 'w+') as f: |
| 1044 f.write(REVISION) | 1063 f.write(REVISION) |
| 1045 | 1064 |
| 1046 # overwrite dartlang-api-docs/latest.txt to contain REVISION | 1065 # overwrite dartlang-api-docs/latest.txt to contain REVISION |
| 1047 Gsutil(['cp', '-a', 'public-read', localLatestRevFilename, | 1066 Gsutil(['cp', '-a', 'public-read', localLatestRevFilename, |
| 1048 destLatestRevFile]) | 1067 destLatestRevFile]) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 """delete the given file - do not re-throw any exceptions that occur""" | 1105 """delete the given file - do not re-throw any exceptions that occur""" |
| 1087 if os.path.exists(f): | 1106 if os.path.exists(f): |
| 1088 try: | 1107 try: |
| 1089 os.remove(f) | 1108 os.remove(f) |
| 1090 except: | 1109 except: |
| 1091 print 'error deleting %s' % f | 1110 print 'error deleting %s' % f |
| 1092 | 1111 |
| 1093 | 1112 |
| 1094 if __name__ == '__main__': | 1113 if __name__ == '__main__': |
| 1095 sys.exit(main()) | 1114 sys.exit(main()) |
| OLD | NEW |