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" |
Brad Bishop | 7a17b6b | 2018-03-08 22:29:25 -0500 | [diff] [blame] | 19 | DEPENDS += "${@df_enabled(d, 'obmc-mrw', 'phosphor-settings-read-settings-mrw-native')}" |
Deepak Kodihalli | 3e3c88c | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 20 | DEPENDS += "sdbusplus sdbusplus-native" |
| 21 | DEPENDS += "phosphor-dbus-interfaces phosphor-dbus-interfaces-native" |
Brad Bishop | fb3c860 | 2017-07-30 20:33:06 -0400 | [diff] [blame] | 22 | DEPENDS += "phosphor-logging" |
Brad Bishop | cc51cd9 | 2018-10-18 17:07:53 -0400 | [diff] [blame] | 23 | DEPENDS += "libcereal" |
Deepak Kodihalli | 3e3c88c | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 24 | |
| 25 | RDEPENDS_${PN} += "sdbusplus phosphor-dbus-interfaces" |
| 26 | |
| 27 | S = "${WORKDIR}/git" |
Deepak Kodihalli | 51b3d16 | 2017-07-23 14:08:56 -0500 | [diff] [blame] | 28 | SRC_URI += "file://merge_settings.py" |
Deepak Kodihalli | 3e3c88c | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 29 | |
| 30 | EXTRA_OECONF = " \ |
| 31 | SETTINGS_YAML=${STAGING_DIR_NATIVE}${settings_datadir}/defaults.yaml \ |
| 32 | " |
Deepak Kodihalli | 51b3d16 | 2017-07-23 14:08:56 -0500 | [diff] [blame] | 33 | |
| 34 | # Collect files in SRC_URI that end in ".override.yml" and call a script that |
| 35 | # writes their contents over that of settings.yaml, which is then updated to |
| 36 | # the merged data values. |
| 37 | # This doesn't correctly handle globs in ".override.yml" entries in SRC_URI. |
| 38 | python do_merge_settings () { |
| 39 | import subprocess |
| 40 | |
| 41 | # TODO: Perform the merge in a temporary directory? |
| 42 | workdir = d.getVar('WORKDIR', True) |
| 43 | nativedir = d.getVar('STAGING_DIR_NATIVE', True) |
| 44 | settingsdir = d.getVar('settings_datadir', True) |
| 45 | settingsdir = settingsdir[1:] |
| 46 | settingsdir = os.path.join(nativedir, settingsdir) |
| 47 | cmd = [] |
| 48 | cmd.append(os.path.join(workdir, 'merge_settings.py')) |
| 49 | cmd.append(os.path.join(settingsdir, 'defaults.yaml')) |
Gunnar Mills | 12d2da2 | 2017-10-04 15:38:33 -0500 | [diff] [blame] | 50 | # Used for any settings from the MRW |
Brad Bishop | 7a17b6b | 2018-03-08 22:29:25 -0500 | [diff] [blame] | 51 | use_mrw = df_enabled(d, 'obmc-mrw', 'true') |
Gunnar Mills | 12d2da2 | 2017-10-04 15:38:33 -0500 | [diff] [blame] | 52 | if (use_mrw == 'true'): |
| 53 | cmd.append(os.path.join(settingsdir, 'mrw-settings.override.yaml')) |
Deepak Kodihalli | 51b3d16 | 2017-07-23 14:08:56 -0500 | [diff] [blame] | 54 | |
| 55 | fetch = bb.fetch2.Fetch([], d) |
Kun Yi | e6bd58c | 2017-10-09 23:17:08 -0700 | [diff] [blame] | 56 | override_urls = [url for url in fetch.urls if url.endswith('.override.yml')] |
Deepak Kodihalli | 51b3d16 | 2017-07-23 14:08:56 -0500 | [diff] [blame] | 57 | for url in override_urls: |
| 58 | bb.debug(2, 'Overriding with source: ' + url) |
| 59 | local_base = os.path.basename(fetch.localpath(url)) |
| 60 | filename = os.path.join(workdir, local_base) |
| 61 | cmd.append(filename) |
| 62 | |
| 63 | # Invoke the script and don't catch any resulting exception. |
| 64 | subprocess.check_call(cmd) |
| 65 | } |
| 66 | # python-pyyaml-native is installed by do_configure, so put this task after |
| 67 | addtask merge_settings after do_configure before do_compile |