From: Francis Dupont Date: Sun, 17 May 2015 14:32:28 +0000 (+0200) Subject: [3513] Added embedded config.report in binaries X-Git-Tag: trac3859_base~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=255ce4ec2c5f790c9044713928710489bcd58348;p=thirdparty%2Fkea.git [3513] Added embedded config.report in binaries --- diff --git a/configure.ac b/configure.ac index 1fcb031f77..cede2620bb 100644 --- a/configure.ac +++ b/configure.ac @@ -1412,7 +1412,7 @@ AC_CONFIG_FILES([compatcheck/Makefile doc/version.ent ext/asio/asio/Makefile ext/asio/Makefile - ext/gtest/Makefile + ext/gtest/Makefile ext/Makefile m4macros/Makefile Makefile @@ -1423,6 +1423,7 @@ AC_CONFIG_FILES([compatcheck/Makefile src/bin/d2/tests/Makefile src/bin/d2/tests/d2_process_tests.sh src/bin/d2/tests/test_data_files_config.h + src/bin/cfgrpt/Makefile src/bin/dhcp4/Makefile src/bin/dhcp4/spec_config.h.pre src/bin/dhcp4/tests/Makefile @@ -1455,7 +1456,7 @@ AC_CONFIG_FILES([compatcheck/Makefile src/bin/admin/tests/mysql_tests.sh src/bin/admin/scripts/mysql/Makefile src/bin/admin/scripts/mysql/upgrade_1.0_to_2.0.sh - src/bin/admin/scripts/mysql/upgrade_2.0_to_3.0.sh + src/bin/admin/scripts/mysql/upgrade_2.0_to_3.0.sh src/bin/admin/scripts/pgsql/Makefile src/hooks/Makefile src/hooks/dhcp/Makefile @@ -1680,6 +1681,10 @@ Developer: END +# Create config_report.cc with embedded config.report +chmod +x ${srcdir}/tools/mk_cfgrpt.sh +${srcdir}/tools/mk_cfgrpt.sh ${srcdir}/src/bin/cfgrpt/config_report.cc + cat config.report cat < #include #include +#include #include #include @@ -443,6 +444,9 @@ DControllerBase::usage(const std::string & text) DControllerBase::~DControllerBase() { } +// Refer to config_report so it will be embedded in the binary +const char* const* d2_config_report = isc::detail::config_report; + }; // namespace isc::d2 }; // namespace isc diff --git a/src/bin/dhcp4/Makefile.am b/src/bin/dhcp4/Makefile.am index ae37caf6d4..e3560beae8 100644 --- a/src/bin/dhcp4/Makefile.am +++ b/src/bin/dhcp4/Makefile.am @@ -83,6 +83,7 @@ kea_dhcp4_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la kea_dhcp4_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la kea_dhcp4_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la kea_dhcp4_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la +kea_dhcp4_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la kea_dhcp4dir = $(pkgdatadir) kea_dhcp4_DATA = dhcp4.spec diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index 7b2a4b697a..8190388d39 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -2210,6 +2211,9 @@ Dhcpv4Srv::d2ClientErrorHandler(const CfgMgr::instance().getD2ClientMgr().suspendUpdates(); } +// Refer to config_report so it will be embedded in the binary +const char* const* dhcp4_config_report = isc::detail::config_report; + std::string Daemon::getVersion(bool extended) { std::stringstream tmp; diff --git a/src/bin/dhcp6/Makefile.am b/src/bin/dhcp6/Makefile.am index b8291714c9..a6725d2d4e 100644 --- a/src/bin/dhcp6/Makefile.am +++ b/src/bin/dhcp6/Makefile.am @@ -85,6 +85,7 @@ kea_dhcp6_LDADD += $(top_builddir)/src/lib/log/libkea-log.la kea_dhcp6_LDADD += $(top_builddir)/src/lib/util/libkea-util.la kea_dhcp6_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la kea_dhcp6_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la +kea_dhcp6_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la kea_dhcp6dir = $(pkgdatadir) kea_dhcp6_DATA = dhcp6.spec diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index 99a7b82460..ad47fb2e56 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -48,6 +48,7 @@ #include #include #include +#include #include @@ -2757,6 +2758,9 @@ Dhcpv6Srv::d2ClientErrorHandler(const CfgMgr::instance().getD2ClientMgr().suspendUpdates(); } +// Refer to config_report so it will be embedded in the binary +const char* const* dhcp6_config_report = isc::detail::config_report; + std::string Daemon::getVersion(bool extended) { std::stringstream tmp; diff --git a/src/bin/lfc/Makefile.am b/src/bin/lfc/Makefile.am index ed1c2ca440..693605028f 100644 --- a/src/bin/lfc/Makefile.am +++ b/src/bin/lfc/Makefile.am @@ -64,5 +64,6 @@ kea_lfc_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la kea_lfc_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la kea_lfc_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la kea_lfc_LDADD += $(top_builddir)/src/lib/util/libkea-util.la +kea_lfc_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la kea_lfcdir = $(pkgdatadir) diff --git a/src/bin/lfc/lfc_controller.cc b/src/bin/lfc/lfc_controller.cc index 926a46a9df..49a260975a 100644 --- a/src/bin/lfc/lfc_controller.cc +++ b/src/bin/lfc/lfc_controller.cc @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -45,6 +46,9 @@ const uint32_t MAX_LEASE_ERRORS = 100; namespace isc { namespace lfc { +// Refer to config_report so it will be embedded in the binary +const char* const* lfc_config_report = isc::detail::config_report; + /// @brief Defines the application name, it may be used to locate /// configuration data and appears in log statements. const char* LFCController::lfc_app_name_ = "DhcpLFC"; diff --git a/src/bin/perfdhcp/Makefile.am b/src/bin/perfdhcp/Makefile.am index 9e59de9da4..5aaf80154f 100644 --- a/src/bin/perfdhcp/Makefile.am +++ b/src/bin/perfdhcp/Makefile.am @@ -1,6 +1,7 @@ SUBDIRS = . tests AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib +AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin AM_CPPFLAGS += -I$(top_srcdir)/src/lib/log -I$(top_builddir)/src/lib/log AM_CPPFLAGS += $(BOOST_INCLUDES) @@ -47,7 +48,7 @@ perfdhcp_LDADD = libperfdhcp.la perfdhcp_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la perfdhcp_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la perfdhcp_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la - +perfdhcp_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la # ... and the documentation EXTRA_DIST = perfdhcp_internals.dox diff --git a/src/bin/perfdhcp/command_options.cc b/src/bin/perfdhcp/command_options.cc index 5c169bcad5..f1940bb0b5 100644 --- a/src/bin/perfdhcp/command_options.cc +++ b/src/bin/perfdhcp/command_options.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -35,6 +36,9 @@ using namespace isc; namespace isc { namespace perfdhcp { +// Refer to config_report so it will be embedded in the binary +const char* const* perfdhcp_config_report = isc::detail::config_report; + CommandOptions::LeaseType::LeaseType() : type_(ADDRESS) { } diff --git a/tools/mk_cfgrpt.sh b/tools/mk_cfgrpt.sh new file mode 100755 index 0000000000..62df74f8bb --- /dev/null +++ b/tools/mk_cfgrpt.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# +# This script embeds config.report into src/bin/cfgrpt/config_report.cc +# Called by configure +# + +dest=$1 + +# Initializes +cat > $dest + +# Header +cat >> $dest << END +// config_report.cc. Generated from config.report by tools/mk_cfgrpt_header.sh + +namespace isc { +namespace detail { + +extern const char* const config_report[] = { +END + +# Body: escape '\'s and '"'s, preprend ' ";;;; ' and append '",' +sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/ ";;;; /' -e 's/$/",/' \ + < config.report >> $dest + +# Trailer +cat >> $dest <