blob: 1f848990b29d435d032640428e405cc50bf6429d [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"
Patrick Venture5c24f792018-10-26 08:55:27 -07005PV = "1.0+git${SRCPV}"
Deepak Kodihalli3e3c88c2017-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 Bishop7a17b6b2018-03-08 22:29:25 -050020DEPENDS += "${@df_enabled(d, 'obmc-mrw', 'phosphor-settings-read-settings-mrw-native')}"
Deepak Kodihalli3e3c88c2017-05-17 06:42:51 -050021DEPENDS += "sdbusplus sdbusplus-native"
22DEPENDS += "phosphor-dbus-interfaces phosphor-dbus-interfaces-native"
Brad Bishopfb3c8602017-07-30 20:33:06 -040023DEPENDS += "phosphor-logging"
Brad Bishopcc51cd92018-10-18 17:07:53 -040024DEPENDS += "libcereal"
Deepak Kodihalli3e3c88c2017-05-17 06:42:51 -050025
26RDEPENDS_${PN} += "sdbusplus phosphor-dbus-interfaces"
27
28S = "${WORKDIR}/git"
Deepak Kodihalli51b3d162017-07-23 14:08:56 -050029SRC_URI += "file://merge_settings.py"
Deepak Kodihalli3e3c88c2017-05-17 06:42:51 -050030
31EXTRA_OECONF = " \
32 SETTINGS_YAML=${STAGING_DIR_NATIVE}${settings_datadir}/defaults.yaml \
33 "
Deepak Kodihalli51b3d162017-07-23 14:08:56 -050034
35# Collect files in SRC_URI that end in ".override.yml" and call a script that
36# writes their contents over that of settings.yaml, which is then updated to
37# the merged data values.
38# This doesn't correctly handle globs in ".override.yml" entries in SRC_URI.
39python do_merge_settings () {
40 import subprocess
41
42 # TODO: Perform the merge in a temporary directory?
43 workdir = d.getVar('WORKDIR', True)
44 nativedir = d.getVar('STAGING_DIR_NATIVE', True)
45 settingsdir = d.getVar('settings_datadir', True)
46 settingsdir = settingsdir[1:]
47 settingsdir = os.path.join(nativedir, settingsdir)
48 cmd = []
49 cmd.append(os.path.join(workdir, 'merge_settings.py'))
50 cmd.append(os.path.join(settingsdir, 'defaults.yaml'))
Gunnar Mills12d2da22017-10-04 15:38:33 -050051 # Used for any settings from the MRW
Brad Bishop7a17b6b2018-03-08 22:29:25 -050052 use_mrw = df_enabled(d, 'obmc-mrw', 'true')
Gunnar Mills12d2da22017-10-04 15:38:33 -050053 if (use_mrw == 'true'):
54 cmd.append(os.path.join(settingsdir, 'mrw-settings.override.yaml'))
Deepak Kodihalli51b3d162017-07-23 14:08:56 -050055
56 fetch = bb.fetch2.Fetch([], d)
Kun Yie6bd58c2017-10-09 23:17:08 -070057 override_urls = [url for url in fetch.urls if url.endswith('.override.yml')]
Deepak Kodihalli51b3d162017-07-23 14:08:56 -050058 for url in override_urls:
59 bb.debug(2, 'Overriding with source: ' + url)
60 local_base = os.path.basename(fetch.localpath(url))
61 filename = os.path.join(workdir, local_base)
62 cmd.append(filename)
63
64 # Invoke the script and don't catch any resulting exception.
65 subprocess.check_call(cmd)
66}
67# python-pyyaml-native is installed by do_configure, so put this task after
68addtask merge_settings after do_configure before do_compile