diff options
author | Deepak Kodihalli <dkodihal@in.ibm.com> | 2017-07-23 14:08:56 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-08-01 02:45:04 +0000 |
commit | 68136c32b15277cefaecd2e1f91643ea5ebeed8a (patch) | |
tree | 3bdc5961b2d912204419140d5cf8773f10e30db8 /meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager.bb | |
parent | 3b95123b92ef0e09fb72ee21d4725b128a845783 (diff) | |
download | talos-openbmc-68136c32b15277cefaecd2e1f91643ea5ebeed8a.tar.gz talos-openbmc-68136c32b15277cefaecd2e1f91643ea5ebeed8a.zip |
settings: meta-zaius: add override
Zaius had a way to override the reboot policy setting. Make sure that
still works with the new settings application.
Change-Id: I51e32705b9aa4787fadab211f57b5fdcf75a3207
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Diffstat (limited to 'meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager.bb')
-rw-r--r-- | meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager.bb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager.bb b/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager.bb index dcc6fe32b..525a9fdff 100644 --- a/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager.bb +++ b/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager.bb @@ -24,7 +24,39 @@ DEPENDS += "cereal" RDEPENDS_${PN} += "sdbusplus phosphor-dbus-interfaces" S = "${WORKDIR}/git" +SRC_URI += "file://merge_settings.py" EXTRA_OECONF = " \ SETTINGS_YAML=${STAGING_DIR_NATIVE}${settings_datadir}/defaults.yaml \ " + +# Collect files in SRC_URI that end in ".override.yml" and call a script that +# writes their contents over that of settings.yaml, which is then updated to +# the merged data values. +# This doesn't correctly handle globs in ".override.yml" entries in SRC_URI. +python do_merge_settings () { + import subprocess + + # TODO: Perform the merge in a temporary directory? + workdir = d.getVar('WORKDIR', True) + nativedir = d.getVar('STAGING_DIR_NATIVE', True) + settingsdir = d.getVar('settings_datadir', True) + settingsdir = settingsdir[1:] + settingsdir = os.path.join(nativedir, settingsdir) + cmd = [] + cmd.append(os.path.join(workdir, 'merge_settings.py')) + cmd.append(os.path.join(settingsdir, 'defaults.yaml')) + + fetch = bb.fetch2.Fetch([], d) + override_urls = filter(lambda f: f.endswith('.override.yml'), fetch.urls) + for url in override_urls: + bb.debug(2, 'Overriding with source: ' + url) + local_base = os.path.basename(fetch.localpath(url)) + filename = os.path.join(workdir, local_base) + cmd.append(filename) + + # Invoke the script and don't catch any resulting exception. + subprocess.check_call(cmd) +} +# python-pyyaml-native is installed by do_configure, so put this task after +addtask merge_settings after do_configure before do_compile |