OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 """ | 6 """ |
7 This tool creates a tarball with all the sources, but without .svn directories. | 7 This tool creates a tarball with all the sources, but without .svn directories. |
8 | 8 |
9 It can also remove files which are not strictly required for build, so that | 9 It can also remove files which are not strictly required for build, so that |
10 the resulting tarball can be reasonably small (last time it was ~110 MB). | 10 the resulting tarball can be reasonably small (last time it was ~110 MB). |
11 | 11 |
12 Example usage: | 12 Example usage: |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 if len(args) != 1: | 95 if len(args) != 1: |
96 print 'You must provide only one argument: output file name' | 96 print 'You must provide only one argument: output file name' |
97 print '(without .tar.bz2 extension).' | 97 print '(without .tar.bz2 extension).' |
98 return 1 | 98 return 1 |
99 | 99 |
100 if not os.path.exists(GetSourceDirectory()): | 100 if not os.path.exists(GetSourceDirectory()): |
101 print 'Cannot find the src directory.' | 101 print 'Cannot find the src directory.' |
102 return 1 | 102 return 1 |
103 | 103 |
| 104 # This command is from src/DEPS; please keep them in sync. |
| 105 if subprocess.call(['python', 'build/util/lastchange.py', '-o', |
| 106 'build/util/LASTCHANGE'], cwd=GetSourceDirectory()) != 0: |
| 107 print 'Could not run build/util/lastchange.py to update LASTCHANGE.' |
| 108 return 1 |
| 109 |
104 output_fullname = args[0] + '.tar.bz2' | 110 output_fullname = args[0] + '.tar.bz2' |
105 output_basename = os.path.basename(args[0]) | 111 output_basename = os.path.basename(args[0]) |
106 | 112 |
107 archive = MyTarFile.open(output_fullname, 'w:bz2') | 113 archive = MyTarFile.open(output_fullname, 'w:bz2') |
108 archive.set_remove_nonessential_files(options.remove_nonessential_files) | 114 archive.set_remove_nonessential_files(options.remove_nonessential_files) |
109 try: | 115 try: |
110 archive.add(GetSourceDirectory(), arcname=output_basename) | 116 archive.add(GetSourceDirectory(), arcname=output_basename) |
111 finally: | 117 finally: |
112 archive.close() | 118 archive.close() |
113 | 119 |
114 return 0 | 120 return 0 |
115 | 121 |
116 | 122 |
117 if __name__ == "__main__": | 123 if __name__ == "__main__": |
118 sys.exit(main(sys.argv[1:])) | 124 sys.exit(main(sys.argv[1:])) |
OLD | NEW |