| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 3 # Copyright (c) 2015, the Dartino 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 Dartino tarball. | 8 # Script to build a Debian packages from a Dartino tarball. |
| 9 # | 9 # |
| 10 # Right now this script only supports building the installation for a ARM Linux | 10 # Right now this script only supports building the installation for a ARM Linux |
| 11 # target running the Dartino agent | 11 # target running the Dartino agent |
| 12 # | 12 # |
| 13 # The script will build a source package and a ARM binary packages. | 13 # The script will build a source package and a ARM binary packages. |
| 14 | 14 |
| 15 import optparse | 15 import optparse |
| 16 import os | 16 import os |
| 17 import sys | 17 import sys |
| 18 import tarfile | 18 import tarfile |
| 19 import subprocess | 19 import subprocess |
| 20 import utils | 20 import utils |
| 21 from os.path import join, exists, abspath | 21 from os.path import join, exists, abspath |
| 22 from shutil import copyfile | 22 from shutil import copyfile |
| 23 | 23 |
| 24 HOST_OS = utils.GuessOS() | 24 HOST_OS = utils.GuessOS() |
| 25 HOST_CPUS = utils.GuessCpus() | 25 HOST_CPUS = utils.GuessCpus() |
| 26 FLETCH_DIR = abspath(join(__file__, '..', '..')) | 26 DARTINO_DIR = abspath(join(__file__, '..', '..')) |
| 27 | 27 |
| 28 def BuildOptions(): | 28 def BuildOptions(): |
| 29 result = optparse.OptionParser() | 29 result = optparse.OptionParser() |
| 30 result.add_option("--tar_filename", | 30 result.add_option("--tar_filename", |
| 31 default=None, | 31 default=None, |
| 32 help="The tar file to build from.") | 32 help="The tar file to build from.") |
| 33 result.add_option("--out_dir", | 33 result.add_option("--out_dir", |
| 34 default=None, | 34 default=None, |
| 35 help="Where to put the packages.") | 35 help="Where to put the packages.") |
| 36 result.add_option("-a", "--arch", | 36 result.add_option("-a", "--arch", |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 return -1 | 108 return -1 |
| 109 | 109 |
| 110 options, args = BuildOptions().parse_args() | 110 options, args = BuildOptions().parse_args() |
| 111 out_dir = options.out_dir | 111 out_dir = options.out_dir |
| 112 tar_filename = options.tar_filename | 112 tar_filename = options.tar_filename |
| 113 if options.arch == 'all': | 113 if options.arch == 'all': |
| 114 options.arch = 'armhf' | 114 options.arch = 'armhf' |
| 115 arch = options.arch.split(',') | 115 arch = options.arch.split(',') |
| 116 | 116 |
| 117 if not options.out_dir: | 117 if not options.out_dir: |
| 118 out_dir = join(FLETCH_DIR, 'out') | 118 out_dir = join(DARTINO_DIR, 'out') |
| 119 | 119 |
| 120 if not tar_filename: | 120 if not tar_filename: |
| 121 tar_filename = join(FLETCH_DIR, | 121 tar_filename = join(DARTINO_DIR, |
| 122 utils.GetBuildDir(HOST_OS), | 122 utils.GetBuildDir(HOST_OS), |
| 123 'dartino-%s.tar.gz' % utils.GetVersion()) | 123 'dartino-%s.tar.gz' % utils.GetVersion()) |
| 124 | 124 |
| 125 BuildDebianPackage(tar_filename, out_dir, arch, options.toolchain) | 125 BuildDebianPackage(tar_filename, out_dir, arch, options.toolchain) |
| 126 | 126 |
| 127 if __name__ == '__main__': | 127 if __name__ == '__main__': |
| 128 sys.exit(Main()) | 128 sys.exit(Main()) |
| OLD | NEW |