blob: 191a389aeae00e43cdcfb84ede3218ba26d550ec [file] [log] [blame]
Adriana Kobylak2ca101c2016-01-30 08:53:35 -06001SUMMARY = "Settings DBUS object"
2DESCRIPTION = "Settings DBUS object"
3HOMEPAGE = "http://github.com/openbmc/phosphor-settingsd"
4PR = "r1"
5
Brad Bishop677be982016-09-15 09:54:10 -04006inherit allarch
Adriana Kobylak2ca101c2016-01-30 08:53:35 -06007inherit obmc-phosphor-license
Adriana Kobylak79841ae2016-08-25 10:07:34 -05008inherit setuptools
Brad Bishop677be982016-09-15 09:54:10 -04009inherit obmc-phosphor-dbus-service
Xo Wang51a53f02017-03-17 18:15:10 -070010inherit pythonnative
Brad Bishop677be982016-09-15 09:54:10 -040011
Patrick Williams1f962b72017-06-02 07:08:31 -050012include phosphor-settings-manager.inc
13
Brad Bishop677be982016-09-15 09:54:10 -040014DBUS_SERVICE_${PN} = "org.openbmc.settings.Host.service"
Adriana Kobylak2ca101c2016-01-30 08:53:35 -060015
Adriana Kobylak79841ae2016-08-25 10:07:34 -050016DEPENDS += "python-pyyaml-native"
Patrick Williamsa25bbf62017-05-24 18:21:54 -050017RDEPENDS_${PN} += "python-dbus python-pygobject python-ipy"
Adriana Kobylak79841ae2016-08-25 10:07:34 -050018PROVIDES += "virtual/obmc-settings-mgmt"
19RPROVIDES_${PN} += "virtual-obmc-settings-mgmt"
Adriana Kobylak2ca101c2016-01-30 08:53:35 -060020
Xo Wang51a53f02017-03-17 18:15:10 -070021SRC_URI += "file://merge_settings.py"
Adriana Kobylak2ca101c2016-01-30 08:53:35 -060022
Adriana Kobylak2ca101c2016-01-30 08:53:35 -060023S = "${WORKDIR}/git"
Xo Wang51a53f02017-03-17 18:15:10 -070024
25# Collect files in SRC_URI that end in ".override.yml" and call a script that
26# writes their contents over that of settings.yaml, which is then updated to
27# the merged data values.
28# This doesn't correctly handle globs in ".override.yml" entries in SRC_URI.
29python do_merge_settings () {
30 import subprocess
31
32 # TODO: Perform the merge in a temporary directory?
33 workdir = d.getVar('WORKDIR', True)
34 cmd = []
35 cmd.append(os.path.join(workdir, 'merge_settings.py'))
36 cmd.append(os.path.join(d.getVar('S', True), 'settings.yaml'))
37
38 fetch = bb.fetch2.Fetch([], d)
39 override_urls = filter(lambda f: f.endswith('.override.yml'), fetch.urls)
40 for url in override_urls:
41 bb.debug(2, 'Overriding with source: ' + url)
42 local_base = os.path.basename(fetch.localpath(url))
43 filename = os.path.join(workdir, local_base)
44 cmd.append(filename)
45
46 # Invoke the script and don't catch any resulting exception.
47 subprocess.check_call(cmd)
48}
49# python-pyyaml-native is installed by do_configure, so put this task after
50addtask merge_settings after do_configure before do_compile