Patchwork gnu: Add wmbattery

login
register
mail settings
Submitter Kei Yamashita
Date May 15, 2016, 2:38 a.m.
Message ID <20160514223851.0615794f@openmailbox.org>
Download mbox | patch
Permalink /patch/12282/
State New
Headers show

Comments

Kei Yamashita - May 15, 2016, 2:38 a.m.
On Fri, 13 May 2016 12:25:07 +0200
Danny Milosavljevic <dannym@scratchpost.org> wrote:

> On Mon, 4 Apr 2016 17:04:51 -0400
> Kei Yamashita <kei@openmailbox.org> wrote:
> 
> > The source tarball comes from Debian.   
> 
> The wmbattery version
> <http://http.debian.net/debian/pool/main/w/wmbattery/wmbattery_2.50.orig.tar.gz>
> that we use in Guix has a memory leak. It's been eating up all memory
> of my laptop for some time now, so I tracked it down.
> 
> The fix would be:
> 
> diff -ur orig/dockapps-30b9edb/upower.c dockapps-30b9edb/upower.c
> --- orig/dockapps-30b9edb/upower.c	2015-08-31
> 01:58:13.000000000 +0200 +++ dockapps-30b9edb/upower.c
> 2016-05-12 07:21:27.550374114 +0200 @@ -56,7 +56,8 @@
>  
>  int upower_supported(void)
>  {
> -	up = up_client_new();
> +	if (!up)
> +		up = up_client_new();
>  
>  	if (!up) {
>  		return 0;
> @@ -78,7 +79,8 @@
>  	GPtrArray *devices = NULL;
>  	static int retries = 0;
>  
> -	up = up_client_new();
> +	if (!up)
> +		up = up_client_new();
>  
>  	if (!up)
>  		return -1;
> 
> I added Joey Hess, the author of the program, to Cc.
> 
> @Joey Hess: what do you think?

Until the patch is applied upstream, this patch should keep things in
order within Guix.
From e07912c6b5ea2ff45d5b923dccad26fef3ca932d Mon Sep 17 00:00:00 2001
From: Kei Yamashita <kei@openmailbox.org>
Date: Sat, 14 May 2016 22:27:15 -0400
Subject: [PATCH] gnu: wmbattery: Add `patch-upower' phase.

* gnu/packages/gnustep.scm (wmbattery): Add `patch-upower' phase.
---
 gnu/packages/gnustep.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Ludovic Courtès - May 17, 2016, 9:05 p.m.
Kei Yamashita <kei@openmailbox.org> skribis:

> Until the patch is applied upstream, this patch should keep things in
> order within Guix.

Good idea.

> From e07912c6b5ea2ff45d5b923dccad26fef3ca932d Mon Sep 17 00:00:00 2001
> From: Kei Yamashita <kei@openmailbox.org>
> Date: Sat, 14 May 2016 22:27:15 -0400
> Subject: [PATCH] gnu: wmbattery: Add `patch-upower' phase.
>
> * gnu/packages/gnustep.scm (wmbattery): Add `patch-upower' phase.

Could you make this a ‘snippet’ in the origin?  I think that such source
modifications should be either plain patches, or snippets.

Thanks!

Ludo’.

Patch

diff --git a/gnu/packages/gnustep.scm b/gnu/packages/gnustep.scm
index 31fca5b..961df0e 100644
--- a/gnu/packages/gnustep.scm
+++ b/gnu/packages/gnustep.scm
@@ -108,7 +108,13 @@  interface.  It is fast, feature rich, easy to configure, and easy to use.")
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'autoconf
-           (lambda _ (zero? (system* "autoreconf" "-vfi")))))))
+           (lambda _ (zero? (system* "autoreconf" "-vfi"))))
+         (add-before 'configure 'patch-upower
+           (lambda _
+             (substitute* "upower.c"
+               (("up = up_client_new\\(\\);")
+                (string-append "if (!up)\n"
+                               "                up = up_client_new();"))))))))
     (inputs
      `(("glib" ,glib)
        ("libx11" ,libx11)