Subject: Re: blueman does not start

From: Raghav Gururajan <[email-masked]>
Date: Sat, 9 May 2020 02:29:09 -0400

Hi Pierre!

Please find the new patch attached with this email. It fixes the
discussed issues. Now, blueman just needs "dbus-launch", which I think
provided by %desktop-services.

If you could push this patch, that would be great.

Thank you!

Regards,
RG.
From be674bd528cbcb16e04368e1f01beaffac912a61 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <[email-masked]>
Date: Sat, 9 May 2020 02:17:21 -0400
Subject: [PATCH] gnu: blueman: Update package definition.

* gnu/packages/networking.scm (blueman): Fixes.
[version]: Upgrade to 2.1.3.
[source]<origin>[method]: Change from url-fetch to git-fetch.
[arguments]<#:phases>['setenv]: New phase.
['patch-python-references]: New phase.
['wrap-blueman-progs]: New phase.
[native-inputs]: Add autoconf, autogen and automake.
[inputs]: Add gobject-introspection. Replace libnma with network-manager.
---
 gnu/packages/networking.scm | 65 ++++++++++++++++++++++++++++++-------
 1 file changed, 54 insertions(+), 11 deletions(-)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index d7720724cc..bbdf42c1f7 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -72,6 +72,7 @@
   #:use-module (gnu packages adns)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages audio)
+  #:use-module (gnu packages autogen)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bison)
@@ -127,36 +128,78 @@
 (define-public blueman
   (package
     (name "blueman")
-    (version "2.1.2")
+    (version "2.1.3")
     (source
      (origin
-       (method url-fetch)
+       (method git-fetch)
        (uri
-        (string-append "https://github.com/blueman-project/blueman/releases/"
-                       "download/2.1.2/blueman-2.1.2.tar.gz"))
+        (git-reference
+         (url "https://github.com/blueman-project/blueman.git")
+         (commit version)))
+       (file-name (git-file-name name version))
        (sha256
-        (base32 "0wamxdw36c8i3aqwmja5q70fajqwd7inpkvlpkldd54wdxbcd38d"))))
+        (base32 "1vb0zfns4q5d65hnja4c0k11lr38xxhdnkpkzfs6xca3mm6jyi1d"))))
     (build-system glib-or-gtk-build-system)
     (arguments
      `(#:configure-flags
        (list
         "--enable-polkit"
         "--disable-appindicator"         ; Deprecated
-        "--with-systemdsystemunitdir=no" ; Not required
-        "--with-systemduserunitdir=no")))  ; Not required
+        "--without-systemdsystemunitdir" ; Not required
+        "--without-systemduserunitdir")  ; Not required
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'bootstrap 'setenv
+           ;; Prevent the autogen.sh script to carry out the configure
+           ;; script, which has not yet been patched to replace /bin/sh.
+           (lambda _
+             (setenv "NOCONFIGURE" "TRUE")
+             #t))
+         ;; Python references are not being patched in patch-phase of build;
+         ;; despite using python-wrapper as input. So patching them manually.
+         (add-after 'unpack 'patch-python-references
+           (lambda* (#:key inputs #:allow-other-keys)
+             (with-directory-excursion "apps"
+               (substitute* '("blueman-adapters.in" "blueman-applet.in"
+                              "blueman-assistant.in" "blueman-manager.in"
+                              "blueman-mechanism.in" "blueman-report.in"
+                              "blueman-rfcomm-watcher.in" "blueman-sendto.in"
+                              "blueman-services.in" "blueman-tray.in")
+                 (("@PYTHON@") (string-append (assoc-ref inputs "python")
+                                              "/bin/python3.7"))))
+             #t))
+         (add-after 'glib-or-gtk-wrap 'wrap-blueman-progs
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin/blueman-"))
+                    (lib (string-append out "/lib/python3.7/site-packages/")))
+               (for-each
+                (lambda (program)
+                  (pk program)
+                  (pk (string-append bin program))
+                  (wrap-program (string-append bin program)
+                    `("PYTHONPATH" = (,(getenv "PYTHONPATH")
+                                      ,lib))
+                    `("GI_TYPELIB_PATH" = (,(getenv "GI_TYPELIB_PATH")))))
+                '("adapters" "applet" "assistant" "manager" "report"
+                  "sendto" "services" "tray"))
+               #t))))))
     (native-inputs
-     `(("cython" ,python-cython)
+     `(("autoconf" ,autoconf)
+       ("autogen" ,autogen)
+       ("automake" ,automake)
+       ("cython" ,python-cython)
        ("glib:bin" ,glib "bin")
        ("gtk+:bin" ,gtk+ "bin")
        ("intltool" ,intltool)
        ("libtool" ,libtool)
        ("pkg-config" ,pkg-config)))
     (inputs
-     `(("adwaita-icon-theme" ,adwaita-icon-theme)
-       ("bluez" ,bluez)
+     `(("bluez" ,bluez)
        ("dbus" ,dbus)
        ("gdkpixbuf" ,gdk-pixbuf)
        ("glib" ,glib)
+       ("gobject-introspection" ,gobject-introspection)
        ("gtk+" ,gtk+)
        ("iproute2" ,iproute)
        ("net-tools" ,net-tools)
@@ -166,7 +209,7 @@
        ("pycairo" ,python-pycairo)
        ("pygobject" ,python-pygobject)
        ("python" ,python-wrapper)
-       ("libnm" ,libnma)))
+       ("libnm" ,network-manager)))
     (synopsis "GTK+ Bluetooth manager")
     (description "Blueman is a Bluetooth management utility using the Bluez
 D-Bus backend.  It is designed to be easy to use for most common Bluetooth
-- 
2.26.2