| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2014, 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 | 7 |
| 8 # Script to build a Debian packages from a Dart tarball. The script | 8 # Script to build a Debian packages from a Dart tarball. The script |
| 9 # will build a source package and a 32-bit (i386) and 64-bit (amd64) | 9 # will build a source package and a 32-bit (i386) and 64-bit (amd64) |
| 10 # binary packages. | 10 # binary packages. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 origtarball = join(temp_dir, origtarname) | 58 origtarball = join(temp_dir, origtarname) |
| 59 copyfile(tarball, origtarball) | 59 copyfile(tarball, origtarball) |
| 60 | 60 |
| 61 with tarfile.open(origtarball) as tar: | 61 with tarfile.open(origtarball) as tar: |
| 62 tar.extractall(path=temp_dir) | 62 tar.extractall(path=temp_dir) |
| 63 | 63 |
| 64 # Build source package. | 64 # Build source package. |
| 65 print "Building source package" | 65 print "Building source package" |
| 66 RunBuildPackage(['-S', '-us', '-uc'], join(temp_dir, tarroot)); | 66 RunBuildPackage(['-S', '-us', '-uc'], join(temp_dir, tarroot)); |
| 67 | 67 |
| 68 # Build 32-bit binary package. | |
| 69 print "Building i386 package" | |
| 70 RunBuildPackage(['-B', '-ai386', '-us', '-uc'], join(temp_dir, tarroot)); | |
| 71 | |
| 72 # Build 64-bit binary package. | 68 # Build 64-bit binary package. |
| 73 print "Building amd64 package" | 69 print "Building amd64 package" |
| 74 RunBuildPackage(['-B', '-aamd64', '-us', '-uc'], join(temp_dir, tarroot)); | 70 RunBuildPackage(['-B', '-aamd64', '-us', '-uc'], join(temp_dir, tarroot)); |
| 75 | 71 |
| 76 # Copy the Debian package files to the build directory. | 72 # Copy the Debian package files to the build directory. |
| 77 debbase = 'dart_%s' % version | 73 debbase = 'dart_%s' % version |
| 78 source_package = [ | 74 source_package = [ |
| 79 '%s-1.dsc' % debbase, | 75 '%s-1.dsc' % debbase, |
| 80 '%s.orig.tar.gz' % debbase, | 76 '%s.orig.tar.gz' % debbase, |
| 81 '%s-1.debian.tar.gz' % debbase | 77 '%s-1.debian.tar.gz' % debbase |
| 82 ] | 78 ] |
| 83 i386_package = [ | |
| 84 '%s-1_i386.deb' % debbase | |
| 85 ] | |
| 86 amd64_package = [ | 79 amd64_package = [ |
| 87 '%s-1_amd64.deb' % debbase | 80 '%s-1_amd64.deb' % debbase |
| 88 ] | 81 ] |
| 89 | 82 |
| 90 for name in source_package: | 83 for name in source_package: |
| 91 copyfile(join(temp_dir, name), join(out_dir, name)) | 84 copyfile(join(temp_dir, name), join(out_dir, name)) |
| 92 for name in i386_package: | |
| 93 copyfile(join(temp_dir, name), join(out_dir, name)) | |
| 94 for name in amd64_package: | 85 for name in amd64_package: |
| 95 copyfile(join(temp_dir, name), join(out_dir, name)) | 86 copyfile(join(temp_dir, name), join(out_dir, name)) |
| 96 | 87 |
| 97 def Main(): | 88 def Main(): |
| 98 if HOST_OS != 'linux': | 89 if HOST_OS != 'linux': |
| 99 print 'Debian build only supported on linux' | 90 print 'Debian build only supported on linux' |
| 100 return -1 | 91 return -1 |
| 101 | 92 |
| 102 options, args = BuildOptions().parse_args() | 93 options, args = BuildOptions().parse_args() |
| 103 out_dir = options.out_dir | 94 out_dir = options.out_dir |
| 104 tar_filename = options.tar_filename | 95 tar_filename = options.tar_filename |
| 105 if not options.out_dir: | 96 if not options.out_dir: |
| 106 out_dir = join(DART_DIR, utils.GetBuildDir(HOST_OS, HOST_OS)) | 97 out_dir = join(DART_DIR, utils.GetBuildDir(HOST_OS, HOST_OS)) |
| 107 | 98 |
| 108 if not tar_filename: | 99 if not tar_filename: |
| 109 tar_filename = join(DART_DIR, | 100 tar_filename = join(DART_DIR, |
| 110 utils.GetBuildDir(HOST_OS, HOST_OS), | 101 utils.GetBuildDir(HOST_OS, HOST_OS), |
| 111 'dart-%s.tar.gz' % utils.GetVersion()) | 102 'dart-%s.tar.gz' % utils.GetVersion()) |
| 112 | 103 |
| 113 BuildDebianPackage(tar_filename, out_dir) | 104 BuildDebianPackage(tar_filename, out_dir) |
| 114 | 105 |
| 115 if __name__ == '__main__': | 106 if __name__ == '__main__': |
| 116 sys.exit(Main()) | 107 sys.exit(Main()) |
| OLD | NEW |