Flutter Engine
The Flutter Engine
Functions | Variables
create_debian_packages Namespace Reference

Functions

def BuildOptions ()
 
def RunBuildPackage (opt, cwd, toolchain=None)
 
def BuildDebianPackage (tarball, out_dir, arches, toolchain)
 
def Main ()
 

Variables

 HOST_OS = utils.GuessOS()
 
 HOST_CPUS = utils.GuessCpus()
 
 DART_DIR = abspath(join(dirname(__file__), '..', '..'))
 
dictionary GN_ARCH_TO_DEBIAN_ARCH
 

Function Documentation

◆ BuildDebianPackage()

def create_debian_packages.BuildDebianPackage (   tarball,
  out_dir,
  arches,
  toolchain 
)

Definition at line 65 of file create_debian_packages.py.

65def BuildDebianPackage(tarball, out_dir, arches, toolchain):
66 version = utils.GetVersion()
67 tarroot = 'dart-%s' % version
68 origtarname = 'dart_%s.orig.tar.gz' % version
69
70 if not exists(tarball):
71 print('Source tarball not found')
72 return -1
73
74 with utils.TempDir() as temp_dir:
75 origtarball = join(temp_dir, origtarname)
76 copyfile(tarball, origtarball)
77
78 with tarfile.open(origtarball) as tar:
79 tar.extractall(path=temp_dir)
80
81 # Build source package.
82 print("Building source package")
83 RunBuildPackage(['-S', '-us', '-uc'], join(temp_dir, tarroot))
84
85 # Build binary package(s).
86 for arch in arches:
87 print("Building %s package" % arch)
89 ['-B', '-a', GN_ARCH_TO_DEBIAN_ARCH[arch], '-us', '-uc'],
90 join(temp_dir, tarroot))
91
92 # Copy the Debian package files to the build directory.
93 debbase = 'dart_%s' % version
94 source_package = [
95 '%s-1.dsc' % debbase,
96 '%s.orig.tar.gz' % debbase,
97 '%s-1.debian.tar.xz' % debbase
98 ]
99 for name in source_package:
100 copyfile(join(temp_dir, name), join(out_dir, name))
101 for arch in arches:
102 name = '%s-1_%s.deb' % (debbase, GN_ARCH_TO_DEBIAN_ARCH[arch])
103 copyfile(join(temp_dir, name), join(out_dir, name))
104
105
def RunBuildPackage(opt, cwd, toolchain=None)
def BuildDebianPackage(tarball, out_dir, arches, toolchain)
def print(*args, **kwargs)
Definition: run_tests.py:49
def GetVersion(no_git_hash=False, version_file=None, git_revision_file=None)
Definition: utils.py:357
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

◆ BuildOptions()

def create_debian_packages.BuildOptions ( )

Definition at line 35 of file create_debian_packages.py.

35def BuildOptions():
36 result = optparse.OptionParser()
37 result.add_option("--tar_filename",
38 default=None,
39 help="The tar file to build from.")
40 result.add_option("--out_dir",
41 default=None,
42 help="Where to put the packages.")
43 result.add_option("-a",
44 "--arch",
45 help='Target architectures (comma-separated).',
46 metavar='[all,ia32,x64,arm,arm64,riscv64]',
47 default='x64')
48 result.add_option("-t",
49 "--toolchain",
50 help='Cross-compilation toolchain prefix',
51 default=None)
52
53 return result
54
55

◆ Main()

def create_debian_packages.Main ( )

Definition at line 106 of file create_debian_packages.py.

106def Main():
107 if HOST_OS != 'linux':
108 print('Debian build only supported on linux')
109 return -1
110
111 options, args = BuildOptions().parse_args()
112 out_dir = options.out_dir
113 tar_filename = options.tar_filename
114 if options.arch == 'all':
115 options.arch = 'ia32,x64,arm,arm64,riscv64'
116 arch = options.arch.split(',')
117
118 if not options.out_dir:
119 out_dir = join(DART_DIR, utils.GetBuildDir(HOST_OS))
120
121 if not tar_filename:
122 tar_filename = join(DART_DIR, utils.GetBuildDir(HOST_OS),
123 'dart-%s.tar.gz' % utils.GetVersion())
124
125 BuildDebianPackage(tar_filename, out_dir, arch, options.toolchain)
126
127
def GetBuildDir(host_os)
Definition: utils.py:99
static void parse_args(int argc, char *argv[], Args *args)
Definition: skqp_main.cpp:97

◆ RunBuildPackage()

def create_debian_packages.RunBuildPackage (   opt,
  cwd,
  toolchain = None 
)

Definition at line 56 of file create_debian_packages.py.

56def RunBuildPackage(opt, cwd, toolchain=None):
57 env = os.environ.copy()
58 if toolchain != None:
59 env["TOOLCHAIN"] = '--toolchain=' + toolchain
60 cmd = ['dpkg-buildpackage', '-j%d' % HOST_CPUS]
61 cmd.extend(opt)
62 process = subprocess.check_call(cmd, cwd=cwd, env=env)
63
64

Variable Documentation

◆ DART_DIR

create_debian_packages.DART_DIR = abspath(join(dirname(__file__), '..', '..'))

Definition at line 24 of file create_debian_packages.py.

◆ GN_ARCH_TO_DEBIAN_ARCH

dictionary create_debian_packages.GN_ARCH_TO_DEBIAN_ARCH
Initial value:
1= {
2 "ia32": "i386",
3 "x64": "amd64",
4 "arm": "armhf",
5 "arm64": "arm64",
6 "riscv64": "riscv64",
7}

Definition at line 26 of file create_debian_packages.py.

◆ HOST_CPUS

create_debian_packages.HOST_CPUS = utils.GuessCpus()

Definition at line 23 of file create_debian_packages.py.

◆ HOST_OS

create_debian_packages.HOST_OS = utils.GuessOS()

Definition at line 22 of file create_debian_packages.py.