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

Side by Side Diff: tools/create_debian_packages.py

Issue 350483003: Build Tools Cleanup (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: more fixes as reviewed by ricow Created 6 years, 5 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 | « tools/copy_dart.py ('k') | tools/create_editor.py » ('j') | 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/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.
11 11
12 import optparse 12 import optparse
13 import platform
14 import sys 13 import sys
15 import tarfile 14 import tarfile
16 import subprocess 15 import subprocess
17 import utils 16 import utils
18 import os
19 from os.path import join, exists, abspath 17 from os.path import join, exists, abspath
20 from shutil import copyfile 18 from shutil import copyfile
21 19
22 HOST_OS = utils.GuessOS() 20 HOST_OS = utils.GuessOS()
23 HOST_CPUS = utils.GuessCpus() 21 HOST_CPUS = utils.GuessCpus()
24 DART_DIR = abspath(join(__file__, '..', '..')) 22 DART_DIR = abspath(join(__file__, '..', '..'))
25 23
26 def BuildOptions(): 24 def BuildOptions():
27 result = optparse.OptionParser() 25 result = optparse.OptionParser()
28 result.add_option("--tar_filename", 26 result.add_option("--tar_filename",
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 58
61 with utils.TempDir() as temp_dir: 59 with utils.TempDir() as temp_dir:
62 origtarball = join(temp_dir, origtarname) 60 origtarball = join(temp_dir, origtarname)
63 copyfile(tarball, origtarball) 61 copyfile(tarball, origtarball)
64 62
65 with tarfile.open(origtarball) as tar: 63 with tarfile.open(origtarball) as tar:
66 tar.extractall(path=temp_dir) 64 tar.extractall(path=temp_dir)
67 65
68 # Build source package. 66 # Build source package.
69 print "Building source package" 67 print "Building source package"
70 RunBuildPackage(['-S', '-us', '-uc'], join(temp_dir, tarroot)); 68 RunBuildPackage(['-S', '-us', '-uc'], join(temp_dir, tarroot))
71 69
72 # Build 32-bit binary package. 70 # Build 32-bit binary package.
73 if ('ia32' in arch): 71 if 'ia32' in arch:
74 print "Building i386 package" 72 print "Building i386 package"
75 RunBuildPackage(['-B', '-ai386', '-us', '-uc'], join(temp_dir, tarroot)); 73 RunBuildPackage(['-B', '-ai386', '-us', '-uc'], join(temp_dir, tarroot))
76 74
77 # Build 64-bit binary package. 75 # Build 64-bit binary package.
78 if ('x64' in arch): 76 if 'x64' in arch:
79 print "Building amd64 package" 77 print "Building amd64 package"
80 RunBuildPackage(['-B', '-aamd64', '-us', '-uc'], join(temp_dir, tarroot)); 78 RunBuildPackage(['-B', '-aamd64', '-us', '-uc'], join(temp_dir, tarroot))
81 79
82 # Copy the Debian package files to the build directory. 80 # Copy the Debian package files to the build directory.
83 debbase = 'dart_%s' % version 81 debbase = 'dart_%s' % version
84 source_package = [ 82 source_package = [
85 '%s-1.dsc' % debbase, 83 '%s-1.dsc' % debbase,
86 '%s.orig.tar.gz' % debbase, 84 '%s.orig.tar.gz' % debbase,
87 '%s-1.debian.tar.gz' % debbase 85 '%s-1.debian.tar.gz' % debbase
88 ] 86 ]
89 i386_package = [ 87 i386_package = [
90 '%s-1_i386.deb' % debbase 88 '%s-1_i386.deb' % debbase
91 ] 89 ]
92 amd64_package = [ 90 amd64_package = [
93 '%s-1_amd64.deb' % debbase 91 '%s-1_amd64.deb' % debbase
94 ] 92 ]
95 93
96 for name in source_package: 94 for name in source_package:
97 copyfile(join(temp_dir, name), join(out_dir, name)) 95 copyfile(join(temp_dir, name), join(out_dir, name))
98 if ('ia32' in arch): 96 if 'ia32' in arch:
99 for name in i386_package: 97 for name in i386_package:
100 copyfile(join(temp_dir, name), join(out_dir, name)) 98 copyfile(join(temp_dir, name), join(out_dir, name))
101 if ('x64' in arch): 99 if 'x64' in arch:
102 for name in amd64_package: 100 for name in amd64_package:
103 copyfile(join(temp_dir, name), join(out_dir, name)) 101 copyfile(join(temp_dir, name), join(out_dir, name))
104 102
105 def Main(): 103 def Main():
106 if HOST_OS != 'linux': 104 if HOST_OS != 'linux':
107 print 'Debian build only supported on linux' 105 print 'Debian build only supported on linux'
108 return -1 106 return -1
109 107
110 options, args = BuildOptions().parse_args() 108 options, args = BuildOptions().parse_args()
111 out_dir = options.out_dir 109 out_dir = options.out_dir
112 tar_filename = options.tar_filename 110 tar_filename = options.tar_filename
113 if options.arch == 'all': 111 if options.arch == 'all':
114 options.arch = 'ia32,x64' 112 options.arch = 'ia32,x64'
115 arch = options.arch.split(',') 113 arch = options.arch.split(',')
116 114
117 if not options.out_dir: 115 if not options.out_dir:
118 out_dir = join(DART_DIR, utils.GetBuildDir(HOST_OS, HOST_OS)) 116 out_dir = join(DART_DIR, utils.GetBuildDir(HOST_OS))
119 117
120 if not tar_filename: 118 if not tar_filename:
121 tar_filename = join(DART_DIR, 119 tar_filename = join(DART_DIR,
122 utils.GetBuildDir(HOST_OS, HOST_OS), 120 utils.GetBuildDir(HOST_OS),
123 'dart-%s.tar.gz' % utils.GetVersion()) 121 'dart-%s.tar.gz' % utils.GetVersion())
124 122
125 BuildDebianPackage(tar_filename, out_dir, arch) 123 BuildDebianPackage(tar_filename, out_dir, arch)
126 124
127 if __name__ == '__main__': 125 if __name__ == '__main__':
128 sys.exit(Main()) 126 sys.exit(Main())
OLDNEW
« no previous file with comments | « tools/copy_dart.py ('k') | tools/create_editor.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698