[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#682172: unblock: couchdb/1.2.0-2



On Mon, 2012-11-19 at 11:07 +0100, Julien Cristau wrote:
> On Mon, Nov 19, 2012 at 01:18:34 +0000, Laszlo Boszormenyi (GCS) wrote:
> >  Agree. That's an other thing upstream should fix. However I don't think
> > that would happen soon, at least not for Wheezy. I'll ask about it.
> > Until then this sleep may fixes the majority (maybe all) of the
> > problems.
> > 
> Why can't this be fixed in your init script if upstream won't fix it in
> time?
 Touché! First I thought it's not possible. 'couchdb -d' sends a signal
to the running process that it should stop. It returns immediately and
doesn't wait until it completely ends. Then found 'couchdb -s' which
display the status of the daemon. While it's not my initscript, I've
changed that to wait until the status is running.
Changes between the current Wheezy version and the planned 1.2.0-3
upload is attached.
In short, it fixes four RC bugs:
- now properly create a couchdb owned rundir,
- wait for complete stop of the daemon, and this allows to:
  - purge the package properly,
  - restart the service without failing,
- logrotate will properly own the rotated files.

Hope it's now ready to go and will have the promise to be unblocked when
its time comes.

Regards,
Laszlo/GCS
diff -Nur couchdb-1.2.0-1/debian/changelog couchdb-1.2.0-3/debian/changelog
--- couchdb-1.2.0-1/debian/changelog	2012-06-29 20:31:16.000000000 +0200
+++ couchdb-1.2.0-3/debian/changelog	2012-11-20 21:36:00.000000000 +0100
@@ -1,3 +1,17 @@
+couchdb (1.2.0-3) unstable; urgency=low
+
+  * Rework couchdb own run directory (updates: #681549).
+  * Wait until complete stop of service (closes: #692295).
+  * Use couchdb user for logrotate (closes: #652172).
+
+ -- Laszlo Boszormenyi (GCS) <gcs@debian.hu>  Sun, 18 Nov 2012 12:24:24 +0100
+
+couchdb (1.2.0-2) unstable; urgency=low
+
+  * Make couchdb user own its run directory (closes: #681549).
+
+ -- Laszlo Boszormenyi (GCS) <gcs@debian.hu>  Thu, 19 Jul 2012 20:13:25 +0200
+
 couchdb (1.2.0-1) unstable; urgency=low
 
   * New major upstream release (closes: #672141).
diff -Nur couchdb-1.2.0-1/debian/patches/couchdb_own_rundir.patch couchdb-1.2.0-3/debian/patches/couchdb_own_rundir.patch
--- couchdb-1.2.0-1/debian/patches/couchdb_own_rundir.patch	1970-01-01 01:00:00.000000000 +0100
+++ couchdb-1.2.0-3/debian/patches/couchdb_own_rundir.patch	2012-11-18 21:32:47.000000000 +0100
@@ -0,0 +1,20 @@
+Description: Initscript creates RUN_DIR , make sure it's owned by couchdb
+ Use install to make COUCHDB_USER own the RUN_DIR being created.
+Author: Laszlo Boszormenyi (GCS) <gcs@debian.hu>
+Bug-Debian: http://bugs.debian.org/681549
+Last-Update: 2012-11-18
+
+---
+
+--- couchdb-1.2.0.orig/etc/init/couchdb.tpl.in
++++ couchdb-1.2.0/etc/init/couchdb.tpl.in
+@@ -83,7 +83,8 @@ run_command () {
+ start_couchdb () {
+     # Start Apache CouchDB as a background process.
+ 
+-    mkdir -p "$RUN_DIR"
++    test -e "$RUN_DIR" || \
++        install -m 755 -o "$COUCHDB_USER" -g "$COUCHDB_USER" -d "$RUN_DIR"
+     command="$COUCHDB -b"
+     if test -n "$COUCHDB_STDOUT_FILE"; then
+         command="$command -o $COUCHDB_STDOUT_FILE"
diff -Nur couchdb-1.2.0-1/debian/patches/logrotate_as_couchdb.patch couchdb-1.2.0-3/debian/patches/logrotate_as_couchdb.patch
--- couchdb-1.2.0-1/debian/patches/logrotate_as_couchdb.patch	1970-01-01 01:00:00.000000000 +0100
+++ couchdb-1.2.0-3/debian/patches/logrotate_as_couchdb.patch	2012-11-18 21:31:42.000000000 +0100
@@ -0,0 +1,16 @@
+Description: Use logrotate as couchdb user
+ Use su and create to make logfiles owned by couchdb
+Author: Laszlo Boszormenyi (GCS) <gcs@debian.hu>
+Bug-Debian: http://bugs.debian.org/652172
+Last-Update: 2012-11-18
+---
+
+--- couchdb-1.2.0.orig/etc/logrotate.d/couchdb.tpl.in
++++ couchdb-1.2.0/etc/logrotate.d/couchdb.tpl.in
+@@ -6,4 +6,6 @@
+        compress
+        notifempty
+        missingok
++       su couchdb couchdb
++       create 0640 couchdb couchdb
+ }
diff -Nur couchdb-1.2.0-1/debian/patches/series couchdb-1.2.0-3/debian/patches/series
--- couchdb-1.2.0-1/debian/patches/series	2011-11-27 09:19:17.000000000 +0100
+++ couchdb-1.2.0-3/debian/patches/series	2012-11-20 21:35:33.000000000 +0100
@@ -1 +1,4 @@
 force-reload.patch
+couchdb_own_rundir.patch
+logrotate_as_couchdb.patch
+wait_for_couchdb_stop.patch
diff -Nur couchdb-1.2.0-1/debian/patches/wait_for_couchdb_stop.patch couchdb-1.2.0-3/debian/patches/wait_for_couchdb_stop.patch
--- couchdb-1.2.0-1/debian/patches/wait_for_couchdb_stop.patch	1970-01-01 01:00:00.000000000 +0100
+++ couchdb-1.2.0-3/debian/patches/wait_for_couchdb_stop.patch	2012-11-20 21:52:18.000000000 +0100
@@ -0,0 +1,20 @@
+Description: Wait for complete stop of CouchDB
+ Check if CouchDB is already stopped and wait for a second if not before
+ checking again.
+ .
+Author: Laszlo Boszormenyi (GCS) <gcs@debian.hu>
+Bug-Debian: http://bugs.debian.org/692295
+Last-Update: <2012-11-20>
+---
+
+--- couchdb-1.2.0.orig/etc/init/couchdb.tpl.in
++++ couchdb-1.2.0/etc/init/couchdb.tpl.in
+@@ -102,6 +102,8 @@ stop_couchdb () {
+     # Stop the running Apache CouchDB process.
+ 
+     run_command "$COUCHDB -d" > /dev/null
++    while [ $(couchdb -s 2>/dev/null | grep -c process) -eq 1 ]; \
++        do echo -n .; sleep 1; done;
+ }
+ 
+ display_status () {

Reply to: