From 4725d267b7c18bc4ba4294f90336871311386bb2 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sat, 4 Apr 2015 21:48:01 +0200 Subject: [PATCH 2/3] Add upower package. * gnu/packages/gnome.scm (upower): New variable. * gnu/packages/patches/upower-builddir.patch: New patch. --- gnu/packages/gnome.scm | 53 ++++++++++++++++++++++++++++++ gnu/packages/patches/upower-builddir.patch | 44 +++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 gnu/packages/patches/upower-builddir.patch diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm index 445b4a1..8b0a055 100644 --- a/gnu/packages/gnome.scm +++ b/gnu/packages/gnome.scm @@ -43,6 +43,7 @@ #:use-module (gnu packages gnutls) #:use-module (gnu packages iso-codes) #:use-module (gnu packages libcanberra) + #:use-module (gnu packages libusb) #:use-module (gnu packages linux) #:use-module (gnu packages image) #:use-module (gnu packages perl) @@ -1718,3 +1719,55 @@ your system. It supports several profiles, multiple tabs and implements several keyboard shortcuts.") (license license:gpl3+))) + +(define-public upower + (package + (name "upower") + (version "0.99.2") + (source + (origin + (method url-fetch) + (uri (string-append "http://upower.freedesktop.org/releases/" + name "-" version ".tar.xz")) + (sha256 + (base32 + "0vwlh20jmaf01m38kfn8yx2869a3clmkzlycrj99rf4nvwx4bp79")) + (patches (list (search-patch "upower-builddir.patch"))))) + (build-system glib-or-gtk-build-system) + (arguments + '(;; The tests want to contact the system bus, which can't be done in the + ;; build environment. The integration test can run, but the last of + ;; the up-self-tests doesn't. Disable tests for now. + #:tests? #f + #:configure-flags (list "--localstatedir=/var" + (string-append "--with-udevrulesdir=" + (assoc-ref %outputs "out") + "/lib/udev/rules.d")) + #:phases + (modify-phases %standard-phases + (add-before configure patch-/bin/true + (lambda _ + (substitute* "configure" + (("/bin/true") (which "true"))))) + (add-before configure patch-integration-test + (lambda _ + (substitute* "src/linux/integration-test" + (("/usr/bin/python3") (which "python3")))))))) + (native-inputs + `(("pkg-config" ,pkg-config) + ("intltool" ,intltool) + ("python" ,python))) + (inputs + `(("eudev" ,eudev) + ("dbus" ,dbus) + ("dbus-glib" ,dbus-glib) + ("libusb" ,libusb) + )) + (home-page "http://upower.freedesktop.org/") + (synopsis "System daemon for managing power devices") + (description + "UPower is an abstraction for enumerating power devices, +listening to device events and querying history and statistics. Any +application or service on the system can access the org.freedesktop.UPower +service via the system message bus.") + (license license:gpl2+))) diff --git a/gnu/packages/patches/upower-builddir.patch b/gnu/packages/patches/upower-builddir.patch new file mode 100644 index 0000000..13cef58 --- /dev/null +++ b/gnu/packages/patches/upower-builddir.patch @@ -0,0 +1,44 @@ +Remove explicit set of UPOWER_CONF_FILE_NAME in up-self-test.c; +instead the harness should set it. In Guix we set it explicitly; the +right thing is to use AM_TEST_ENVIRONMENT and regenerate the +makefiles, but we can't regenerate because current autotools carp on +some things, so we patch the Makefile.in instead. + +Also fix to not try to create /var/lib/upower if /var isn't writable. + +Patch by Andy Wingo + +--- upower-0.99.2.orig/src/Makefile.in 2014-12-18 10:32:01.000000000 +0100 ++++ upower-0.99.2/src/Makefile.in 2015-04-04 19:49:28.020843678 +0200 +@@ -780,6 +780,7 @@ + + @UP_BUILD_TESTS_TRUE@up_self_test_CFLAGS = $(AM_CFLAGS) $(WARNINGFLAGS_C) + @UP_BUILD_TESTS_TRUE@TESTS_ENVIRONMENT = $(DBUS_LAUNCH) ++@UP_BUILD_TESTS_TRUE@AM_TESTS_ENVIRONMENT = UPOWER_CONF_FILE_NAME=$(top_srcdir)/etc/UPower.conf + dbusservicedir = $(datadir)/dbus-1/system-services + dbusservice_in_files = org.freedesktop.UPower.service.in + dbusservice_DATA = $(dbusservice_in_files:.service.in=.service) +@@ -1789,7 +1790,7 @@ + @HAVE_SYSTEMDSYSTEMUNITDIR_TRUE@ @sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ + + install-data-hook: +- if test -w $(DESTDIR)$(prefix)/; then \ ++ if test -w $(DESTDIR)$(localstatedir)/; then \ + mkdir -p $(DESTDIR)$(historydir); \ + fi + +--- upower-0.99.2.orig/src/up-self-test.c 2014-07-17 09:46:15.000000000 +0200 ++++ upower-0.99.2/src/up-self-test.c 2015-04-04 18:43:04.952741927 +0200 +@@ -295,12 +295,6 @@ + #endif + g_test_init (&argc, &argv, NULL); + +- /* make check, vs. make distcheck */ +- if (g_file_test ("../etc/UPower.conf", G_FILE_TEST_EXISTS)) +- g_setenv ("UPOWER_CONF_FILE_NAME", "../etc/UPower.conf", TRUE); +- else +- g_setenv ("UPOWER_CONF_FILE_NAME", "../../etc/UPower.conf", TRUE); +- + /* tests go here */ + g_test_add_func ("/power/backend", up_test_backend_func); + g_test_add_func ("/power/device", up_test_device_func); -- 2.2.1