[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.52-28-gd27e032

Holger Levsen holger at layer-acht.org
Thu May 30 09:10:03 UTC 2013


The following commit has been merged in the develop branch:
commit d27e032c1db30f37a96e87e2991f8f27cc968c5b
Author: Holger Levsen <holger at layer-acht.org>
Date:   Wed May 29 16:10:26 2013 +0200

    New master cronjob gather_bts_stats to write bts_stats.txt to master-directory
    
    * master-bin/gather_bts_stats: write bts_stats.txt to master-directory.
    * conf/crontab-master: run gather_bts_stats daily.
    * master-bin/prepare_backup: backup bts_stats.txt and do not backup
      sources.txt.
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>

diff --git a/TODO b/TODO
index f4218a8..c60da62 100644
--- a/TODO
+++ b/TODO
@@ -39,6 +39,7 @@ for 0.5x:
     existing data
   - generate simple diagrams: number of source + binary package in all single distros:
     squeeze, wheezy, jessie, sid.
+  - move counts.txt from htdocs to master.
 
 - add a sample config with all possible keys set to some useful value
   (like /usr/share/doc/apt/examples/configure-index.gz)
@@ -52,7 +53,6 @@ for 0.5x:
 
 - maybe compress all logfiles
 
-- maybe move counts.txt from htdocs to master. Or move submissions.txt to htdocs.
 
 
 for 0.6x:
diff --git a/conf/crontab-master.in b/conf/crontab-master.in
index 18cb9b6..bb38a68 100644
--- a/conf/crontab-master.in
+++ b/conf/crontab-master.in
@@ -31,3 +31,4 @@
 # misc
 #
 0  2 * * * @sharedir@/piuparts/master/prepare_backup
+0 23 * * * @sharedir@/piuparts/master/gather_bts_stats
diff --git a/debian/changelog b/debian/changelog
index 0441c8b..9d62947 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -37,6 +37,10 @@ piuparts (0.53) UNRELEASED; urgency=low
   * Rename README.txt to README_1st.txt.
   * piuparts-master.deb: Ship README_server.html.
   * piuparts-report.py: Add a link to README_server.html.
+  * master-bin/gather_bts_stats: write bts_stats.txt to master-directory.
+  * conf/crontab-master: run gather_bts_stats daily.
+  * master-bin/prepare_backup: backup bts_stats.txt and do not backup
+    sources.txt.
 
  -- Andreas Beckmann <anbe at debian.org>  Mon, 27 May 2013 18:24:27 +0200
 
diff --git a/debian/control b/debian/control
index 5240d72..439ad53 100644
--- a/debian/control
+++ b/debian/control
@@ -62,6 +62,7 @@ Recommends:
  python-rpy2,
  r-base-dev,
  r-recommended,
+ devscripts,
 Breaks:
  piuparts (<= 0.44)
 Replaces:
diff --git a/master-bin/gather_bts_stats.in b/master-bin/gather_bts_stats.in
new file mode 100755
index 0000000..b53a5ee
--- /dev/null
+++ b/master-bin/gather_bts_stats.in
@@ -0,0 +1,49 @@
+#!/bin/bash
+set -e
+
+# Copyright 2013 Holger Levsen (holger at layer-acht.org)
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+. @sharedir@/piuparts/lib/read_config.sh
+get_config_value MASTER global master-directory
+BTS_STATS="$MASTER/bts_stats.txt"
+
+# exit if master-directory doesn't exist or if devscripts package is not installed
+test -n "$MASTER" || $(which bts) || exit 0
+
+# only run once a day
+TODAY=$(date +%Y%m%d)
+if $(grep -q ^$TODAY $BTS_STATS 2>/dev/null) ; then
+	exit 0
+fi
+
+# query bts
+ALL=$(bts select usertag:piuparts users:debian-qa at lists.debian.org archive:both 2>/dev/null|wc -l)
+OPEN=$(bts select usertag:piuparts users:debian-qa at lists.debian.org status:open 2>/dev/null|wc -l)
+
+# test if both values are integers
+if ! ( [[ $ALL =~ ^-?[0-9]+$ ]] && [[ $OPEN =~ ^-?[0-9]+$ ]] ) ; then
+	echo "Non-integer value detected, exiting. ALL: $ALL OPEN: $OPEN"
+fi
+
+# init file if needed
+if [ ! -f $BTS_STATS ] ; then
+	echo "date, all, open" > $BTS_STATS
+fi
+
+# finally, write stats
+echo "$TODAY, $ALL, $OPEN" >> $BTS_STATS
diff --git a/master-bin/prepare_backup.in b/master-bin/prepare_backup.in
index 2253a30..e0a57dc 100755
--- a/master-bin/prepare_backup.in
+++ b/master-bin/prepare_backup.in
@@ -37,6 +37,9 @@ get_config_value BACKUPDIR global backup-directory ''
 
 test -n "$BACKUPDIR" || exit 0
 
+if [ -f $MASTER/bts_stats.txt ]; then
+	cp $MASTER/bts_stats.txt $BACKUPDIR/
+fi
 for SECTION in $SECTIONS ; do
 	mkdir -p $BACKUPDIR/$SECTION
 	if [ -f $MASTER/$SECTION/submissions.txt ]; then
@@ -45,7 +48,4 @@ for SECTION in $SECTIONS ; do
 	if [ -f $HTDOCS/$SECTION/counts.txt ]; then
 		cp $HTDOCS/$SECTION/counts.txt $BACKUPDIR/$SECTION/
 	fi
-	if [ -f $HTDOCS/$SECTION/sources.txt ]; then
-		cp $HTDOCS/$SECTION/sources.txt $BACKUPDIR/$SECTION/
-	fi
 done

-- 
piuparts git repository



More information about the Piuparts-commits mailing list