[oe-commits] Dirk Opfer : linknx: Fix crash on startup

git version control git at git.openembedded.org
Wed Aug 12 08:45:10 UTC 2009


Module: openembedded.git
Branch: org.openembedded.dev
Commit: 110422e26fb5f1e56b22e1ea00e393a187114793
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=110422e26fb5f1e56b22e1ea00e393a187114793

Author: Dirk Opfer <dirk at do13.de>
Date:   Wed Aug 12 10:06:44 2009 +0200

linknx: Fix crash on startup
- restructure recipe and add .inc
- Add patch to fix a crash on startup during static initialization of a map
- Add startup script
- Enable curl and smtp
- Add recipe for cvs version

---

 recipes/linknx/files/linknx.start                 |   57 ++++++++++++++++++++
 recipes/linknx/files/logger-initialisations.patch |   59 +++++++++++++++++++++
 recipes/linknx/linknx.inc                         |   29 ++++++++++
 recipes/linknx/linknx_0.0.1.26.bb                 |   18 ++-----
 recipes/linknx/linknx_cvs.bb                      |    6 ++
 5 files changed, 155 insertions(+), 14 deletions(-)

diff --git a/recipes/linknx/files/linknx.start b/recipes/linknx/files/linknx.start
new file mode 100755
index 0000000..444d6c0
--- /dev/null
+++ b/recipes/linknx/files/linknx.start
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+PATH=/sbin:/bin:/usr/bin
+
+DAEMON="linknx"
+
+test -f /usr/bin/${DAEMON} || exit 0
+
+if test -f /etc/default/${DAEMON} ; then
+. /etc/default/${DAEMON}
+else
+:
+fi
+
+if [ "$START_LINKNX" != "yes" ] 
+then  
+	exit 0
+fi
+
+startdaemon(){
+	echo -n "Starting ${DAEMON}: "
+	start-stop-daemon --start -x /usr/bin/${DAEMON} --  ${CMDLINE} -d -p/var/run/${DAEMON}.pid
+	echo "done"
+}
+
+stopdaemon(){
+	echo -n "Stopping ${DAEMON}: "
+	start-stop-daemon --stop -p /var/run/${DAEMON}.pid
+	echo "done"
+}
+
+case "$1" in
+  start)
+	startdaemon
+	;;
+  stop)
+	stopdaemon
+	;;
+  force-reload)
+	stopdaemon
+	startdaemon
+	;;
+  restart)
+	stopdaemon
+	startdaemon
+	;;
+  reload)
+	stopdaemon
+	startdaemon
+	;;
+  *)
+	echo "Usage: ${DAEMON} { start | stop | restart | reload }" >&2
+	exit 1
+	;;
+esac
+
+exit 0
diff --git a/recipes/linknx/files/logger-initialisations.patch b/recipes/linknx/files/logger-initialisations.patch
new file mode 100644
index 0000000..857014e
--- /dev/null
+++ b/recipes/linknx/files/logger-initialisations.patch
@@ -0,0 +1,59 @@
+Index: linknx/src/logger.h
+===================================================================
+RCS file: /cvsroot/linknx/linknx/linknx/src/logger.h,v
+retrieving revision 1.5
+diff -u -r1.5 logger.h
+--- linknx/src/logger.h	8 Mar 2009 22:34:23 -0000	1.5
++++ linknx/src/logger.h	17 May 2009 22:29:02 -0000
+@@ -132,7 +132,7 @@
+     std::string cat_m;
+     typedef std::pair<std::string ,Logger*> LoggerPair_t;
+     typedef std::map<std::string ,Logger*> LoggerMap_t;
+-    static LoggerMap_t loggerMap_m;
++    static LoggerMap_t* getLoggerMap();
+     static int level_m; // 10=DEBUG, 20=INFO, 30=NOTICE, 40=WARN, 50=ERROR, 
+     static bool timestamp_m;
+     static std::ostream nullStream_m;
+Index: linknx/src/logger.cpp
+===================================================================
+RCS file: /cvsroot/linknx/linknx/linknx/src/logger.cpp,v
+retrieving revision 1.6
+diff -u -r1.6 logger.cpp
+--- linknx/src/logger.cpp	12 Mar 2009 21:56:55 -0000	1.6
++++ linknx/src/logger.cpp	17 May 2009 22:29:02 -0000
+@@ -118,7 +118,7 @@
+ 
+ #include    <ctime>
+ 
+-Logger::LoggerMap_t Logger::loggerMap_m;
++//Logger::LoggerMap_t Logger::loggerMap_m;
+ int Logger::level_m;
+ bool Logger::timestamp_m;
+ NullStreamBuf Logger::nullStreamBuf_m;
+@@ -157,14 +157,23 @@
+         pConfig->SetAttribute("level", level_m);
+ }
+ 
++Logger::LoggerMap_t* Logger::getLoggerMap() {
++    // This static local is used to avoid problems with
++    // initialization order of static object present in
++    // different compilation units
++    static LoggerMap_t* loggerMap = new LoggerMap_t();
++    return loggerMap;
++}
++
+ Logger& Logger::getInstance(const char* cat) {
+-    LoggerMap_t::iterator it = loggerMap_m.find(cat);
++    LoggerMap_t* map = getLoggerMap();
++    LoggerMap_t::iterator it = map->find(cat);
+     Logger* logger;
+-    if (it != loggerMap_m.end())
++    if (it != map->end())
+         logger = it->second;
+     else {
+         logger = new Logger(cat);
+-        loggerMap_m.insert(LoggerPair_t(cat, logger));
++        map->insert(LoggerPair_t(cat, logger));
+     }
+     return *(logger);
+ }
diff --git a/recipes/linknx/linknx.inc b/recipes/linknx/linknx.inc
new file mode 100644
index 0000000..ff2492f
--- /dev/null
+++ b/recipes/linknx/linknx.inc
@@ -0,0 +1,29 @@
+DESCRIPTION = "Linknx is an automation platform providing high level functionalities to EIB/KNX installation. \
+The rules engine allows execution of actions based on complex logical conditions and timers"
+HOMEPAGE = "http://linknx.sourceforge.net/"
+SECTION = "console/network"
+PRIORITY = "optional"
+LICENSE = "GPL"
+
+DEPENDS = " pthsem lua5.1 curl libesmtp"
+DEPENDS_append_linux-uclibc = " argp-standalone"
+DEPENDS_append_linux-uclibcgnueabi = " argp-standalone"
+
+SRC_URI += "file://configure-libcurl.patch;patch=1 \
+            file://linknx.start "
+
+inherit autotools update-rc.d
+
+EXTRA_OECONF = " --with-pth=yes --without-pth-test --without-mysql --without-log4cpp \
+                 --disable-nls --disable-static \
+#                 --with-mysql=${STAGING_BINDIR_CROSS} \
+                 --enable-smtp --with-lua"
+
+do_install_prepend() {
+        install -d ${D}${sysconfdir}/default/
+        install -d ${D}${sysconfdir}/init.d/
+        install -m 0755 ${WORKDIR}/linknx.start ${D}${sysconfdir}/init.d/linknx
+}
+
+INITSCRIPT_NAME = "linknx"
+INITSCRIPT_PARAMS = "defaults 22"
diff --git a/recipes/linknx/linknx_0.0.1.26.bb b/recipes/linknx/linknx_0.0.1.26.bb
index 1afde1c..5f30eb8 100644
--- a/recipes/linknx/linknx_0.0.1.26.bb
+++ b/recipes/linknx/linknx_0.0.1.26.bb
@@ -1,17 +1,7 @@
-DESCRIPTION = "Linknx is an automation platform providing high level functionalities to EIB/KNX installation. \
-The rules engine allows execution of actions based on complex logical conditions and timers"
-HOMEPAGE = "http://linknx.sourceforge.net/"
-SECTION = "console/network"
-PRIORITY = "optional"
-LICENSE = "GPL"
-
-DEPENDS = " pthsem "
-DEPENDS_append_linux-uclibc = " argp-standalone"
-DEPENDS_append_linux-uclibcgnueabi = " argp-standalone"
+PR = "r1"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/linknx/linknx-${PV}.tar.gz \
-           file://configure-libcurl.patch;patch=1 "
-
-inherit autotools
+           file://logger-initialisations.patch;patch=1 \
+           "
 
-EXTRA_OECONF = " --with-pth=yes --without-pth-test --without-mysql --without-libcurl --without-log4cpp --without-lua"
+require linknx.inc
\ No newline at end of file
diff --git a/recipes/linknx/linknx_cvs.bb b/recipes/linknx/linknx_cvs.bb
new file mode 100644
index 0000000..579e615
--- /dev/null
+++ b/recipes/linknx/linknx_cvs.bb
@@ -0,0 +1,6 @@
+PV = "0.0.1.26+cvs${SRCDATE}"
+
+SRC_URI = "cvs://anonymous@linknx.cvs.sourceforge.net/cvsroot/linknx;module=linknx;method=pserver "
+S = "${WORKDIR}/linknx/linknx"
+
+require linknx.inc





More information about the Openembedded-commits mailing list