jjb: system-tests: remove LTTng stable-2.9 tests
[lttng-ci.git] / lava / rootfs / vmdeboostrap / generate-root.py
CommitLineData
11d1fd9c 1#!/usr/bin/python3
888abe0b
JR
2# Copyright (C) 2018 - Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
888abe0b 17import argparse
888abe0b 18import gzip
1e206006 19import os
888abe0b 20import shutil
1e206006
JR
21import subprocess
22
23from datetime import datetime
888abe0b
JR
24
25
26def compress(filename):
27 with open(filename, 'rb') as f_in:
28 with gzip.open('{}.gz'.format(filename), 'wb') as f_out:
29 shutil.copyfileobj(f_in, f_out)
1e206006 30 os.remove(filename)
888abe0b
JR
31
32
33packages = [
34 'autoconf',
35 'automake',
36 'bash-completion',
37 'bison',
38 'bsdtar',
39 'build-essential',
40 'chrpath',
41 'clang',
42 'cloc',
43 'cppcheck',
44 'curl',
45 'elfutils',
46 'flex',
47 'gettext',
48 'git',
49 'htop',
50 'jq',
51 'libdw-dev',
52 'libelf-dev',
53 'libffi-dev',
54 'libglib2.0-dev',
55 'libmount-dev',
56 'libnuma-dev',
57 'libpfm4-dev',
58 'libpopt-dev',
59 'libtap-harness-archive-perl',
60 'libtool',
61 'libxml2',
62 'libxml2-dev',
3f1bcc40
JR
63 'netcat-traditional',
64 'openssh-server',
888abe0b
JR
65 'psmisc',
66 'python-virtualenv',
67 'python3',
888abe0b
JR
68 'python3-dev',
69 'python3-numpy',
70 'python3-pandas',
71 'python3-pip',
3f1bcc40 72 'python3-setuptools',
888abe0b
JR
73 'python3-sphinx',
74 'stress',
75 'swig',
76 'texinfo',
77 'tree',
78 'uuid-dev',
79 'vim',
80 'wget',
81]
82
83
84def main():
85 parser = argparse.ArgumentParser(description='Generate lava lttng rootfs')
86 parser.add_argument("--arch", default='amd64')
b34e93ae
JR
87 # We are using xenial instead of bionic ++ since some syscall test depends
88 # on cat and the libc to use the open syscall. In recent libc openat is
89 # used. See these commit in lttng-tools that helps with the problem:
90 # c8e51d1559c48a12f18053997bbcff0c162691c4
91 # 192bd8fb712659b9204549f29d9a54dc2c57a9e
92 # These are only part of 2.11 and were not backported since they do not
93 # represent a *problem* per se.
94 parser.add_argument("--distribution", default='xenial')
888abe0b
JR
95 parser.add_argument("--mirror", default='http://archive.ubuntu.com/ubuntu')
96 parser.add_argument(
97 "--component", default='universe,multiverse,main,restricted')
98 args = parser.parse_args()
99
100 name = "rootfs_{}_{}_{}.tar".format(args.arch, args.distribution,
101 datetime.now().strftime("%Y-%m-%d"))
102
103 hostname = "linaro-server"
104 user = "linaro/linaro"
105 root_password = "root"
106 print(name)
107 command = [
108 "sudo",
109 "vmdebootstrap",
110 "--arch={}".format(args.arch),
111 "--distribution={}".format(args.distribution),
112 "--mirror={}".format(args.mirror),
113 "--debootstrapopts=components={}".format(args.component),
114 "--tarball={}".format(name),
115 "--package={}".format(",".join(packages)),
116 "--hostname={}".format(hostname),
117 "--user={}".format(user),
118 "--root-password={}".format(root_password),
119 "--no-kernel",
888abe0b
JR
120 "--verbose",
121 ]
122
123 completed_command = subprocess.run(command, check=True)
124
125 compress(name)
126
127
128if __name__ == "__main__":
129 main()
This page took 0.073947 seconds and 4 git commands to generate.