forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoverrideconfig.py
More file actions
42 lines (29 loc) · 932 Bytes
/
overrideconfig.py
File metadata and controls
42 lines (29 loc) · 932 Bytes
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
#!/usr/bin/env python
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright (c) 2019, Intel Corporation. All rights reserved.
#
# Author: Janusz Jankowski <janusz.jankowski@linux.intel.com>
# Loads current config file and updates with values from another
# config file. Configs that are not set in neither of files are set
# to default value.
#
# Usage:
# overrideconfig.py KCONFIG_FILENAME CONFIG_OVERRIDE_FILE
import os
import sys
import kconfiglib
def main():
if len(sys.argv) < 3:
sys.exit("usage: {} KCONFIG_FILENAME CONFIG_OVERRIDE_FILE"
.format(sys.argv[0]))
kconf = kconfiglib.Kconfig(sys.argv[1])
kconf.load_config()
kconf.disable_override_warnings()
kconf.disable_redun_warnings()
kconf.load_config(filename=sys.argv[2], replace=False)
kconf.enable_override_warnings()
kconf.enable_redun_warnings()
kconf.write_config()
if __name__ == "__main__":
main()