Flutter Engine
The Flutter Engine
Functions | Variables
linux_distribution_support Namespace Reference

Functions

def InstallFromDep (builddir)
 
def UninstallDart ()
 
def CreateDartTestFile (tempdir)
 
def Run (command)
 
def TestInstallation (assume_installed=True)
 
def SrcSteps ()
 

Variables

 utils = bot_utils.GetUtils()
 
 HOST_OS = utils.GuessOS()
 

Function Documentation

◆ CreateDartTestFile()

def linux_distribution_support.CreateDartTestFile (   tempdir)

Definition at line 36 of file linux_distribution_support.py.

36def CreateDartTestFile(tempdir):
37 filename = os.path.join(tempdir, 'test.dart')
38 with open(filename, 'w') as f:
39 f.write('void main() {\n')
40 f.write(' print("Hello world");\n')
41 f.write('}')
42 return filename
43
44

◆ InstallFromDep()

def linux_distribution_support.InstallFromDep (   builddir)

Definition at line 25 of file linux_distribution_support.py.

25def InstallFromDep(builddir):
26 for entry in os.listdir(builddir):
27 if entry.endswith("_amd64.deb"):
28 path = os.path.join(builddir, entry)
29 Run(['dpkg', '-i', path])
30
31

◆ Run()

def linux_distribution_support.Run (   command)

Definition at line 45 of file linux_distribution_support.py.

45def Run(command):
46 print("Running: %s" % ' '.join(command))
47 sys.stdout.flush()
48 no_color_env = dict(os.environ)
49 no_color_env['TERM'] = 'nocolor'
50 subprocess.check_call(command, env=no_color_env)
51
52
def print(*args, **kwargs)
Definition: run_tests.py:49
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

◆ SrcSteps()

def linux_distribution_support.SrcSteps ( )

Definition at line 66 of file linux_distribution_support.py.

66def SrcSteps():
67 version = utils.GetVersion()
68 builddir = os.path.join(bot_utils.DART_DIR, utils.GetBuildDir(HOST_OS),
69 'src_and_installation')
70
71 if not os.path.exists(builddir):
72 os.makedirs(builddir)
73 tarfilename = 'dart-%s.tar.gz' % version
74 tarfile = os.path.join(builddir, tarfilename)
75
76 print('Validating that we are on debian bullseye')
77 args = ['cat', '/etc/os-release']
78 (stdout, stderr, exitcode) = bot_utils.run(args)
79 if exitcode != 0:
80 print("Could not find linux system, exiting")
81 sys.exit(1)
82 if not "bullseye" in stdout:
83 print("Trying to build Debian bits but not on Debian Bullseye")
84 print("You can't fix this, please contact dart-engprod@")
85 sys.exit(1)
86
87 print('Building src tarball')
88 Run([
89 sys.executable, 'tools/linux_dist_support/create_tarball.py',
90 '--tar_filename', tarfile
91 ])
92
93 print('Building Debian packages')
94 Run([
95 sys.executable, 'tools/linux_dist_support/create_debian_packages.py',
96 '--tar_filename', tarfile, '--out_dir', builddir
97 ])
98
99 if os.path.exists('/usr/bin/dart') or os.path.exists(
100 '/usr/lib/dart/bin/dart'):
101 print("Dart already installed, removing")
103 TestInstallation(assume_installed=False)
104
105 InstallFromDep(builddir)
106 TestInstallation(assume_installed=True)
107
108 # We build the runtime target to get everything we need to test the
109 # standalone target.
110 Run([
111 sys.executable, 'tools/build.py', '--mode=release', '--arch=x64',
112 'runtime'
113 ])
114 # Copy in the installed binary to avoid polluting /usr/bin (and having to
115 # run as root)
116 Run(['cp', '/usr/bin/dart', 'out/ReleaseX64/dart'])
117
118 # Check dart, dart compile js, and dart analyze against a hello world program
119 with utils.TempDir() as temp_dir:
120 test_file = CreateDartTestFile(temp_dir)
121 Run(['/usr/lib/dart/bin/dart', 'compile', 'js', test_file])
122 Run(['/usr/lib/dart/bin/dart', 'analyze', test_file])
123 Run(['/usr/lib/dart/bin/dart', test_file])
124
126 TestInstallation(assume_installed=False)
127
128
def TestInstallation(assume_installed=True)
def GetBuildDir(host_os)
Definition: utils.py:99
def GetVersion(no_git_hash=False, version_file=None, git_revision_file=None)
Definition: utils.py:357

◆ TestInstallation()

def linux_distribution_support.TestInstallation (   assume_installed = True)

Definition at line 53 of file linux_distribution_support.py.

53def TestInstallation(assume_installed=True):
54 paths = ['/usr/bin/dart', '/usr/lib/dart/bin/dart']
55 for path in paths:
56 if os.path.exists(path):
57 if not assume_installed:
58 print('Assumed not installed, found %s' % path)
59 sys.exit(1)
60 else:
61 if assume_installed:
62 print('Assumed installed, but could not find %s' % path)
63 sys.exit(1)
64
65

◆ UninstallDart()

def linux_distribution_support.UninstallDart ( )

Definition at line 32 of file linux_distribution_support.py.

32def UninstallDart():
33 Run(['dpkg', '-r', 'dart'])
34
35

Variable Documentation

◆ HOST_OS

linux_distribution_support.HOST_OS = utils.GuessOS()

Definition at line 22 of file linux_distribution_support.py.

◆ utils

linux_distribution_support.utils = bot_utils.GetUtils()

Definition at line 20 of file linux_distribution_support.py.