blob: e528111956145c41ce27f4bce4c00a028029186c [file] [log] [blame]
Deepak Kodihallifeb88672017-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"
Patrick Venture0e3e53b2018-10-26 08:55:27 -07005PV = "1.0+git${SRCPV}"
Deepak Kodihallifeb88672017-05-17 06:42:51 -05006
7inherit autotools
8inherit obmc-phosphor-dbus-service
9inherit pythonnative
10inherit phosphor-settings-manager
11
12require phosphor-settings-manager.inc
13
14DBUS_SERVICE_${PN} = "xyz.openbmc_project.Settings.service"
15
16DEPENDS += "python-pyyaml-native"
17DEPENDS += "python-mako-native"
18DEPENDS += "autoconf-archive-native"
19DEPENDS += "virtual/phosphor-settings-defaults"
Brad Bishopb81d4282018-03-08 22:29:25 -050020DEPENDS += "${@df_enabled(d, 'obmc-mrw', 'phosphor-settings-read-settings-mrw-native')}"
Patrick Williams4b32c9a2020-03-31 16:43:15 -050021DEPENDS += "sdbusplus"
Deepak Kodihallifeb88672017-05-17 06:42:51 -050022DEPENDS += "phosphor-dbus-interfaces phosphor-dbus-interfaces-native"
Brad Bishopd55ffca2017-07-30 20:33:06 -040023DEPENDS += "phosphor-logging"
Brad Bishop17c08bf2018-10-18 17:07:53 -040024DEPENDS += "libcereal"
Deepak Kodihallifeb88672017-05-17 06:42:51 -050025
Deepak Kodihallifeb88672017-05-17 06:42:51 -050026S = "${WORKDIR}/git"
Deepak Kodihalli68136c32017-07-23 14:08:56 -050027SRC_URI += "file://merge_settings.py"
Deepak Kodihallifeb88672017-05-17 06:42:51 -050028
29EXTRA_OECONF = " \
30 SETTINGS_YAML=${STAGING_DIR_NATIVE}${settings_datadir}/defaults.yaml \
31 "
Deepak Kodihalli68136c32017-07-23 14:08:56 -050032
33# Collect files in SRC_URI that end in ".override.yml" and call a script that
34# writes their contents over that of settings.yaml, which is then updated to
35# the merged data values.
36# This doesn't correctly handle globs in ".override.yml" entries in SRC_URI.
37python do_merge_settings () {
38 import subprocess
39
40 # TODO: Perform the merge in a temporary directory?
41 workdir = d.getVar('WORKDIR', True)
42 nativedir = d.getVar('STAGING_DIR_NATIVE', True)
43 settingsdir = d.getVar('settings_datadir', True)
44 settingsdir = settingsdir[1:]
45 settingsdir = os.path.join(nativedir, settingsdir)
46 cmd = []
47 cmd.append(os.path.join(workdir, 'merge_settings.py'))
48 cmd.append(os.path.join(settingsdir, 'defaults.yaml'))
Gunnar Mills8c6516f2017-10-04 15:38:33 -050049 # Used for any settings from the MRW
Brad Bishopb81d4282018-03-08 22:29:25 -050050 use_mrw = df_enabled(d, 'obmc-mrw', 'true')
Gunnar Mills8c6516f2017-10-04 15:38:33 -050051 if (use_mrw == 'true'):
52 cmd.append(os.path.join(settingsdir, 'mrw-settings.override.yaml'))
Deepak Kodihalli68136c32017-07-23 14:08:56 -050053
54 fetch = bb.fetch2.Fetch([], d)
Kun Yicdc3b232017-10-09 23:17:08 -070055 override_urls = [url for url in fetch.urls if url.endswith('.override.yml')]
Deepak Kodihalli68136c32017-07-23 14:08:56 -050056 for url in override_urls:
57 bb.debug(2, 'Overriding with source: ' + url)
58 local_base = os.path.basename(fetch.localpath(url))
59 filename = os.path.join(workdir, local_base)
60 cmd.append(filename)
61
62 # Invoke the script and don't catch any resulting exception.
63 subprocess.check_call(cmd)
64}
65# python-pyyaml-native is installed by do_configure, so put this task after
66addtask merge_settings after do_configure before do_compile