ipmi: Refactor whitelist generation

The current dual-use of packagegroup-ipmid-providers as a
dependency insertion point for both native (whitelists) and
runtime (provider libs) doesn't work under Yocto 2.3.

Move the ipmi provider configuration from recipe scope to
the global configuration scope so we can continue to avoid
dually maintaining whitelist and provider lists _and_ build
under Yocto 2.3.

Also rename OBMC_IPMID_PROVIDERS with the more conventional
VIRTUAL-RUNTIME_phosphor-ipmi-providers.

Change-Id: I1acce0b08047cba2312f60542942cccbcff66aec
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/packagegroups/packagegroup-obmc-ipmid-providers.bbappend b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/packagegroups/packagegroup-obmc-ipmid-providers.bbappend
index 61fa2e4..e21ad4a 100644
--- a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/packagegroups/packagegroup-obmc-ipmid-providers.bbappend
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/packagegroups/packagegroup-obmc-ipmid-providers.bbappend
@@ -1 +1 @@
-OBMC_IPMID_PROVIDERS_append = " ${@cf_enabled(d, 'obmc-openpower', 'openpower-ipmi-oem')}"
+VIRTUAL-RUNTIME_phosphor-ipmi-providers_append = " ${@cf_enabled(d, 'obmc-openpower', 'openpower-ipmi-oem')}"
diff --git a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
index fe32be2..180d70d 100644
--- a/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
+++ b/meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
@@ -12,10 +12,18 @@
 inherit phosphor-ipmi-host
 inherit pythonnative
 
+def ipmi_whitelists(d):
+    whitelists = d.getVar(
+        'VIRTUAL-RUNTIME_phosphor-ipmi-providers', True) or ''
+    whitelists = whitelists.split()
+    whitelists = [ '{}-whitelist-native'.format(x) for x in whitelists ]
+    return ' '.join(whitelists)
+
+
 DEPENDS += "autoconf-archive-native"
 DEPENDS += "nlohmann-json"
 DEPENDS += "obmc-targets"
-DEPENDS += "packagegroup-obmc-ipmid-providers"
+DEPENDS += "${@ipmi_whitelists(d)}"
 DEPENDS += "phosphor-dbus-interfaces"
 DEPENDS += "phosphor-logging"
 DEPENDS += "phosphor-mapper"
diff --git a/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-ipmid-providers.bb b/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-ipmid-providers.bb
index 87d17f9..cbe7e7f 100644
--- a/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-ipmid-providers.bb
+++ b/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-ipmid-providers.bb
@@ -7,12 +7,5 @@
 PROVIDES = "${PACKAGES}"
 PACKAGES = "${PN}-libs"
 
-OBMC_IPMID_PROVIDERS = "phosphor-ipmi-fru"
-
 SUMMARY_${PN}-libs = "Extra providers for ipmid."
-RDEPENDS_${PN}-libs = "${OBMC_IPMID_PROVIDERS}"
-
-WHITELIST_FORMAT = "{0}-whitelist-native"
-OBMC_IPMID_WHITELISTS = "${@compose_list(d, 'WHITELIST_FORMAT', 'OBMC_IPMID_PROVIDERS')}"
-
-DEPENDS_append = "${OBMC_IPMID_WHITELISTS}"
+RDEPENDS_${PN}-libs = "${VIRTUAL-RUNTIME_phosphor-ipmi-providers}"
diff --git a/meta-phosphor/conf/distro/include/phosphor-defaults.inc b/meta-phosphor/conf/distro/include/phosphor-defaults.inc
index 2317d9a..5387f93 100644
--- a/meta-phosphor/conf/distro/include/phosphor-defaults.inc
+++ b/meta-phosphor/conf/distro/include/phosphor-defaults.inc
@@ -230,3 +230,15 @@
 
 OBMC_DBUS_PATH_ROOT ?= "/xyz/openbmc_project"
 OBMC_DBUS_IFACE_ROOT ?= "xyz.openbmc_project"
+
+# VIRTUAL-RUNTIME_phosphor-ipmi-providers are the set of shared library
+# plugins for the host-ipmid application.  By default the IPMI FRU plugin
+# is enabled.  Additionally the host-ipmid recipe uses
+# VIRTUAL-RUNTIME_phosphor-ipmi-providers to compute a list of potential
+# IPMI whitelist recipe dependencies.  For example:
+#
+# VIRTUAL-RUNTIME_phosphor-ipmi-providers ?= "phosphor-ipmi-fru"
+#
+# Will add a build dependency to host-ipmid on the
+# phosphor-ipmi-fru-whitelist-native recipe.
+VIRTUAL-RUNTIME_phosphor-ipmi-providers ?= "phosphor-ipmi-fru"