commit | 80aa4762f78f1044d15c918d72316aa388ba0a02 | [log] [tgz] |
---|---|---|
author | Lei YU <mine260309@gmail.com> | Thu Jul 19 10:29:56 2018 +0800 |
committer | Lei YU <mine260309@gmail.com> | Fri Jul 20 17:02:20 2018 +0800 |
tree | 760f5e75f7055e8958cfd6925fe882e1ce992728 | |
parent | 8f6f7fc3ccea4a1a32d17f4c335cbe7040fde068 [diff] |
elog-gen: allow inherits from errors without meta Previously, elog-gen only support inherits from errors that have meta, and if we inherit from an error without meta, e.g. Common.InternalFailure, we get build error like: KeyError: 'xyz.openbmc_project.Common.InternalFailure' This commit makes elog-gen to allow such case, so it is possible to allow a base error without meta, and inheriting error with additional error, e.g. # In Common: - name: NotAllowed ## No meta # In Time: - name: NotAllowed inherits: - xyz.openbmc_project.Common.NotAllowed meta: - str: "OWNER=%s" type: string - str: "SYNC_METHOD=%s" type: string Note: the "inherit" here does not mean the the error inherits from base errors in c++ class, it just makes error "logically" inherits base errors. And in future commits we could make it "really" inherits base errors in c++ level. Tested: Verify phosphor-logging builds correctly with above example error interfaces, and service is able to use such errors with elog. Change-Id: I8dccd7112881e3eb77a8f6ec62a532062348d2ef Signed-off-by: Lei YU <mine260309@gmail.com>
phosphor logging provides mechanism for common event and logging creation based on information from the journal log.
To build this package, do the following steps: 1. ./bootstrap.sh 2. ./configure ${CONFIGURE_FLAGS} 3. make To clean the repository run `./bootstrap.sh clean`.
Reference
Modify Makefile.am to export newly added error YAML to shared location
yamldir = ${datadir}/phosphor-dbus-yaml/yaml nobase_yaml_DATA = \ org/open_power/Host.errors.yaml
# Generate phosphor-logging/elog-errors.hpp if GEN_ERRORS ELOG_MAKO ?= elog-gen-template.mako.hpp ELOG_DIR ?= ${OECORE_NATIVE_SYSROOT}${datadir}/phosphor-logging/elog ELOG_GEN_DIR ?= ${ELOG_DIR}/tools/ ELOG_MAKO_DIR ?= ${ELOG_DIR}/tools/phosphor-logging/templates/ YAML_DIR ?= ${OECORE_NATIVE_SYSROOT}${datadir}/phosphor-dbus-yaml/yaml phosphor-logging/elog-errors.hpp: @mkdir -p ${YAML_DIR}/org/open_power/ @cp ${top_srcdir}/org/open_power/Host.errors.yaml \ ${YAML_DIR}/org/open_power/Host.errors.yaml @mkdir -p `dirname $@` @chmod 777 $(ELOG_GEN_DIR)/elog-gen.py $(AM_V_at)$(PYTHON) $(ELOG_GEN_DIR)/elog-gen.py -y ${YAML_DIR} \ -t ${ELOG_MAKO_DIR} -m ${ELOG_MAKO} -o $@ endif
if GEN_ERRORS nobase_nodist_include_HEADERS += \ phosphor-logging/elog-errors.hpp endif if GEN_ERRORS BUILT_SOURCES += phosphor-logging/elog-errors.hpp endif
if !INSTALL_ERROR_YAML endif
Reference
Install error yaml option(argument) is enabled for native recipe build and disabled for bitbake build.
When install error yaml option is disabled do not check for target specific packages in autotools configure script.
AC_ARG_ENABLE([install_error_yaml], AS_HELP_STRING([--enable-install_error_yaml], [Enable installing error yaml file]),[], [install_error_yaml=no]) AM_CONDITIONAL([INSTALL_ERROR_YAML], [test "x$enable_install_error_yaml" = "xyes"]) AS_IF([test "x$enable_install_error_yaml" != "xyes"], [ .. .. ])
AC_ARG_ENABLE([gen_errors], AS_HELP_STRING([--enable-gen_errors], [Enable elog-errors.hpp generation ]), [],[gen_errors=yes]) AM_CONDITIONAL([GEN_ERRORS], [test "x$enable_gen_errors" != "xno"])
Reference
BBCLASSEXTEND += "native nativesdk"
DEPENDS_remove_class-native = "phosphor-logging"
DEPENDS_remove_class-nativesdk = "phosphor-logging"
## Add package config to enable/disable install_error_yaml feature PACKAGECONFIG ??= "install_error_yaml" PACKAGECONFIG[install_error_yaml] = " \ --enable-install_error_yaml, \ --disable-install_error_yaml, ,\ "
PACKAGECONFIG_add_class-native = "install_error_yaml" PACKAGECONFIG_add_class-nativesdk = "install_error_yaml"
PACKAGECONFIG_remove_class-target = "install_error_yaml"
XTRA_OECONF += "--disable-gen_errors"
Reference