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" |
Patrick Venture | 5c24f79 | 2018-10-26 08:55:27 -0700 | [diff] [blame] | 5 | PV = "1.0+git${SRCPV}" |
Deepak Kodihalli | 3e3c88c | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 6 | |
| 7 | inherit autotools |
| 8 | inherit obmc-phosphor-dbus-service |
Andrew Geissler | afc2415 | 2020-04-02 13:11:28 +0000 | [diff] [blame] | 9 | inherit python3native |
Deepak Kodihalli | 3e3c88c | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 10 | inherit phosphor-settings-manager |
| 11 | |
| 12 | require phosphor-settings-manager.inc |
| 13 | |
| 14 | DBUS_SERVICE_${PN} = "xyz.openbmc_project.Settings.service" |
| 15 | |
Andrew Geissler | afc2415 | 2020-04-02 13:11:28 +0000 | [diff] [blame] | 16 | DEPENDS += "${PYTHON_PN}-pyyaml-native" |
| 17 | DEPENDS += "${PYTHON_PN}-mako-native" |
Deepak Kodihalli | 3e3c88c | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 18 | DEPENDS += "autoconf-archive-native" |
| 19 | DEPENDS += "virtual/phosphor-settings-defaults" |
Brad Bishop | 536cee9 | 2020-07-09 16:59:54 -0400 | [diff] [blame] | 20 | DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'obmc-mrw', 'phosphor-settings-read-settings-mrw-native', '', d)}" |
Patrick Williams | 2bebd12 | 2020-03-31 16:43:15 -0500 | [diff] [blame] | 21 | DEPENDS += "sdbusplus" |
Patrick Williams | 9a31d9b | 2020-06-09 21:00:08 -0500 | [diff] [blame] | 22 | DEPENDS += "phosphor-dbus-interfaces" |
Brad Bishop | fb3c860 | 2017-07-30 20:33:06 -0400 | [diff] [blame] | 23 | DEPENDS += "phosphor-logging" |
Brad Bishop | cc51cd9 | 2018-10-18 17:07:53 -0400 | [diff] [blame] | 24 | DEPENDS += "libcereal" |
Deepak Kodihalli | 3e3c88c | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 25 | |
Deepak Kodihalli | 3e3c88c | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 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')) |
Gunnar Mills | 12d2da2 | 2017-10-04 15:38:33 -0500 | [diff] [blame] | 49 | # Used for any settings from the MRW |
Brad Bishop | 536cee9 | 2020-07-09 16:59:54 -0400 | [diff] [blame] | 50 | use_mrw = bb.utils.contains('DISTRO_FEATURES', 'obmc-mrw', 'true', '', d) |
Gunnar Mills | 12d2da2 | 2017-10-04 15:38:33 -0500 | [diff] [blame] | 51 | if (use_mrw == 'true'): |
| 52 | cmd.append(os.path.join(settingsdir, 'mrw-settings.override.yaml')) |
Deepak Kodihalli | 51b3d16 | 2017-07-23 14:08:56 -0500 | [diff] [blame] | 53 | |
| 54 | fetch = bb.fetch2.Fetch([], d) |
Kun Yi | e6bd58c | 2017-10-09 23:17:08 -0700 | [diff] [blame] | 55 | 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] | 56 | for url in override_urls: |
| 57 | bb.debug(2, 'Overriding with source: ' + url) |
| 58 | local_base = os.path.basename(fetch.localpath(url)) |
| 59 | filename = os.path.join(workdir, local_base) |
| 60 | cmd.append(filename) |
| 61 | |
| 62 | # Invoke the script and don't catch any resulting exception. |
| 63 | subprocess.check_call(cmd) |
| 64 | } |
| 65 | # python-pyyaml-native is installed by do_configure, so put this task after |
| 66 | addtask merge_settings after do_configure before do_compile |