Package: battery-stats
Version: 0.3.6-1.1
Severity: wishlist
Tags: patch

The battery-stats package have been broken for a while.  I decided to do
something about it, and just uploaded a fixed package to the 2 day
delayed upload queue, with the changes in the attached patch:

  * Replace homepage URL in control file with a working one. (Closes: #738807)
  * Fix typo in package description (patters->patterns). (Closes: #648294)
  * Add gbp.conf file to enforce use of pristine-tar.
  * Updated Standards-Version from 3.8.3 to 3.9.7.
  * Removed menu file, only need desktop file.
  * Added code to source /lib/lsb/init-functions in init.d script to
    work well with systemd.
  * Drop obsolete DM-Upload-Allowed field from control file.
  * Added Vcs-* links to control file.
  * Changed build dependencies to allow building with gnuplot-qt.
  * Switch to source format 3.0 (quilt).
  * Added 01-skip-non-battery.patch to skip AC "battery". (Closes: 574678)

-- 
Happy hacking
Petter Reinholdtsen
diff -Nru battery-stats-0.3.6/debian/changelog battery-stats-0.3.6/debian/changelog
--- battery-stats-0.3.6/debian/changelog	2016-03-11 08:53:07.000000000 +0000
+++ battery-stats-0.3.6/debian/changelog	2016-03-11 08:50:16.000000000 +0000
@@ -1,3 +1,21 @@
+battery-stats (0.3.6-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Replace homepage URL in control file with a working one. (Closes: #738807)
+  * Fix typo in package description (patters->patterns). (Closes: #648294)
+  * Add gbp.conf file to enforce use of pristine-tar.
+  * Updated Standards-Version from 3.8.3 to 3.9.7.
+  * Removed menu file, only need desktop file.
+  * Added code to source /lib/lsb/init-functions in init.d script to
+    work well with systemd.
+  * Drop obsolete DM-Upload-Allowed field from control file.
+  * Added Vcs-* links to control file.
+  * Changed build dependencies to allow building with gnuplot-qt.
+  * Switch to source format 3.0 (quilt).
+  * Added 01-skip-non-battery.patch to skip AC "battery". (Closes: 574678)
+
+ -- Petter Reinholdtsen <[email protected]>  Fri, 11 Mar 2016 08:49:58 +0000
+
 battery-stats (0.3.6-1) unstable; urgency=low
 
   * New upstream release that integrates a patch to specify the battery 
diff -Nru battery-stats-0.3.6/debian/control battery-stats-0.3.6/debian/control
--- battery-stats-0.3.6/debian/control	2016-03-11 08:53:07.000000000 +0000
+++ battery-stats-0.3.6/debian/control	2016-03-11 07:07:39.000000000 +0000
@@ -2,10 +2,11 @@
 Section: admin
 Priority: extra
 Maintainer: Antonio Radici <[email protected]>
-Build-Depends: debhelper (>= 7), libapm-dev, libacpi-dev [i386 amd64 ia64], cdbs, autotools-dev, gnuplot-nox (>= 4), imagemagick
-Standards-Version: 3.8.3
-DM-Upload-Allowed: yes
-Homepage: http://theforest.dyne.org/battery-stats/
+Build-Depends: debhelper (>= 7), libapm-dev, libacpi-dev [i386 amd64 ia64], cdbs, autotools-dev, gnuplot-nox (>= 4) | gnuplot-qt, imagemagick
+Standards-Version: 3.9.7
+Homepage: https://github.com/krf/battery-stats
+Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/battery-stats.git
+Vcs-Git: git://anonscm.debian.org/collab-maint/battery-stats.git
 
 Package: battery-stats
 Architecture: sparc ia64 amd64 i386
@@ -15,6 +16,6 @@
  collect statistics about the charge of the batteries present.
  .
  It also proves a binary called battery-graph, which can be used to generate
- qplot graphs about the battery charge/discharge patters over time
+ qplot graphs about the battery charge/discharge patterns over time
  .
  Note: This requires APM or ACPI to be enabled and working in your kernel.
diff -Nru battery-stats-0.3.6/debian/gbp.conf battery-stats-0.3.6/debian/gbp.conf
--- battery-stats-0.3.6/debian/gbp.conf	1970-01-01 00:00:00.000000000 +0000
+++ battery-stats-0.3.6/debian/gbp.conf	2016-03-10 23:26:36.000000000 +0000
@@ -0,0 +1,2 @@
+[DEFAULT]
+pristine-tar = True
diff -Nru battery-stats-0.3.6/debian/init.d battery-stats-0.3.6/debian/init.d
--- battery-stats-0.3.6/debian/init.d	2016-03-11 08:53:07.000000000 +0000
+++ battery-stats-0.3.6/debian/init.d	2016-03-10 23:43:11.000000000 +0000
@@ -12,6 +12,8 @@
 # Modified for Debian GNU/Linux by Ian Murdock <[email protected]>.
 # Modified for battery-stats by Karl E. Jørgensen <[email protected]>
 
+. /lib/lsb/init-functions
+
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 DAEMON=/usr/sbin/battery-stats-collector
 NAME=battery-stats-collector
diff -Nru battery-stats-0.3.6/debian/menu battery-stats-0.3.6/debian/menu
--- battery-stats-0.3.6/debian/menu	2016-03-11 08:53:07.000000000 +0000
+++ battery-stats-0.3.6/debian/menu	1970-01-01 00:00:00.000000000 +0000
@@ -1,4 +0,0 @@
-?package(battery-stats):\
- needs="X11"\
- section="Applications/System/Monitoring"\
- title="Battery Charge Graph" command="/usr/bin/battery-graph"
diff -Nru battery-stats-0.3.6/debian/patches/01-skip-non-battery.patch battery-stats-0.3.6/debian/patches/01-skip-non-battery.patch
--- battery-stats-0.3.6/debian/patches/01-skip-non-battery.patch	1970-01-01 00:00:00.000000000 +0000
+++ battery-stats-0.3.6/debian/patches/01-skip-non-battery.patch	2016-03-11 07:42:21.000000000 +0000
@@ -0,0 +1,59 @@
+Description: Rewrite to skip "AC" battery reported by libaci.
+ This get the program working again using current libaci with
+ recent kernels.  Workaround for bug #479096 in libacpi.
+Author: Petter Reinholdtsen <[email protected]>
+Bug-Debian: https://bugs.debian.org/574678
+Forwarded: no
+Reviewed-By: Petter Reinholdtsen <[email protected]>
+Last-Update: 2016-03-11
+
+--- battery-stats-0.3.6.orig/src/battery-stats-collector.c
++++ battery-stats-0.3.6/src/battery-stats-collector.c
+@@ -26,6 +26,7 @@
+ #include <getopt.h>
+ #include <errno.h>
+ #include <time.h>
++#include <assert.h>
+ #include <apm.h>
+ #include <syslog.h>
+ 
+@@ -59,12 +60,24 @@ static void show_usage(void);
+ static char *myname = "battery-stats-collector";
+ static char *myversion = "0.3.3";
+ 
+-static int battery_num = 0;
++static int battery_num = -1;
+ 
+ static int do_syslog = 0;
+ #define COMPLAIN(loglevel, args...) if (do_syslog) syslog(loglevel, ## args); \
+ 			else { fprintf(stderr,"%s: ", myname); fprintf(stderr, ##args); }
+ 
++static int first_battery_num(global_t *libacpi_global)
++{
++    int i;
++    assert(NULL != libacpi_global);
++    for (i = 0; i < libacpi_global->batt_count; ++i) {
++        if (0 != strcmp("AC", batteries[i].name)) {
++	    return i;
++	}
++    }
++    return -1;
++}
++
+ int main(int argc, char **argv)
+ {
+     int sample_interval_secs = 30;
+@@ -201,6 +214,13 @@ int main(int argc, char **argv)
+ 	  COMPLAIN(LOG_INFO, "Number of batteries: %i.\n",
+ 	      libacpi_global->batt_count);
+ 	  if (libacpi_global->batt_count > 1) {
++	      /*
++	       * Make sure to skip "battery" AC, which is the power
++	       * socket and not a battery.
++	       */
++	      if (-1 == battery_num) {
++		  battery_num = first_battery_num(libacpi_global);
++	      }
+ 	      COMPLAIN(LOG_INFO, 
+ 		       "Reading info from battery %d only.\n", battery_num);
+ 	  }
diff -Nru battery-stats-0.3.6/debian/patches/series battery-stats-0.3.6/debian/patches/series
--- battery-stats-0.3.6/debian/patches/series	1970-01-01 00:00:00.000000000 +0000
+++ battery-stats-0.3.6/debian/patches/series	2016-03-11 07:40:11.000000000 +0000
@@ -0,0 +1 @@
+01-skip-non-battery.patch
diff -Nru battery-stats-0.3.6/debian/source/format battery-stats-0.3.6/debian/source/format
--- battery-stats-0.3.6/debian/source/format	1970-01-01 00:00:00.000000000 +0000
+++ battery-stats-0.3.6/debian/source/format	2016-03-11 07:39:48.000000000 +0000
@@ -0,0 +1 @@
+3.0 (quilt)

Reply via email to