Deepak Kodihalli | 3e3c88c | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 1 | SUMMARY = "Phosphor Settings Manager" |
| 2 | DESCRIPTION = "Phosphor Settings Manager is an application that creates \ |
| 3 | d-bus objects to represent various user settings." |
| 4 | PR = "r1" |
| 5 | |
| 6 | inherit autotools |
| 7 | inherit obmc-phosphor-dbus-service |
| 8 | inherit pythonnative |
| 9 | inherit phosphor-settings-manager |
| 10 | |
| 11 | require phosphor-settings-manager.inc |
| 12 | |
| 13 | DBUS_SERVICE_${PN} = "xyz.openbmc_project.Settings.service" |
| 14 | |
| 15 | DEPENDS += "python-pyyaml-native" |
| 16 | DEPENDS += "python-mako-native" |
| 17 | DEPENDS += "autoconf-archive-native" |
| 18 | DEPENDS += "virtual/phosphor-settings-defaults" |
| 19 | DEPENDS += "sdbusplus sdbusplus-native" |
| 20 | DEPENDS += "phosphor-dbus-interfaces phosphor-dbus-interfaces-native" |
Brad Bishop | fb3c860 | 2017-07-30 20:33:06 -0400 | [diff] [blame] | 21 | DEPENDS += "phosphor-logging" |
Deepak Kodihalli | 36006e7 | 2017-06-24 12:56:18 -0500 | [diff] [blame] | 22 | DEPENDS += "cereal" |
Deepak Kodihalli | 3e3c88c | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 23 | |
| 24 | RDEPENDS_${PN} += "sdbusplus phosphor-dbus-interfaces" |
| 25 | |
| 26 | S = "${WORKDIR}/git" |
Deepak Kodihalli | 51b3d16 | 2017-07-23 14:08:56 -0500 | [diff] [blame] | 27 | SRC_URI += "file://merge_settings.py" |
Deepak Kodihalli | 3e3c88c | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 28 | |
| 29 | EXTRA_OECONF = " \ |
| 30 | SETTINGS_YAML=${STAGING_DIR_NATIVE}${settings_datadir}/defaults.yaml \ |
| 31 | " |
Deepak Kodihalli | 51b3d16 | 2017-07-23 14:08:56 -0500 | [diff] [blame] | 32 | |
| 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. |
| 37 | python 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) |
| 51 | override_urls = filter(lambda f: f.endswith('.override.yml'), fetch.urls) |
| 52 | 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 |
| 62 | addtask merge_settings after do_configure before do_compile |