blob: 10938c9e60f233c2185e6f669f42897bd2ab3793 [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"
19DEPENDS += "sdbusplus sdbusplus-native"
20DEPENDS += "phosphor-dbus-interfaces phosphor-dbus-interfaces-native"
Brad Bishopfb3c8602017-07-30 20:33:06 -040021DEPENDS += "phosphor-logging"
Deepak Kodihalli36006e72017-06-24 12:56:18 -050022DEPENDS += "cereal"
Deepak Kodihalli3e3c88c2017-05-17 06:42:51 -050023
24RDEPENDS_${PN} += "sdbusplus phosphor-dbus-interfaces"
25
26S = "${WORKDIR}/git"
Deepak Kodihalli51b3d162017-07-23 14:08:56 -050027SRC_URI += "file://merge_settings.py"
Deepak Kodihalli3e3c88c2017-05-17 06:42:51 -050028
29EXTRA_OECONF = " \
30 SETTINGS_YAML=${STAGING_DIR_NATIVE}${settings_datadir}/defaults.yaml \
31 "
Deepak Kodihalli51b3d162017-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'))
49
50 fetch = bb.fetch2.Fetch([], d)
Kun Yie6bd58c2017-10-09 23:17:08 -070051 override_urls = [url for url in fetch.urls if url.endswith('.override.yml')]
Deepak Kodihalli51b3d162017-07-23 14:08:56 -050052 for url in override_urls:
53 bb.debug(2, 'Overriding with source: ' + url)
54 local_base = os.path.basename(fetch.localpath(url))
55 filename = os.path.join(workdir, local_base)
56 cmd.append(filename)
57
58 # Invoke the script and don't catch any resulting exception.
59 subprocess.check_call(cmd)
60}
61# python-pyyaml-native is installed by do_configure, so put this task after
62addtask merge_settings after do_configure before do_compile