OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall Root: /v/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-src Date: 15-Oct-2006 12:12:52 Branch: HEAD Handle: 2006101511125200 Added files: openpkg-src/dbus rc.dbus Modified files: openpkg-src/dbus dbus.spec Log: Filesystem layout adjustments and run-command support. Submitted by Michael Schloh. Summary: Revision Changes Path 1.12 +84 -8 openpkg-src/dbus/dbus.spec 1.1 +42 -0 openpkg-src/dbus/rc.dbus ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-src/dbus/dbus.spec ============================================================================ $ cvs diff -u -r1.11 -r1.12 dbus.spec --- openpkg-src/dbus/dbus.spec 13 Oct 2006 17:27:33 -0000 1.11 +++ openpkg-src/dbus/dbus.spec 15 Oct 2006 10:12:52 -0000 1.12 @@ -22,8 +22,6 @@ ## SUCH DAMAGE. ## -# FIXME: rse: filesystem layout has to be still adjusted for non-versioned subdirs -# FIXME: rse: a run-command script is required for the daemon # FIXME: rse: hard-coded -pthread might be not portable enough # package information @@ -37,10 +35,11 @@ Group: RPC License: AFL/GPL Version: 0.93 -Release: 20061013 +Release: 20061015 # list of sources Source0: http://dbus.freedesktop.org/releases/dbus-%{version}.tar.gz +Source1: rc.dbus Patch0: dbus.patch # build information @@ -55,9 +54,9 @@ %description D-BUS is a message bus system, a simple way for applications to - talk to one another. D-BUS supplies both a system daemon and a - per-user-login-session daemon. Also, the message bus is built on top - of a general one-to-one message passing framework, which can be used + talk to one another. D-BUS supplies both a system daemon and a per + user login session daemon. Also, the message bus is built on top of + a general one to one message passing framework, which can be used by any two apps to communicate directly (without going through the message bus daemon). @@ -71,17 +70,56 @@ %prep %setup -q %patch -p0 + + # adjust filesystem layout %{l_shtool} subst \ + -e 's;^\(cat[^|]*|\).*;\1 sed -e "s/\\(<listen>unix:tmpdir=\\)\[^<\]\*/\\1\\/tmp/" | \\;' \ -e 's;#! /bin/bash;#!%{l_bash};' \ tools/run-with-tmp-session-bus.sh + %{l_shtool} subst \ + -e 's;/dbus-1\.0;;g' \ + -e 's;dbus-1;dbus;g' \ + -e 's;\(-I\${libdir}\).*;\1/dbus/include;g' \ + dbus-1.pc.in + %{l_shtool} subst \ + -e 's;-1\.la;.la;g' \ + test/name-test/Makefile.in dbus/Makefile.in tools/Makefile.in + %{l_shtool} subst \ + -e 's;/dbus-1\.0;;g' \ + -e 's;/dbus-1;;g' \ + dbus/Makefile.in tools/Makefile.in bus/Makefile.in bus/session.conf.in bus/dbus-daemon.1.in + %{l_shtool} subst \ + -e 's;\(\$(localstatedir)/run\)/dbus;\1;g' \ + bus/Makefile.in + %{l_shtool} subst \ + -e 's;^\(dbusarchincludedir *= *\$(libdir)\)\(/include/dbus\);\1/dbus\2;g' \ + dbus/Makefile.in + %{l_shtool} subst \ + -e 's;^\(LIBTOOL=.\)[^\ ]*;\1/bin/sh;' \ + configure + + # platform specific fixes + case "%{l_platform -t}" in + *-sunos* ) + %{l_shtool} subst \ + -e 's;readdir_r;__posix_readdir_r;' \ + dbus/dbus-sysdeps-util-unix.c + %{l_shtool} subst \ + -e 's;^\(Libs: -L\${libdir} -ldbus[^ ]*\);\1 -lsocket -lnsl;' \ + dbus-1.pc.in + ;; + esac %build + # configure package CC="%{l_cc}" \ CFLAGS="%{l_cflags -O} -pthread" \ CPPFLAGS="%{l_cppflags}" \ LDFLAGS="%{l_ldflags} -pthread" \ ./configure \ --prefix=%{l_prefix} \ + --datadir=%{l_prefix}/share/dbus \ + --sysconfdir=%{l_prefix}/etc/dbus \ --localstatedir=%{l_prefix}/var/dbus \ --without-x \ --disable-qt \ @@ -106,21 +144,59 @@ --disable-shared \ --with-xml=libxml \ --with-session-socket-dir=%{l_prefix}/var/dbus/run \ - --with-system-pid-file=%{l_prefix}/var/dbus/run \ + --with-system-pid-file=%{l_prefix}/var/dbus/run/dbus.pid \ --with-system-socket=%{l_prefix}/var/dbus/run/dbus.socket \ --with-console-auth-dir=%{l_prefix}/var/dbus/run \ --with-dbus-user=%{l_rusr} + # build package %{l_make} %{l_mflags -O} %install + # install package rm -rf $RPM_BUILD_ROOT %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" + + # strip down package strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true - %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} + + # install run-command script + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE rc.dbus} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + + # determine installation files + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ + %{l_files_std} \ + '%not %dir %{l_prefix}/lib/pkgconfig' \ + '%config %{l_prefix}/etc/dbus/*.conf' \ + '%config %{l_prefix}/etc/dbus/system.d/*.conf' %files -f files %clean rm -rf $RPM_BUILD_ROOT +%pre + # save status and stop service before upgrade + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} dbus status 2>/dev/null | tee %{l_tmpfile}` + %{l_rc} dbus stop 2>/dev/null + exit 0 + +%post + if [ $1 -eq 2 ]; then + # restore status after upgrade + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} + [ ".$dbus_active" = .yes ] && %{l_rc} dbus start + fi + exit 0 + +%preun + # stop service before erase and remove run files + [ $1 -eq 0 ] || exit 0 + %{l_rc} dbus stop 2>/dev/null + rm -f $RPM_INSTALL_PREFIX/var/dbus/run/* >/dev/null 2>&1 || true + exit 0 + @@ . patch -p0 <<'@@ .' Index: openpkg-src/dbus/rc.dbus ============================================================================ $ cvs diff -u -r0 -r1.1 rc.dbus --- /dev/null 2006-10-15 12:11:00 +0200 +++ rc.dbus 2006-10-15 12:12:52 +0200 @@ -0,0 +1,42 @@ [EMAIL PROTECTED]@/bin/openpkg rc +## +## rc.dbus -- Run-Commands +## + +%config + dbus_enable="$openpkg_rc_def" + dbus_flags="--system --fork" + +%common + dbus_pidfile="@l_prefix@/var/dbus/run/dbus.pid" + dbus_cfgfile="@l_prefix@/etc/dbus/system.conf" + dbus_signal () { + [ -f $dbus_pidfile ] && kill -$1 `cat $dbus_pidfile` + } + +%status -u @l_susr@ -o + dbus_usable="unknown" + dbus_active="no" + rcService dbus enable yes && \ + dbus_signal 0 && dbus_active="yes" + echo "dbus_enable=\"$dbus_enable\"" + echo "dbus_usable=\"$dbus_usable\"" + echo "dbus_active=\"$dbus_active\"" + +%start -u @l_susr@ + rcService dbus enable yes || exit 0 + rcService dbus active yes && exit 0 + @l_prefix@/bin/dbus-daemon $dbus_flags >/dev/null 2>&1 + +%stop -u @l_susr@ + rcService dbus enable yes || exit 0 + rcService dbus active no && exit 0 + dbus_signal TERM + sleep 2 + rm -f $dbus_pidfile 2>/dev/null || true + +%restart -u @l_susr@ + rcService dbus enable yes || exit 0 + rcService dbus active no && exit 0 + rc dbus stop start + @@ . ______________________________________________________________________ The OpenPKG Project www.openpkg.org CVS Repository Commit List openpkg-cvs@openpkg.org