Deepak Kodihalli | feb8867 | 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 | 0e3e53b | 2018-10-26 08:55:27 -0700 | [diff] [blame] | 5 | PV = "1.0+git${SRCPV}" |
Deepak Kodihalli | feb8867 | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 6 | |
Patrick Williams | a160326 | 2021-12-07 20:44:43 -0600 | [diff] [blame] | 7 | inherit autotools pkgconfig |
Deepak Kodihalli | feb8867 | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 8 | inherit obmc-phosphor-dbus-service |
Andrew Geissler | 384f190 | 2020-04-02 13:11:28 +0000 | [diff] [blame] | 9 | inherit python3native |
Deepak Kodihalli | feb8867 | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 10 | inherit phosphor-settings-manager |
| 11 | |
| 12 | require phosphor-settings-manager.inc |
| 13 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 14 | DBUS_SERVICE:${PN} = "xyz.openbmc_project.Settings.service" |
Deepak Kodihalli | feb8867 | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 15 | |
Andrew Geissler | 384f190 | 2020-04-02 13:11:28 +0000 | [diff] [blame] | 16 | DEPENDS += "${PYTHON_PN}-pyyaml-native" |
| 17 | DEPENDS += "${PYTHON_PN}-mako-native" |
Patrick Williams | 6aa2b12 | 2021-05-05 17:01:23 -0500 | [diff] [blame] | 18 | DEPENDS += "${PYTHON_PN}-sdbus++-native" |
Deepak Kodihalli | feb8867 | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 19 | DEPENDS += "autoconf-archive-native" |
| 20 | DEPENDS += "virtual/phosphor-settings-defaults" |
Brad Bishop | ff92bb6 | 2020-07-09 16:59:54 -0400 | [diff] [blame] | 21 | DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'obmc-mrw', 'phosphor-settings-read-settings-mrw-native', '', d)}" |
Patrick Williams | 4b32c9a | 2020-03-31 16:43:15 -0500 | [diff] [blame] | 22 | DEPENDS += "sdbusplus" |
Patrick Williams | ce14ef6 | 2020-06-09 21:00:08 -0500 | [diff] [blame] | 23 | DEPENDS += "phosphor-dbus-interfaces" |
Brad Bishop | d55ffca | 2017-07-30 20:33:06 -0400 | [diff] [blame] | 24 | DEPENDS += "phosphor-logging" |
Brad Bishop | 17c08bf | 2018-10-18 17:07:53 -0400 | [diff] [blame] | 25 | DEPENDS += "libcereal" |
Deepak Kodihalli | feb8867 | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 26 | |
Deepak Kodihalli | feb8867 | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 27 | S = "${WORKDIR}/git" |
Deepak Kodihalli | 68136c3 | 2017-07-23 14:08:56 -0500 | [diff] [blame] | 28 | SRC_URI += "file://merge_settings.py" |
Deepak Kodihalli | feb8867 | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 29 | |
Konstantin Aladyshev | d8154d0 | 2021-02-24 20:46:10 +0300 | [diff] [blame] | 30 | # 'boot_type' configuration parameter is used to add support for |
| 31 | # the Legacy/EFI boot override selector for systems with x86 host |
| 32 | PACKAGECONFIG[boot_type] = "" |
| 33 | SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'boot_type', 'file://boot_type.override.yml', '', d)}" |
| 34 | |
Deepak Kodihalli | feb8867 | 2017-05-17 06:42:51 -0500 | [diff] [blame] | 35 | EXTRA_OECONF = " \ |
| 36 | SETTINGS_YAML=${STAGING_DIR_NATIVE}${settings_datadir}/defaults.yaml \ |
| 37 | " |
Deepak Kodihalli | 68136c3 | 2017-07-23 14:08:56 -0500 | [diff] [blame] | 38 | |
Gaurav Gandhi | d08d106 | 2022-02-18 21:24:19 +0000 | [diff] [blame] | 39 | # Collect files in SRC_URI that end in ".override.yml" or ".remove.yml" and call a script that |
| 40 | # writes/removes their contents from that of settings.yaml, which is then updated to |
Deepak Kodihalli | 68136c3 | 2017-07-23 14:08:56 -0500 | [diff] [blame] | 41 | # the merged data values. |
| 42 | # This doesn't correctly handle globs in ".override.yml" entries in SRC_URI. |
| 43 | python do_merge_settings () { |
| 44 | import subprocess |
| 45 | |
| 46 | # TODO: Perform the merge in a temporary directory? |
| 47 | workdir = d.getVar('WORKDIR', True) |
| 48 | nativedir = d.getVar('STAGING_DIR_NATIVE', True) |
| 49 | settingsdir = d.getVar('settings_datadir', True) |
| 50 | settingsdir = settingsdir[1:] |
| 51 | settingsdir = os.path.join(nativedir, settingsdir) |
| 52 | cmd = [] |
| 53 | cmd.append(os.path.join(workdir, 'merge_settings.py')) |
| 54 | cmd.append(os.path.join(settingsdir, 'defaults.yaml')) |
Gunnar Mills | 8c6516f | 2017-10-04 15:38:33 -0500 | [diff] [blame] | 55 | # Used for any settings from the MRW |
Brad Bishop | ff92bb6 | 2020-07-09 16:59:54 -0400 | [diff] [blame] | 56 | use_mrw = bb.utils.contains('DISTRO_FEATURES', 'obmc-mrw', 'true', '', d) |
Gunnar Mills | 8c6516f | 2017-10-04 15:38:33 -0500 | [diff] [blame] | 57 | if (use_mrw == 'true'): |
| 58 | cmd.append(os.path.join(settingsdir, 'mrw-settings.override.yaml')) |
Deepak Kodihalli | 68136c3 | 2017-07-23 14:08:56 -0500 | [diff] [blame] | 59 | |
| 60 | fetch = bb.fetch2.Fetch([], d) |
Gaurav Gandhi | d08d106 | 2022-02-18 21:24:19 +0000 | [diff] [blame] | 61 | override_urls = [url for url in fetch.urls if url.endswith(('.override.yml', '.remove.yml'))] |
Deepak Kodihalli | 68136c3 | 2017-07-23 14:08:56 -0500 | [diff] [blame] | 62 | for url in override_urls: |
| 63 | bb.debug(2, 'Overriding with source: ' + url) |
| 64 | local_base = os.path.basename(fetch.localpath(url)) |
| 65 | filename = os.path.join(workdir, local_base) |
| 66 | cmd.append(filename) |
| 67 | |
| 68 | # Invoke the script and don't catch any resulting exception. |
| 69 | subprocess.check_call(cmd) |
| 70 | } |
| 71 | # python-pyyaml-native is installed by do_configure, so put this task after |
| 72 | addtask merge_settings after do_configure before do_compile |