image: Use VIRTUAL-RUNTIME for state pkgs

The correct idiom for modeling runtime only virtual implementations
with no build time API is to use VIRTUAL-RUNTIME in favor of
PREFERRED_PROVIDER.

Update the state management management applications accordingly
since they fall into this category.

Change-Id: I8f0092a38da4ea0741dd0f464b71f4ea12d12019
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/classes/obmc-phosphor-image.bbclass b/classes/obmc-phosphor-image.bbclass
index 57c0fc6..c31b7d7 100644
--- a/classes/obmc-phosphor-image.bbclass
+++ b/classes/obmc-phosphor-image.bbclass
@@ -24,15 +24,15 @@
 inherit obmc-phosphor-license
 inherit obmc-phosphor-utils
 
-FEATURE_PACKAGES_obmc-bmc-state-mgmt ?= "${@cf_enabled(d, 'obmc-bmc-state-mgmt', 'virtual-obmc-bmc-state-mgmt')}"
+FEATURE_PACKAGES_obmc-bmc-state-mgmt ?= "packagegroup-obmc-apps-bmc-state-mgmt"
 FEATURE_PACKAGES_obmc-chassis-mgmt ?= "${@cf_enabled(d, 'obmc-phosphor-chassis-mgmt', 'virtual-obmc-chassis-mgmt')}"
-FEATURE_PACKAGES_obmc-chassis-state-mgmt ?= "${@cf_enabled(d, 'obmc-chassis-state-mgmt', 'virtual-obmc-chassis-state-mgmt')}"
+FEATURE_PACKAGES_obmc-chassis-state-mgmt ?= "packagegroup-obmc-apps-chassis-state-mgmt"
 FEATURE_PACKAGES_obmc-event-mgmt ?= "${@df_enabled(d, 'obmc-phosphor-event-mgmt', 'virtual-obmc-event-mgmt')}"
 FEATURE_PACKAGES_obmc-fan-mgmt ?= "${@cf_enabled(d, 'obmc-phosphor-fan-mgmt', 'virtual-obmc-fan-mgmt')}"
 FEATURE_PACKAGES_obmc-flash-mgmt ?= "${@cf_enabled(d, 'obmc-phosphor-flash-mgmt', 'virtual-obmc-flash-mgmt')}"
 FEATURE_PACKAGES_obmc-host-ctl ?= "${@cf_enabled(d, 'obmc-host-ctl', 'virtual-obmc-host-ctl')}"
 FEATURE_PACKAGES_obmc-host-ipmi ?= "${@cf_enabled(d, 'obmc-host-ipmi', 'virtual-obmc-host-ipmi-hw')}"
-FEATURE_PACKAGES_obmc-host-state-mgmt ?= "${@cf_enabled(d, 'obmc-host-state-mgmt', 'virtual-obmc-host-state-mgmt')}"
+FEATURE_PACKAGES_obmc-host-state-mgmt ?= "packagegroup-obmc-apps-host-state-mgmt"
 FEATURE_PACKAGES_obmc-inventory ?= "packagegroup-obmc-apps-inventory"
 FEATURE_PACKAGES_obmc-leds ?= "packagegroup-obmc-apps-leds"
 FEATURE_PACKAGES_obmc-logging-mgmt ?= "${@df_enabled(d, 'obmc-logging-mgmt', 'virtual-obmc-logging-mgmt')}"
diff --git a/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb b/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb
index 556d79d..517a679 100644
--- a/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb
+++ b/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb
@@ -7,14 +7,27 @@
 
 PROVIDES = "${PACKAGES}"
 PACKAGES = " \
+        ${PN}-bmc-state-mgmt \
+        ${PN}-chassis-state-mgmt \
         ${PN}-extras \
         ${PN}-extrasdev \
+        ${PN}-host-state-mgmt \
         ${PN}-inventory \
         ${PN}-leds \
         ${PN}-sensors \
         ${PN}-software \
         "
 
+SUMMARY_${PN}-bmc-state-mgmt = "BMC state management"
+RDEPENDS_${PN}-bmc-state-mgmt = " \
+        ${VIRTUAL-RUNTIME_obmc-bmc-state-manager} \
+        "
+
+SUMMARY_${PN}-chassis-state-mgmt = "Chassis state management"
+RDEPENDS_${PN}-chassis-state-mgmt = " \
+        ${VIRTUAL-RUNTIME_obmc-chassis-state-manager} \
+        "
+
 SUMMARY_${PN}-extras = "Extra features"
 RDEPENDS_${PN}-extras = " \
         phosphor-rest \
@@ -25,6 +38,11 @@
         rest-dbus \
         "
 
+SUMMARY_${PN}-host-state-mgmt = "Host state management"
+RDEPENDS_${PN}-host-state-mgmt = " \
+        ${VIRTUAL-RUNTIME_obmc-host-state-manager} \
+        "
+
 SUMMARY_${PN}-inventory = "Inventory applications"
 RDEPENDS_${PN}-inventory = " \
         ${VIRTUAL-RUNTIME_obmc-inventory-manager} \
diff --git a/common/recipes-phosphor/state/phosphor-state-manager.bb b/common/recipes-phosphor/state/phosphor-state-manager.bb
index b39baf3..a45e47a 100644
--- a/common/recipes-phosphor/state/phosphor-state-manager.bb
+++ b/common/recipes-phosphor/state/phosphor-state-manager.bb
@@ -36,18 +36,12 @@
 RDEPENDS_${PN}-chassis += "libsystemd phosphor-dbus-interfaces"
 RDEPENDS_${PN}-bmc += "libsystemd phosphor-dbus-interfaces"
 
-PROVIDES += "virtual/obmc-host-state-mgmt"
-RPROVIDES_${PN}-host += "virtual-obmc-host-state-mgmt"
 FILES_${PN}-host = "${sbindir}/phosphor-host-state-manager"
 DBUS_SERVICE_${PN}-host += "xyz.openbmc_project.State.Host.service"
 
-PROVIDES += "virtual/obmc-chassis-state-mgmt"
-RPROVIDES_${PN}-chassis += "virtual-obmc-chassis-state-mgmt"
 FILES_${PN}-chassis = "${sbindir}/phosphor-chassis-state-manager"
 DBUS_SERVICE_${PN}-chassis += "xyz.openbmc_project.State.Chassis.service"
 
-PROVIDES += "virtual/obmc-bmc-state-mgmt"
-RPROVIDES_${PN}-bmc += "virtual-obmc-bmc-state-mgmt"
 FILES_${PN}-bmc = "${sbindir}/phosphor-bmc-state-manager"
 DBUS_SERVICE_${PN}-bmc += "xyz.openbmc_project.State.BMC.service"
 
diff --git a/conf/distro/include/phosphor-defaults.inc b/conf/distro/include/phosphor-defaults.inc
index 0577085..f7ac0b5 100644
--- a/conf/distro/include/phosphor-defaults.inc
+++ b/conf/distro/include/phosphor-defaults.inc
@@ -8,14 +8,29 @@
 OBMC_RESET_BUTTON_INSTANCES ?= "0"
 OBMC_WATCHDOG_INSTANCES ?= "0"
 
-PREFERRED_PROVIDER_virtual/obmc-bmc-state-mgmt ?= "phosphor-state-manager"
 PREFERRED_PROVIDER_virtual/obmc-chassis-mgmt ?= "obmc-phosphor-chassisd"
-PREFERRED_PROVIDER_virtual/obmc-chassis-state-mgmt ?= "phosphor-state-manager"
 PREFERRED_PROVIDER_virtual/obmc-event-mgmt ?= "obmc-phosphor-event"
 PREFERRED_PROVIDER_virtual/obmc-fan-mgmt ?= "obmc-phosphor-fand"
 PREFERRED_PROVIDER_virtual/obmc-flash-mgmt ?= "obmc-phosphor-flashd"
 PREFERRED_PROVIDER_virtual/obmc-host-ipmi-hw ?= "phosphor-ipmi-hw-example"
-PREFERRED_PROVIDER_virtual/obmc-host-state-mgmt ?= "phosphor-state-manager"
+
+# obmc-bmc-state-manager
+#
+# Provides an implementation of the xyz.openbmc_project.State.BMC
+# interface.
+VIRTUAL-RUNTIME_obmc-bmc-state-manager ?= "phosphor-state-manager-bmc"
+
+# obmc-chassis-state-manager
+#
+# Provides an implementation of the xyz.openbmc_project.State.Chassis
+# interface.
+VIRTUAL-RUNTIME_obmc-chassis-state-manager ?= "phosphor-state-manager-chassis"
+
+# obmc-host-state-manager
+#
+# Provides an implementation of the xyz.openbmc_project.State.Host
+# interface.
+VIRTUAL-RUNTIME_obmc-host-state-manager ?= "phosphor-state-manager-host"
 
 # obmc-inventory-manager
 #
diff --git a/conf/distro/openbmc-phosphor.conf b/conf/distro/openbmc-phosphor.conf
index 0cf12f6..11b8165 100644
--- a/conf/distro/openbmc-phosphor.conf
+++ b/conf/distro/openbmc-phosphor.conf
@@ -33,9 +33,6 @@
         obmc-host-ctl \
         avahi \
         slp \
-        obmc-host-state-mgmt \
-        obmc-chassis-state-mgmt \
-        obmc-bmc-state-mgmt \
         obmc-net-ipmi \
         ${DISTRO_FEATURES_LIBC} \
         "