]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3513] Added embedded config.report in binaries
authorFrancis Dupont <fdupont@isc.org>
Sun, 17 May 2015 14:32:28 +0000 (16:32 +0200)
committerFrancis Dupont <fdupont@isc.org>
Sun, 17 May 2015 14:32:28 +0000 (16:32 +0200)
16 files changed:
configure.ac
src/bin/Makefile.am
src/bin/cfgrpt/.gitignore [new file with mode: 0644]
src/bin/cfgrpt/Makefile.am [new file with mode: 0644]
src/bin/cfgrpt/config_report.h [new file with mode: 0644]
src/bin/d2/Makefile.am
src/bin/d2/d_controller.cc
src/bin/dhcp4/Makefile.am
src/bin/dhcp4/dhcp4_srv.cc
src/bin/dhcp6/Makefile.am
src/bin/dhcp6/dhcp6_srv.cc
src/bin/lfc/Makefile.am
src/bin/lfc/lfc_controller.cc
src/bin/perfdhcp/Makefile.am
src/bin/perfdhcp/command_options.cc
tools/mk_cfgrpt.sh [new file with mode: 0755]

index 1fcb031f776113c76ae05b54303f4a95f90587cf..cede2620bb8209a114bbb7d910c6e6aa754affd0 100644 (file)
@@ -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 <<EOF
 
index c254189addcdefe3234359d864c7114b455fe15d..220f7755ea669b747e3e6413033d8e18635745fe 100644 (file)
@@ -1,5 +1,5 @@
 # The following build order must be maintained.
-SUBDIRS = dhcp4 dhcp6 d2 perfdhcp admin lfc
+SUBDIRS = cfgrpt dhcp4 dhcp6 d2 perfdhcp admin lfc
 
 if CONFIG_BACKEND_JSON
 SUBDIRS += keactrl
diff --git a/src/bin/cfgrpt/.gitignore b/src/bin/cfgrpt/.gitignore
new file mode 100644 (file)
index 0000000..9a5683a
--- /dev/null
@@ -0,0 +1 @@
+/config_report.cc
diff --git a/src/bin/cfgrpt/Makefile.am b/src/bin/cfgrpt/Makefile.am
new file mode 100644 (file)
index 0000000..b075c9f
--- /dev/null
@@ -0,0 +1,10 @@
+# Get rid of generated message files on a clean
+CLEANFILES = *.gcno *.gcda
+
+# config_report.cc was generated by configure
+DISTCLEANFILES = config_report.cc
+
+# convenience archive
+noinst_LTLIBRARIES = libcfgrpt.la
+
+libcfgrpt_la_SOURCES = config_report.h config_report.cc
diff --git a/src/bin/cfgrpt/config_report.h b/src/bin/cfgrpt/config_report.h
new file mode 100644 (file)
index 0000000..17ce016
--- /dev/null
@@ -0,0 +1,26 @@
+// 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.
+
+#ifndef CONFIG_REPORT_H
+#define CONFIG_REPORT_H
+
+namespace isc {
+namespace detail {
+
+extern const char* const config_report[];
+
+}
+}
+
+#endif // CONFIG_REPORT_H
index 7b34ec5fbac2dff0d6c398ba6fd890f8cad52efb..f6ba11f6669c28affa6f063ee7db5672f47b2302 100644 (file)
@@ -98,6 +98,7 @@ kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
 kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
 kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
+kea_dhcp_ddns_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
 
 kea_dhcp_ddnsdir = $(pkgdatadir)
 kea_dhcp_ddns_DATA = dhcp-ddns.spec
index 84bb1e78427938f62e7c88db358a1cf3ccf6ac7b..7711c8dea1702a410cef7c89a199f98ee5ca5be7 100644 (file)
@@ -21,6 +21,7 @@
 #include <dhcpsrv/cfgmgr.h>
 #include <cryptolink/cryptolink.h>
 #include <log/logger.h>
+#include <cfgrpt/config_report.h>
 
 #include <sstream>
 #include <unistd.h>
@@ -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
index ae37caf6d4149670e60dbaa25e95b35ee3ce9190..e3560beae841aea9317cfc384ebaed29d55cd1ff 100644 (file)
@@ -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
index 7b2a4b697adfffc7f89cd9bfdb4d7c71004750f8..8190388d39603379420f7cae7a734939c14a89e6 100644 (file)
@@ -43,6 +43,7 @@
 #include <util/strutil.h>
 #include <log/logger.h>
 #include <cryptolink/cryptolink.h>
+#include <cfgrpt/config_report.h>
 
 #include <asio.hpp>
 #include <boost/bind.hpp>
@@ -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;
index b8291714c9cee98e2986324ad893f59eb0d76185..a6725d2d4eafc43d4bc874bf7f048469ce566aad 100644 (file)
@@ -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
index 99a7b8246023cca616076079d79d98b1daa7b803..ad47fb2e5651b2ad73eb7594328ad70f62587866 100644 (file)
@@ -48,6 +48,7 @@
 #include <util/range_utilities.h>
 #include <log/logger.h>
 #include <cryptolink/cryptolink.h>
+#include <cfgrpt/config_report.h>
 
 #include <asio.hpp>
 
@@ -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;
index ed1c2ca44006161efed04d2b5f9a68ee4cf8fc61..693605028fb3fcf3b9bde8aab79fa9e6f62f5551 100644 (file)
@@ -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)
index 926a46a9df4e90c921efab6b5c2334caa2d912d1..49a260975a2f91429e2b2b0132945cfd4df3cc17 100644 (file)
@@ -25,6 +25,7 @@
 #include <dhcpsrv/lease_file_loader.h>
 #include <log/logger_manager.h>
 #include <log/logger_name.h>
+#include <cfgrpt/config_report.h>
 
 #include <iostream>
 #include <sstream>
@@ -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";
index 9e59de9da418bd3fc1701f24a597f2befacad646..5aaf80154fa46c43ccda970e188ec53732327f2a 100644 (file)
@@ -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
index 5c169bcad520d8684ce06f0677966598e177dcb1..f1940bb0b5b7d5179f21344aa90f44dd31e8cd1f 100644 (file)
@@ -18,6 +18,7 @@
 #include <exceptions/exceptions.h>
 #include <dhcp/iface_mgr.h>
 #include <dhcp/duid.h>
+#include <cfgrpt/config_report.h>
 
 #include <boost/lexical_cast.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
@@ -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 (executable)
index 0000000..62df74f
--- /dev/null
@@ -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 <<END
+    ""
+};
+
+}
+}
+END