forked from kernelci/kernelci-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkci_rootfs
More file actions
executable file
·66 lines (54 loc) · 2.41 KB
/
kci_rootfs
File metadata and controls
executable file
·66 lines (54 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python3
#
# Copyright (C) 2019 Collabora Limited
# Author: Michal Galka <michal.galka@collabora.com>
#
# This module is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import sys
from kernelci.cli import Args, Command, parse_args
import kernelci.config.rootfs
# -----------------------------------------------------------------------------
# Commands
#
class cmd_validate(Command):
help = "Validate the rootfs YAML configuration"
def __call__(self, config_data, *args, **kwargs):
rootfs_configs = config_data['rootfs_configs']
for config_name, config in rootfs_configs.items():
print(config_name)
print('\trootfs_type: {}'.format(config.rootfs_type))
print('\tarch_list: {}'.format(config.arch_list))
print('\tdebian_release: {}'.format(config.debian_release))
print('\textra_packages: {}'.format(config.extra_packages))
print('\textra_packages_remove: {}'
.format(config.extra_packages_remove))
print('\textra_files_remove: {}'.format(config.extra_files_remove))
print('\tscript: {}'.format(config.script))
return True
class cmd_list_configs(Command):
help = "Lists all rootfs config names"
def __call__(self, config_data, *args, **kwargs):
rootfs_configs = config_data['rootfs_configs']
for config_name in rootfs_configs:
print(config_name)
return True
# -----------------------------------------------------------------------------
# Main
#
if __name__ == '__main__':
args = parse_args("kci_rootfs", "rootfs-configs.yaml", globals())
configs = kernelci.config.rootfs.from_yaml(args.yaml_configs)
status = args.func(configs, args)
sys.exit(0 if status is True else 1)