phosphor-host-logger: srcrev bump bc5e150140..e8837d59c

Artem Senichev (1):
      Add multi-host support

The new revision has several features that require the following changes
in the bitbake recipe:
- migrate the build system from autotools to Meson;
- remove direct dependency on sdbusplus (Hostlogger service does not
  provide D-Bus interface anymore);
- add dependency on phosphor-logging;
- add multi-host support based on configuration files that are specified
  in a bbappend.

The default behaviour is not changed: if no configuration files are
provided, the system will have only one service instance (similar to
obmc-console).

(From meta-phosphor rev: c4fddbeeed8107fb1862bf1c4661407c96f9a090)

Signed-off-by: Artem Senichev <a.senichev@yadro.com>
Change-Id: I23480156be91fad08827ab74122db3c320e2e49c
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/meta-phosphor/recipes-phosphor/logging/phosphor-hostlogger_git.bb b/meta-phosphor/recipes-phosphor/logging/phosphor-hostlogger_git.bb
index b2c07a8..1073f16 100644
--- a/meta-phosphor/recipes-phosphor/logging/phosphor-hostlogger_git.bb
+++ b/meta-phosphor/recipes-phosphor/logging/phosphor-hostlogger_git.bb
@@ -4,9 +4,7 @@
 PR = "r1"
 PV = "1.0+git${SRCPV}"
 
-inherit autotools
-inherit pkgconfig
-inherit python3native
+inherit meson
 inherit systemd
 
 # License info
@@ -14,27 +12,55 @@
 LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
 
 # Dependencies
-DEPENDS += "\
-            autoconf-archive-native \
-            sdbusplus \
-            ${PYTHON_PN}-sdbus++-native \
-            phosphor-dbus-interfaces \
+DEPENDS += " \
+            phosphor-logging \
+            zlib \
            "
 RDEPENDS_${PN} += "obmc-console"
 RRECOMMENDS_${PN} += "phosphor-debug-collector"
 
-# systemd service setup
-SYSTEMD_PACKAGES = "${PN}"
-SYSTEMD_SERVICE_${PN} = "hostlogger.service"
-
-# Host TTY setup
-OBMC_CONSOLE_HOST_TTY ?= "ttyVUART0"
-
-# Extra parameters for 'configure' script
-EXTRA_OECONF = "HOST_TTY=${OBMC_CONSOLE_HOST_TTY} \
-                SYSTEMD_TARGET=multi-user.target"
-
 # Source code repository
 S = "${WORKDIR}/git"
 SRC_URI = "git://github.com/openbmc/phosphor-hostlogger"
-SRCREV = "bc5e1501408d6065dba06ff6c4f1caa83b030106"
+SRCREV = "e8837d59c789b4e4b928afc0d6ba38110a394d07"
+
+# Systemd service template
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE_${PN} = "hostlogger@.service"
+
+# Default service instance to install (single-host mode)
+DEFAULT_INSTANCE = "ttyVUART0"
+DEFAULT_SERVICE = "hostlogger@${DEFAULT_INSTANCE}.service"
+
+# Multi-host mode setup - list of configuration files to install, can be added
+# via SRC_URI in a bbappend. The file name is the name of the service instance,
+# which should match the corresponding instance of the obmc-console service.
+CUSTOM_CONFIGS = "${@custom_configs('${WORKDIR}')}"
+CUSTOM_SERVICES = "${@custom_services('${CUSTOM_CONFIGS}')}"
+
+# Preset systemd units
+SYSTEMD_SERVICE_${PN} += "${@'${CUSTOM_SERVICES}' if len('${CUSTOM_SERVICES}') \
+                                                  else '${DEFAULT_SERVICE}'}"
+
+# Gets list of custom config files in a directory
+def custom_configs(workdir):
+    if os.path.exists(workdir):
+        return ' '.join([f for f in os.listdir(workdir) if f.endswith('.conf')])
+
+# Get list of custom service instances
+def custom_services(configs):
+    return ' '.join(['hostlogger@' + i.replace('.conf', '.service') \
+                     for i in configs.split()])
+
+do_install_append() {
+  # Install config files
+  if [ -n "${CUSTOM_CONFIGS}" ]; then
+    for CONFIG_FILE in ${CUSTOM_CONFIGS}; do
+        install -Dm 0644 ${WORKDIR}/${CONFIG_FILE} \
+                     ${D}${sysconfdir}/hostlogger/${CONFIG_FILE}
+    done
+  else
+    install -Dm 0644 ${S}/default.conf \
+                     ${D}${sysconfdir}/hostlogger/${DEFAULT_INSTANCE}.conf
+  fi
+}