summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qpid/cpp/Makefile.am16
-rw-r--r--qpid/cpp/configure.ac1
-rw-r--r--qpid/cpp/docs/api/Makefile.am10
-rw-r--r--qpid/cpp/docs/api/user.doxygen4
-rw-r--r--qpid/cpp/docs/man/Makefile.am4
-rwxr-xr-xqpid/cpp/etc/qpidd49
-rw-r--r--qpid/cpp/lib/broker/Configuration.cpp16
-rw-r--r--qpid/cpp/lib/broker/Configuration.h263
-rw-r--r--qpid/cpp/lib/common/doxygen_mainpage.h45
-rw-r--r--qpid/cpp/qpidc.spec39
-rw-r--r--qpid/cpp/rpm/Makefile.am25
-rw-r--r--qpid/cpp/src/qpidd.cpp20
12 files changed, 293 insertions, 199 deletions
diff --git a/qpid/cpp/Makefile.am b/qpid/cpp/Makefile.am
index 9bcec9b312..703266f8e9 100644
--- a/qpid/cpp/Makefile.am
+++ b/qpid/cpp/Makefile.am
@@ -3,21 +3,13 @@ ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = README-dev DESIGN LICENSE.txt NOTICE.txt README.rhel3 README.txt etc/qpidd
-SUBDIRS = gen lib tests src docs/api docs/man
+SUBDIRS = gen lib tests src docs/api docs/man rpm
# Update libtool, if needed.
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status --recheck
-# Convenience targets for making RPMs.
-RPM_TAR=/usr/src/redhat/SOURCES/$(distdir).tar.gz
+.PHONY: rpm srpm
-$(RPM_TAR): dist-gzip
- cp $(distdir).tar.gz $(RPM_TAR)
- rpmbuild -bs -v qpidc.spec
-
-srpm: $(RPM_TAR)
- rpmbuild -bs -v qpidc.spec
-
-rpm: $(RPM_TAR)
- rpmbuild -ba -v qpidc.spec
+rpm srpm:
+ cd rpm && $(MAKE) $(MAKEFLAGS_AM) $@
diff --git a/qpid/cpp/configure.ac b/qpid/cpp/configure.ac
index 0334b00fe9..058bce148f 100644
--- a/qpid/cpp/configure.ac
+++ b/qpid/cpp/configure.ac
@@ -130,6 +130,7 @@ AC_CONFIG_FILES([
tests/Makefile
docs/man/Makefile
docs/api/Makefile
+ rpm/Makefile
])
AC_OUTPUT
diff --git a/qpid/cpp/docs/api/Makefile.am b/qpid/cpp/docs/api/Makefile.am
index 6845ec0b0d..ed7a00b20c 100644
--- a/qpid/cpp/docs/api/Makefile.am
+++ b/qpid/cpp/docs/api/Makefile.am
@@ -6,11 +6,11 @@ dist-hook: html
EXTRA_DIST=html
SOURCES = \
- $(wildcard $(topsrcdir)/gen/*.h) \
- $(wildcard $(topsrcdir)/lib/common/*.h) \
- $(wildcard $(topsrcdir)/lib/common/sys/*.h) \
- $(wildcard $(topsrcdir)/lib/common/framing/*.h) \
- $(wildcard $(topsrcdir)/lib/client/*.h)
+ $(wildcard $(top_srcdir)/gen/*.h) \
+ $(wildcard $(top_srcdir)/lib/common/*.h) \
+ $(wildcard $(top_srcdir)/lib/common/sys/*.h) \
+ $(wildcard $(top_srcdir)/lib/common/framing/*.h) \
+ $(wildcard $(top_srcdir)/lib/client/*.h)
doxygen.tstamp: user.doxygen $(SOURCES)
doxygen user.doxygen
diff --git a/qpid/cpp/docs/api/user.doxygen b/qpid/cpp/docs/api/user.doxygen
index 2b19196568..0d92dc283b 100644
--- a/qpid/cpp/docs/api/user.doxygen
+++ b/qpid/cpp/docs/api/user.doxygen
@@ -146,7 +146,7 @@ SHORT_NAMES = YES
# comments will behave just like the Qt-style comments (thus requiring an
# explicit @brief command for a brief description.
-JAVADOC_AUTOBRIEF = NO
+JAVADOC_AUTOBRIEF = YES
# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
# treat a multi-line C++ special comment block (i.e. a block of //! or ///
@@ -729,7 +729,7 @@ ENUM_VALUES_PER_LINE = 4
# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
# probably better off using the HTML help feature.
-GENERATE_TREEVIEW = YES
+GENERATE_TREEVIEW = NO
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
# used to set the initial width (in pixels) of the frame in which the tree
diff --git a/qpid/cpp/docs/man/Makefile.am b/qpid/cpp/docs/man/Makefile.am
index 1edfdd55d2..f637328cbb 100644
--- a/qpid/cpp/docs/man/Makefile.am
+++ b/qpid/cpp/docs/man/Makefile.am
@@ -4,7 +4,9 @@ man_aux = $(dist_man_MANS:.1=.x) $(optional_mans:.1=.x)
EXTRA_DIST = $(man_aux) $(optional_mans)
MAINTAINERCLEANFILES = $(dist_man_MANS)
-qpidd.1: $(srcdir)/qpidd.x $(top_srcdir)/src/qpidd.cpp
+dist-hook: $(man_aux)
+
+qpidd.1: $(srcdir)/qpidd.x $(top_srcdir)/src/qpidd
# Depend on configure.ac to get version number changes.
$(dist_man_MANS): $(top_srcdir)/configure.ac
diff --git a/qpid/cpp/etc/qpidd b/qpid/cpp/etc/qpidd
index 0c6041b063..cfd6049c9b 100755
--- a/qpid/cpp/etc/qpidd
+++ b/qpid/cpp/etc/qpidd
@@ -3,32 +3,21 @@
# qpidd Startup script for the Qpid messaging daemon.
#
# chkconfig: - 85 15
-# description: Qpidd is an AMQP broker. It receives, stores and routes
-# messages sent using the AMQP protcol.
+# description: Qpidd is an AMQP broker. It receives, stores, routes and forwards messages using the AMQP protcol.
# processname: qpidd
-# pidfile: /var/run/qpidd.pid
#
-# NB: add config: entries here when qpidd gets a config file.
+
+prog=qpidd
+lockfile=/var/lock/subsys/$prog
# Source function library.
. /etc/rc.d/init.d/functions
-if [ -f /etc/sysconfig/qpidd ]; then
- . /etc/sysconfig/qpidd
-fi
-
-# Start qpidd in the C locale by default.
-QPIDD_LANG=${QPIDD_LANG-"C"}
-
-qpidd=${QPIDD-/usr/sbin/qpidd}
-prog=qpidd
-pidfile=${PIDFILE-/var/run/qpidd.pid}
-lockfile=${LOCKFILE-/var/lock/subsys/qpidd}
RETVAL=0
start() {
- echo -n $"Starting $prog: "
- LANG=$QPIDD_LANG daemon $qpidd $OPTIONS
+ echo -n $"Starting Qpid AMQP daemon: "
+ daemon $prog --daemon
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
@@ -36,18 +25,16 @@ start() {
}
stop() {
- echo -n $"Stopping $prog: "
- killproc 2 $qpidd
+ echo -n $"Stopping Qpid AMQP daemon: "
+ killproc $prog
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
-reload() {
- echo -n $"Reloading $prog: "
- killproc $qpidd -HUP
- RETVAL=$?
- echo
+restart() {
+ stop
+ start
}
# See how we were called.
@@ -59,24 +46,20 @@ case "$1" in
stop
;;
status)
- status $qpidd
+ status $prog
RETVAL=$?
;;
- restart)
- stop
- start
+ restart|reload)
+ restart
;;
condrestart)
- if [ -f ${pidfile} ] ; then
- stop
- start
- fi
+ if [ -e $lockfile ] ; then restart ; fi
;;
reload)
reload
;;
*)
- echo $"Usage: $prog {start|stop|restart|condrestart|reload|status}"
+ echo $"Usage: $0 {start|stop|restart|condrestart|reload|status}"
exit 1
esac
diff --git a/qpid/cpp/lib/broker/Configuration.cpp b/qpid/cpp/lib/broker/Configuration.cpp
index 65d60ae1ca..e83c359f2d 100644
--- a/qpid/cpp/lib/broker/Configuration.cpp
+++ b/qpid/cpp/lib/broker/Configuration.cpp
@@ -26,7 +26,8 @@ using namespace qpid::broker;
using namespace std;
Configuration::Configuration() :
- trace('t', "trace", "Print incoming & outgoing frames to the console (default=false)", false),
+ daemon('d', "daemon", "Run as system daemon, detached from terminal.", false),
+ trace('t', "trace", "Print incoming & outgoing frames to the console", false),
port('p', "port", "Set the port to listen on (default=5672)", 5672),
workerThreads("worker-threads", "Set the number of worker threads to use (default=5).", 5),
maxConnections("max-connections", "Set the maximum number of connections the broker can accept (default=500).", 500),
@@ -36,6 +37,7 @@ Configuration::Configuration() :
help("help", "Print usage information", false),
version("version", "Print version information", false)
{
+ options.push_back(&daemon);
options.push_back(&trace);
options.push_back(&port);
options.push_back(&workerThreads);
@@ -57,16 +59,16 @@ void Configuration::parse(char const *progName, int argc, char** argv){
for(op_iterator i = options.begin(); i < options.end() && !matched; i++){
matched = (*i)->parse(position, argv, argc);
}
- if(!matched){
- std::cerr<< "Warning: skipping unrecognised option " << argv[position] << std::endl;
- position++;
+ if(!matched) {
+ throw BadOptionException(
+ std::string("Unrecognised option: ")+argv[position]);
}
}
}
void Configuration::usage(){
std::cout << "Usage: " << programName << " [OPTION]..." << std::endl
- << "Start the Qpid broker daemon." << std::endl << std::endl
+ << "Start the Qpid AMQP broker daemon." << std::endl << std::endl
<< "Options:" << std::endl;
for(op_iterator i = options.begin(); i < options.end(); i++){
(*i)->print(std::cout);
@@ -84,6 +86,10 @@ bool Configuration::isVersion() const {
return version.getValue();
}
+bool Configuration::isDaemon() const {
+ return daemon.getValue();
+}
+
bool Configuration::isTrace() const {
return trace.getValue();
}
diff --git a/qpid/cpp/lib/broker/Configuration.h b/qpid/cpp/lib/broker/Configuration.h
index 0351601807..15f2117f5e 100644
--- a/qpid/cpp/lib/broker/Configuration.h
+++ b/qpid/cpp/lib/broker/Configuration.h
@@ -27,132 +27,143 @@
#include <Exception.h>
namespace qpid {
- namespace broker {
- class Configuration{
- class Option {
- const std::string flag;
- const std::string name;
- const std::string desc;
-
- bool match(const std::string& arg);
-
- protected:
- virtual bool needsValue() const = 0;
- virtual void setValue(const std::string& value) = 0;
-
- public:
- Option(const char flag, const std::string& name, const std::string& desc);
- Option(const std::string& name, const std::string& desc);
- virtual ~Option();
-
- bool parse(int& i, char** argv, int argc);
- void print(std::ostream& out) const;
- };
-
- class IntOption : public Option{
- const int defaultValue;
- int value;
- public:
- IntOption(char flag, const std::string& name, const std::string& desc, const int value = 0);
- IntOption(const std::string& name, const std::string& desc, const int value = 0);
- virtual ~IntOption();
-
- int getValue() const;
- virtual bool needsValue() const;
- virtual void setValue(const std::string& value);
- virtual void setValue(int _value) { value = _value; }
- };
-
- class LongOption : public Option{
- const long defaultValue;
- int value;
- public:
- LongOption(char flag, const std::string& name, const std::string& desc, const long value = 0);
- LongOption(const std::string& name, const std::string& desc, const long value = 0);
- virtual ~LongOption();
-
- long getValue() const;
- virtual bool needsValue() const;
- virtual void setValue(const std::string& value);
- virtual void setValue(int _value) { value = _value; }
- };
-
- class StringOption : public Option{
- const std::string defaultValue;
- std::string value;
- public:
- StringOption(char flag, const std::string& name, const std::string& desc, const std::string value = "");
- StringOption(const std::string& name, const std::string& desc, const std::string value = "");
- virtual ~StringOption();
-
- const std::string& getValue() const;
- virtual bool needsValue() const;
- virtual void setValue(const std::string& value);
- };
-
- class BoolOption : public Option{
- const bool defaultValue;
- bool value;
- public:
- BoolOption(char flag, const std::string& name, const std::string& desc, const bool value = 0);
- BoolOption(const std::string& name, const std::string& desc, const bool value = 0);
- virtual ~BoolOption();
-
- bool getValue() const;
- virtual bool needsValue() const;
- virtual void setValue(const std::string& value);
- virtual void setValue(bool _value) { value = _value; }
- };
-
- BoolOption trace;
- IntOption port;
- IntOption workerThreads;
- IntOption maxConnections;
- IntOption connectionBacklog;
- StringOption store;
- LongOption stagingThreshold;
- BoolOption help;
- BoolOption version;
- char const *programName;
-
- typedef std::vector<Option*>::iterator op_iterator;
- std::vector<Option*> options;
-
- public:
- class ParseException : public Exception {
- public:
- ParseException(const std::string& msg) : Exception(msg) {}
- };
-
-
- Configuration();
- ~Configuration();
-
- void parse(char const*, int argc, char** argv);
-
- bool isHelp() const;
- bool isVersion() const;
- bool isTrace() const;
- int getPort() const;
- int getWorkerThreads() const;
- int getMaxConnections() const;
- int getConnectionBacklog() const;
- const std::string& getStore() const;
- long getStagingThreshold() const;
-
- void setHelp(bool b) { help.setValue(b); }
- void setVersion(bool b) { version.setValue(b); }
- void setTrace(bool b) { trace.setValue(b); }
- void setPort(int i) { port.setValue(i); }
- void setWorkerThreads(int i) { workerThreads.setValue(i); }
- void setMaxConnections(int i) { maxConnections.setValue(i); }
- void setConnectionBacklog(int i) { connectionBacklog.setValue(i); }
- void setStore(const std::string& s) { store.setValue(s); }
- void setStagingThreshold(long l) { stagingThreshold.setValue(l); }
-
- void usage();
- };
- }
+namespace broker {
+class Configuration{
+
+ class Option {
+ const std::string flag;
+ const std::string name;
+ const std::string desc;
+
+ bool match(const std::string& arg);
+
+ protected:
+ virtual bool needsValue() const = 0;
+ virtual void setValue(const std::string& value) = 0;
+
+ public:
+ Option(const char flag, const std::string& name, const std::string& desc);
+ Option(const std::string& name, const std::string& desc);
+ virtual ~Option();
+
+ bool parse(int& i, char** argv, int argc);
+ void print(std::ostream& out) const;
+ };
+
+ class IntOption : public Option{
+ const int defaultValue;
+ int value;
+ public:
+ IntOption(char flag, const std::string& name, const std::string& desc, const int value = 0);
+ IntOption(const std::string& name, const std::string& desc, const int value = 0);
+ virtual ~IntOption();
+
+ int getValue() const;
+ virtual bool needsValue() const;
+ virtual void setValue(const std::string& value);
+ virtual void setValue(int _value) { value = _value; }
+ };
+
+ class LongOption : public Option{
+ const long defaultValue;
+ int value;
+ public:
+ LongOption(char flag, const std::string& name, const std::string& desc, const long value = 0);
+ LongOption(const std::string& name, const std::string& desc, const long value = 0);
+ virtual ~LongOption();
+
+ long getValue() const;
+ virtual bool needsValue() const;
+ virtual void setValue(const std::string& value);
+ virtual void setValue(int _value) { value = _value; }
+ };
+
+ class StringOption : public Option{
+ const std::string defaultValue;
+ std::string value;
+ public:
+ StringOption(char flag, const std::string& name, const std::string& desc, const std::string value = "");
+ StringOption(const std::string& name, const std::string& desc, const std::string value = "");
+ virtual ~StringOption();
+
+ const std::string& getValue() const;
+ virtual bool needsValue() const;
+ virtual void setValue(const std::string& value);
+ };
+
+ class BoolOption : public Option{
+ const bool defaultValue;
+ bool value;
+ public:
+ BoolOption(char flag, const std::string& name, const std::string& desc, const bool value = 0);
+ BoolOption(const std::string& name, const std::string& desc, const bool value = 0);
+ virtual ~BoolOption();
+
+ bool getValue() const;
+ virtual bool needsValue() const;
+ virtual void setValue(const std::string& value);
+ virtual void setValue(bool _value) { value = _value; }
+ };
+
+ BoolOption daemon;
+ BoolOption trace;
+ IntOption port;
+ IntOption workerThreads;
+ IntOption maxConnections;
+ IntOption connectionBacklog;
+ StringOption store;
+ LongOption stagingThreshold;
+ BoolOption help;
+ BoolOption version;
+ char const *programName;
+
+ typedef std::vector<Option*>::iterator op_iterator;
+ std::vector<Option*> options;
+
+ public:
+
+ struct BadOptionException : public qpid::Exception {
+ BadOptionException(const std::string& msg)
+ : qpid::Exception(msg) {}
+ };
+
+
+ class ParseException : public Exception {
+ public:
+ ParseException(const std::string& msg) : Exception(msg) {}
+ };
+
+
+ Configuration();
+ ~Configuration();
+
+ void parse(char const*, int argc, char** argv);
+
+ bool isHelp() const;
+ bool isVersion() const;
+ bool isDaemon() const;
+ bool isTrace() const;
+ int getPort() const;
+ int getWorkerThreads() const;
+ int getMaxConnections() const;
+ int getConnectionBacklog() const;
+ const std::string& getStore() const;
+ long getStagingThreshold() const;
+
+ void setHelp(bool b) { help.setValue(b); }
+ void setVersion(bool b) { version.setValue(b); }
+ void setDaemon(bool b) { daemon.setValue(b); }
+ void setTrace(bool b) { trace.setValue(b); }
+ void setPort(int i) { port.setValue(i); }
+ void setWorkerThreads(int i) { workerThreads.setValue(i); }
+ void setMaxConnections(int i) { maxConnections.setValue(i); }
+ void setConnectionBacklog(int i) { connectionBacklog.setValue(i); }
+ void setStore(const std::string& s) { store.setValue(s); }
+ void setStagingThreshold(long l) { stagingThreshold.setValue(l); }
+
+ void usage();
+};
+}
}
diff --git a/qpid/cpp/lib/common/doxygen_mainpage.h b/qpid/cpp/lib/common/doxygen_mainpage.h
new file mode 100644
index 0000000000..b354238cd0
--- /dev/null
+++ b/qpid/cpp/lib/common/doxygen_mainpage.h
@@ -0,0 +1,45 @@
+// This header file is just for doxygen documentation purposes.
+
+/*!\mainpage Qpid C++ Developer Kit.
+ *
+ *\section intro_sec Introduction
+ *
+ * The <a href=http://incubator.apache.org/qpid/index.html>Qpid project</a> provides implementations of the <a href="http://amqp.org/">AMQP messaging specification</a> in several programming language.
+ *
+ * Qpidc provides APIs and libraries to implement AMQP
+ * clients in C++. Qpidc clients can interact with any compliant AMQP
+ * message broker. The Qpid project also provides an AMQP broker
+ * daemon called qpidd that you can use with your qpidc clients.
+ *
+ *\section install_sec Installation
+ *
+ * If you are installing from the source distribution
+ <pre>
+ > ./configure && make
+ > make install </pre>
+ * This will build and install the client development kit and the broker
+ * in standard places. Use
+ * <code>./configure --help</code> for more options.
+ *
+ * You can also install from RPMs with the <code>rpm -i</code> command.
+ * You will need
+ * - <code>qpidc</code> for core libraries.
+ * - <code>qpidc-devel</code> for header files and developer documentation.
+ * - <code>qpidd</code> for the broker daemon.
+ *
+ *\section getstart_sec Getting Started
+ *
+ * If you have installed in the standard places you should use
+ * these compile flags:
+ *
+ *<code> -I/usr/include/qpidc -I/usr/include/qpidc/framing -I/usr/include/qpidc/sys</code>
+ *
+ * and these link flags:
+ *
+ *<code> -lqpidcommon -lqpidclient</code>
+ *
+ * If you have installed somewhere else you should modify the flags
+ * appropriately.
+ *
+ * See the \ref clientapi "client API module" for more on the client API.
+ */
diff --git a/qpid/cpp/qpidc.spec b/qpid/cpp/qpidc.spec
index 6c23227be6..b9be94f62e 100644
--- a/qpid/cpp/qpidc.spec
+++ b/qpid/cpp/qpidc.spec
@@ -9,12 +9,10 @@ Release: 1%{?dist}
Summary: Libraries for Qpid C++ client applications
Group: System Environment/Libraries
License: Apache Software License
-URL: http://incubator.apache.org/qpid/
-# FIXME: Source must be a URL pointing to where the tarball can be downloaded
+URL: http://people.apache.org/dist/incubator/qpid/M1-incubating/cpp/qpidc-0.1.tar.gz
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-# FIXME: The BR's need to be checked against a clean buildroot [lutter]
BuildRequires: libtool
BuildRequires: boost-devel
BuildRequires: cppunit
@@ -23,12 +21,10 @@ BuildRequires: doxygen
BuildRequires: graphviz
BuildRequires: help2man
BuildRequires: pkgconfig
-
-# FIXME: Remove when APR dependency is removed. [aconway]
BuildRequires: e2fsprogs-devel
BuildRequires: apr-devel
-Requires: apr
+Requires: apr
Requires: boost
Requires(post):/sbin/chkconfig
@@ -42,7 +38,7 @@ C++. Clients exchange messages with an AMQP message broker using
the AMQP protocol.
%package devel
-Summary: Header files and documentation for developing Qpid C++ clients.
+Summary: Header files and documentation for developing Qpid C++ clients
Group: Development/System
Requires: %name = %version-%release
Requires: libtool
@@ -56,7 +52,7 @@ Libraries, header files and documentation for developing AMQP clients
in C++ using Qpid. Qpid implements the AMQP messaging specification.
%package -n %{daemon}
-Summary: An AMQP message broker daemon.
+Summary: An AMQP message broker daemon
Group: System Environment/Daemons
Requires: %name = %version-%release
@@ -69,7 +65,9 @@ the open AMQP messaging protocol.
%build
%configure
-make %{?_smp_mflags}
+make %{?_smp_mflags}
+# Remove this generated perl file, we don't need it and it upsets rpmlint.
+rm docs/api/html/installdox
%install
rm -rf %{buildroot}
@@ -77,6 +75,8 @@ make install DESTDIR=%{buildroot}
install -Dp -m0755 etc/qpidd %{buildroot}%{_initrddir}/qpidd
rm -f %{buildroot}%_libdir/*.a
rm -f %{buildroot}%_libdir/*.la
+# There's no qpidd-devel package so no .so for the broker needed.
+rm -f %{buildroot}%_libdir/libqpidbroker.so
%clean
@@ -99,34 +99,43 @@ make check
%_libdir/libqpidcommon.so
%_libdir/libqpidclient.so
%doc docs/api/html
+# We don't need this perl script and it causes rpmlint to complain.
+# There is probably a more polite way of calculating the devel docdir.
%files -n %{daemon}
-%_libdir/libqpidbroker.so
%_libdir/libqpidbroker.so.0
%_libdir/libqpidbroker.so.0.1.0
%_sbindir/%{daemon}
%{_initrddir}/qpidd
%doc %_mandir/man1/%{daemon}.*
-%post
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%post -n %{daemon}
# This adds the proper /etc/rc*.d links for the script
/sbin/chkconfig --add qpidd
+/sbin/ldconfig
-%preun
+%preun -n %{daemon}
# Check that this is actual deinstallation, not just removing for upgrade.
if [ $1 = 0 ]; then
/sbin/service qpidd stop >/dev/null 2>&1 || :
/sbin/chkconfig --del qpidd
fi
-%postun
+%postun -n %{daemon}
if [ "$1" -ge "1" ]; then
/sbin/service qpidd condrestart >/dev/null 2>&1 || :
fi
+/sbin/ldconfig
%changelog
-* Mon Dec 19 2006 Alan Conway <aconway@redhat.com> - 0.1-1
-- Fixed problems with qpidd init script and doc files.
+
+* Mon Dec 22 2006 Alan Conway <aconway@redhat.com> - 0.1-1
+- Fixed all rpmlint complaints (with help from David Lutterkort)
+- Added qpidd --daemon behaviour, fix init.rc scripts
* Fri Dec 8 2006 David Lutterkort <dlutter@redhat.com> - 0.1-1
- Initial version based on Jim Meyering's sketch and discussions with Alan
diff --git a/qpid/cpp/rpm/Makefile.am b/qpid/cpp/rpm/Makefile.am
new file mode 100644
index 0000000000..46c071ec87
--- /dev/null
+++ b/qpid/cpp/rpm/Makefile.am
@@ -0,0 +1,25 @@
+#
+# Build RPMs from the distribution tarball.
+#
+
+# TODO aconway 2006-12-21: use autoconf macros for version, base name etc.
+
+SPEC=${top_srcdir}/qpidc.spec
+RPMOPTS=--define "_sourcedir ${abs_top_srcdir}" --define "_topdir ${abs_builddir}"
+
+clean:
+ rm -rf BUILD RPMS SOURCES SPECS SRPMS
+
+.PHONY: rpm srpm dist
+
+# Build source and binary RPMs.
+rpm: dist
+ rpmbuild $(RPMOPTS) -ba $(SPEC)
+
+# Source RPM only.
+srpm: dist
+ rpmbuild $(RPMOPTS) -bs $(SPEC)
+
+# Build source distribution.
+dist:
+ cd .. && $(MAKE) $(AM_MAKEFLAGS) dist
diff --git a/qpid/cpp/src/qpidd.cpp b/qpid/cpp/src/qpidd.cpp
index 8285f1aefb..9f658ebf74 100644
--- a/qpid/cpp/src/qpidd.cpp
+++ b/qpid/cpp/src/qpidd.cpp
@@ -23,7 +23,9 @@
#include <signal.h>
#include <iostream>
#include <memory>
+#include <cerrno>
#include <config.h>
+#include <unistd.h>
static char const* programName = "qpidd";
@@ -42,6 +44,7 @@ int main(int argc, char** argv)
Configuration config;
try {
config.parse(programName, argc, argv);
+
if(config.isHelp()){
config.usage();
}else if(config.isVersion()){
@@ -50,9 +53,26 @@ int main(int argc, char** argv)
}else{
broker = Broker::create(config);
signal(SIGINT, handle_signal);
+ if (config.isDaemon()) {
+ // Detach & run as daemon.
+ int chdirRoot = 0; // 0 means chdir to root.
+ int closeStd = 0; // 0 means close stdin/out/err
+ if (daemon(chdirRoot, closeStd) < 0) {
+ char buf[512];
+
+ std::cerr << "Failed to detach as daemon: "
+ << strerror_r(errno, buf, sizeof(buf))
+ << std::endl;;
+ return 1;
+ }
+ }
broker->run();
}
return 0;
+ }
+ catch (const Configuration::BadOptionException& e) {
+ std::cerr << e.what() << std::endl << std::endl;
+ config.usage();
} catch(const std::exception& e) {
std::cerr << e.what() << std::endl;
}