~ruther/guix-local

6a483ed7c607b01003edb9cb118c9f89c9d457e9 — Ian Eure a month ago 2c34e9c
gnu: collectd: Enable more plugins.

This enables the Python, SMART, and lm-sensors plugins for collectd.

* gnu/packages/patches/collectd-5.11.0-python-3.11.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add collectd-5.11.0-python-3.11.patch.
* gnu/packages/monitoring.scm (patches): Add
collectd-5.11.0-python-3.11.patch.
(arguments): Add --enable-python.
(native-inputs): Add python-3.
(arguments): Add --enable-smart.
(native-inputs): Add libatasmart.
(arguments): Add --enable-sensors.
(native-inputs): Add lm-sensors.

Change-Id: I40e059c7883ac29b74572b2c05e638d6fc47bc16
M gnu/local.mk => gnu/local.mk +2 -1
@@ 1121,7 1121,8 @@ dist_patch_DATA =						\
  %D%/packages/patches/coda-use-system-libs.patch		\
  %D%/packages/patches/cogl-fix-double-free.patch		\
  %D%/packages/patches/collada-dom-boost.patch			\
  %D%/packages/patches/collectd-5.11.0-noinstallvar.patch		\
  %D%/packages/patches/collectd-5.11.0-noinstallvar.patch	\
  %D%/packages/patches/collectd-5.11.0-python-3.11.patch	\
  %D%/packages/patches/combinatorial-blas-awpm.patch		\
  %D%/packages/patches/combinatorial-blas-io-fix.patch		\
  %D%/packages/patches/compsize-fix-btrfs-progs-compatibility.patch	\

M gnu/packages/monitoring.scm => gnu/packages/monitoring.scm +26 -5
@@ 55,6 55,7 @@
  #:use-module (gnu packages compression)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages django)
  #:use-module (gnu packages freedesktop) ; libatasmart
  #:use-module (gnu packages gd)
  #:use-module (gnu packages gettext)
  #:use-module (gnu packages gnome)               ;libnotify


@@ 68,6 69,7 @@
  #:use-module (gnu packages ncurses)
  #:use-module (gnu packages networking)
  #:use-module (gnu packages libevent)
  #:use-module (gnu packages linux)     ; eudev, lm-sensors
  #:use-module (gnu packages pcre)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages pkg-config)


@@ 822,20 824,39 @@ devices.")
              (sha256
               (base32
                "1mh97afgq6qgmpvpr84zngh58m0sl1b4wimqgvvk376188q09bjv"))
              (patches (search-patches "collectd-5.11.0-noinstallvar.patch"))))
              (patches (search-patches "collectd-5.11.0-noinstallvar.patch"
                                       "collectd-5.11.0-python-3.11.patch"))))
    (build-system gnu-build-system)
    (arguments
     `(#:configure-flags (list "--localstatedir=/var" "--sysconfdir=/etc"
                               "CFLAGS=-Wno-error=deprecated-declarations")
     `(#:configure-flags
       (list
        "--enable-python"
        "--enable-sensors"
        "--enable-smart"
        "--localstatedir=/var"
        "--sysconfdir=/etc"
        "CFLAGS=-Wno-error=deprecated-declarations")
       #:phases (modify-phases %standard-phases
                  (add-before 'configure 'autoreconf
                    (lambda _
                      ;; Required because of patched sources.
                      (invoke "autoreconf" "-vfi"))))))
    (inputs
     (list rrdtool curl yajl zlib))
     (list
      curl
      rrdtool
      yajl
      zlib))
    (native-inputs
     (list autoconf automake libtool pkg-config))
     (list
      autoconf
      automake
      eudev
      libatasmart
      libtool
      `(,lm-sensors "lib")
      pkg-config
      python-3))
    (home-page "https://collectd.org/")
    (synopsis "Collect system and application performance metrics periodically")
    (description

A gnu/packages/patches/collectd-5.11.0-python-3.11.patch => gnu/packages/patches/collectd-5.11.0-python-3.11.patch +30 -0
@@ 0,0 1,30 @@
commit 623e95394e0e62e7f9ced2104b786d21e9c0bf53
Author: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Date:   Wed Sep 21 22:21:58 2022 +0700

    cpython: fix build with Python 3.11
    
    Python 3.11 moves longintrepr.h into cpython sub-directory.
    However, in this version, longintrepr.h is always included.

diff --git a/src/cpython.h b/src/cpython.h
index 11e64fa6..bcfa406f 100644
--- a/src/cpython.h
+++ b/src/cpython.h
@@ -24,9 +24,15 @@
  *   Sven Trenkel <collectd at semidefinite.de>
  **/
 
+#include <Python.h>
 /* Some python versions don't include this by default. */
-
+#if PY_VERSION_HEX < 0x030B0000
+/*
+ * Python 3.11 move longintrepr.h to cpython/longintrepr.h
+ * And it's always included
+ */
 #include <longintrepr.h>
+#endif /* PY_VERSION_HEX < 0x030B0000 */
 
 /* These two macros are basically Py_BEGIN_ALLOW_THREADS and
  * Py_BEGIN_ALLOW_THREADS