blob: 4397e2dc71aa320eeed45225cd05ea5a81dcd40f [file] [log] [blame]
Deepak Kodihalli3e3c88c2017-05-17 06:42:51 -05001SUMMARY = "Phosphor Settings Manager"
2DESCRIPTION = "Phosphor Settings Manager is an application that creates \
3d-bus objects to represent various user settings."
4PR = "r1"
5
6inherit autotools
7inherit obmc-phosphor-dbus-service
8inherit pythonnative
9inherit phosphor-settings-manager
10
11require phosphor-settings-manager.inc
12
13DBUS_SERVICE_${PN} = "xyz.openbmc_project.Settings.service"
14
15DEPENDS += "python-pyyaml-native"
16DEPENDS += "python-mako-native"
17DEPENDS += "autoconf-archive-native"
18DEPENDS += "virtual/phosphor-settings-defaults"
Brad Bishop7a17b6b2018-03-08 22:29:25 -050019DEPENDS += "${@df_enabled(d, 'obmc-mrw', 'phosphor-settings-read-settings-mrw-native')}"
Deepak Kodihalli3e3c88c2017-05-17 06:42:51 -050020DEPENDS += "sdbusplus sdbusplus-native"
21DEPENDS += "phosphor-dbus-interfaces phosphor-dbus-interfaces-native"
Brad Bishopfb3c8602017-07-30 20:33:06 -040022DEPENDS += "phosphor-logging"
Brad Bishopcc51cd92018-10-18 17:07:53 -040023DEPENDS += "libcereal"
Deepak Kodihalli3e3c88c2017-05-17 06:42:51 -050024
25RDEPENDS_${PN} += "sdbusplus phosphor-dbus-interfaces"
26
27S = "${WORKDIR}/git"
Deepak Kodihalli51b3d162017-07-23 14:08:56 -050028SRC_URI += "file://merge_settings.py"
Deepak Kodihalli3e3c88c2017-05-17 06:42:51 -050029
30EXTRA_OECONF = " \
31 SETTINGS_YAML=${STAGING_DIR_NATIVE}${settings_datadir}/defaults.yaml \
32 "
Deepak Kodihalli51b3d162017-07-23 14:08:56 -050033
34# Collect files in SRC_URI that end in ".override.yml" and call a script that
35# writes their contents over that of settings.yaml, which is then updated to
36# the merged data values.
37# This doesn't correctly handle globs in ".override.yml" entries in SRC_URI.
38python do_merge_settings () {
39 import subprocess
40
41 # TODO: Perform the merge in a temporary directory?
42 workdir = d.getVar('WORKDIR', True)
43 nativedir = d.getVar('STAGING_DIR_NATIVE', True)
44 settingsdir = d.getVar('settings_datadir', True)
45 settingsdir = settingsdir[1:]
46 settingsdir = os.path.join(nativedir, settingsdir)
47 cmd = []
48 cmd.append(os.path.join(workdir, 'merge_settings.py'))
49 cmd.append(os.path.join(settingsdir, 'defaults.yaml'))
Gunnar Mills12d2da22017-10-04 15:38:33 -050050 # Used for any settings from the MRW
Brad Bishop7a17b6b2018-03-08 22:29:25 -050051 use_mrw = df_enabled(d, 'obmc-mrw', 'true')
Gunnar Mills12d2da22017-10-04 15:38:33 -050052 if (use_mrw == 'true'):
53 cmd.append(os.path.join(settingsdir, 'mrw-settings.override.yaml'))
Deepak Kodihalli51b3d162017-07-23 14:08:56 -050054
55 fetch = bb.fetch2.Fetch([], d)
Kun Yie6bd58c2017-10-09 23:17:08 -070056 override_urls = [url for url in fetch.urls if url.endswith('.override.yml')]
Deepak Kodihalli51b3d162017-07-23 14:08:56 -050057 for url in override_urls:
58 bb.debug(2, 'Overriding with source: ' + url)
59 local_base = os.path.basename(fetch.localpath(url))
60 filename = os.path.join(workdir, local_base)
61 cmd.append(filename)
62
63 # Invoke the script and don't catch any resulting exception.
64 subprocess.check_call(cmd)
65}
66# python-pyyaml-native is installed by do_configure, so put this task after
67addtask merge_settings after do_configure before do_compile