;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013 Nikita Karetnikov ;;; Copyright © 2015 Mathieu Lirzin ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2016, 2018, 2019 Tobias Geerinckx-Rice ;;; Copyright © 2016, 2019 Efraim Flashner ;;; Copyright © 2016 Jan Nieuwenhuizen ;;; Copyright © 2016 Roel Janssen ;;; Copyright © 2016, 2017 Marius Bakke ;;; Copyright © 2017 Hartmut Goebel ;;; Copyright © 2017 Stefan Reichör ;;; Copyright © 2018 Vasile Dumitrascu ;;; Copyright © 2018 Eric Bavier ;;; Copyright © 2018 Rutger Helling ;;; Copyright © 2018, 2019 Pierre Neidhardt ;;; Copyright © 2019 Leo Famulari ;;; Copyright © 2019 Pierre Langlois
aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (tests services configuration)
  #:use-module (gnu services configuration)
  #:use-module (guix diagnostics)
  #:use-module (guix gexp)
  #:autoload (guix i18n) (G_)
  #:use-module (srfi srfi-34)
  #:use-module (srfi srfi-64))

;;; Tests for the (gnu services configuration) module.

(test-begin "services-configuration")

(define (serialize-number field value)
  (format #f "~a=~a" field value))


;;;
;;; define-configuration macro.
;;;

(define-configuration port-configuration
  (port (number 80) "The port number.")
  (no-serialization))

(test-equal "default value, no serialization"
  80
  (port-configuration-port (port-configuration)))

(test-equal "wrong type for a field"
  '("configuration.scm" 59 11)                    ;error location
  (guard (c ((configuration-error? c)
             (let ((loc (error-location c)))
               (list (basename (location-file loc))
                     (location-line loc)
                     (location-column loc)))))
    (port-configuration
     ;; This is line 58; the test relies on line/column numbers!
     (port "This is not a number!"))))

(define-configuration port-configuration-cs
  (port (number 80) "The port number." empty-serializer))

(test-equal "default value, custom serializer"
  80
  (port-configuration-cs-port (port-configuration-cs)))

(define-configuration port-configuration-ndv
  (port (number) "The port number."))

(test-equal "no default value, provided"
  55
  (port-configuration-ndv-port (port-configuration-ndv
                                (port 55))))

(test-assert "no default value, not provided"
  (guard (c ((configuration-error? c)
             #t))
    (port-configuration-ndv-port (port-configuration-ndv))))

(define (custom-number-serializer name value)
  (format #f "~a = ~a;" name value))

(define-configuration serializable-configuration
  (port (number 80) "The port number." (serializer custom-number-serializer)))

(define-configuration serializable-configuration-deprecated
  (port (number 80) "The port number." custom-number-serializer))

(test-assert "serialize-configuration"
  (gexp?
   (let ((config (serializable-configuration)))
     (serialize-configuration config serializable-configuration-fields))))

(test-assert "serialize-configuration [deprecated]"
  (gexp?
   (let ((config (serializable-configuration-deprecated)))
     (serialize-configuration
      config serializable-configuration-deprecated-fields))))

(define-configuration serializable-configuration
  (port (number 80) "The port number." (serializer custom-number-serializer))
  (no-serialization))

(test-assert "serialize-configuration with no-serialization"
  ;; When serialization is disabled, the serializer is set to #f, so
  ;; attempting to use it fails with a 'wrong-type-arg' error.
  (not (false-if-exception
        (let ((config (serializable-configuration)))
          (serialize-configuration config serializable-configuration-fields)))))

(define (custom-prefix-serialize-integer field-name name) name)

(define-configuration configuration-with-prefix
  (port (integer 10) "The port number.")
  (prefix custom-prefix-))

(test-assert "serialize-configuration with prefix"
  (gexp?
   (let ((config (configuration-with-prefix)))
     (serialize-configuration config configuration-with-prefix-fields))))


;;;
;;; define-configuration macro, extra-args literals
;;;

(define (eval-gexp x)
  "Get serialized config as string."
  (eval (gexp->approximate-sexp x)
        (current-module)))

(define (port? value)
  (or (string? value) (number? value)))

(define (sanitize-port value)
  (cond ((number? value) value)
        ((string? value) (string->number value))
        (else (raise (formatted-message (G_ "Bad value: ~a") value)))))

(test-group "Basic sanitizer literal tests"
  (define serialize-port serialize-number)

  (define-configuration config-with-sanitizer
    (port
     (port 80)
     "Lorem Ipsum."
     (sanitizer sanitize-port)))

  (test-equal "default value, sanitizer"
    80
    (config-with-sanitizer-port (config-with-sanitizer)))

  (test-equal "string value, sanitized to number"
    56
    (config-with-sanitizer-port (config-with-sanitizer
                                 (port "56"))))

  (define (custom-serialize-port field-name value)
    (number->string value))

  (define-configuration config-serializer
    (port
     (port 80)
     "Lorem Ipsum."
     (serializer custom-serialize-port)))

  (test-equal "default value, serializer literal"
    "80"
    (eval-gexp
     (serialize-configuration (config-serializer)
                              config-serializer-fields))))

(test-group "empty-serializer as literal/procedure tests"
  (define-configuration config-with-literal
    (port
     (port 80)
     "Lorem Ipsum."
     empty-serializer))

  (define-configuration config-with-proc
    (port
     (port 80)
     "Lorem Ipsum."
     (serializer empty-serializer)))

  (test-equal "empty-serializer as literal"
    ""
    (eval-gexp
     (serialize-configuration (config-with-literal)
                              config-with-literal-fields)))

  (test-equal "empty-serializer as procedure"
    ""
    (eval-gexp
     (serialize-configuration (config-with-proc)
                              config-with-proc-fields))))

(test-group "permutation tests"
  (define-configuration config-san+empty-ser
    (port
     (port 80)
     "Lorem Ipsum."
     (sanitizer sanitize-port)
     empty-serializer))

  (define-configuration config-san+ser
    (port
     (port 80)
     "Lorem Ipsum."
     (sanitizer sanitize-port)
     (serializer (lambda _ "foo"))))

  (test-equal "default value, sanitizer, permutation"
    80
    (config-san+empty-ser-port (config-san+empty-ser)))

  (test-equal "default value, serializer, permutation"
    "foo"
    (eval-gexp
     (serialize-configuration (config-san+ser) config-san+ser-fields)))

  (test-equal "string value sanitized to number, permutation"
    56
    (config-san+ser-port (config-san+ser
                          (port "56"))))

  ;; Ordering tests.
  (define-configuration config-ser+san
    (port
     (port 80)
     "Lorem Ipsum."
     (sanitizer sanitize-port)
     (serializer (lambda _ "foo"))))

  (define-configuration config-empty-ser+san
    (port
     (port 80)
     "Lorem Ipsum."
     empty-serializer
     (sanitizer sanitize-port)))

  (test-equal "default value, sanitizer, permutation 2"
    56
    (config-empty-ser+san-port (config-empty-ser+san
                                (port "56"))))

  (test-equal "default value, serializer, permutation 2"
    "foo"
    (eval-gexp
     (serialize-configuration (config-ser+san) config-ser+san-fields))))

(test-group "duplicated/conflicting entries"
  (test-error
   "duplicate sanitizer" #t
   (macroexpand '(define-configuration dupe-san
                   (foo
                    (list '())
                    "Lorem Ipsum."
                    (sanitizer (lambda () #t))
                    (sanitizer (lambda () #t))))))

  (test-error
   "duplicate serializer" #t
   (macroexpand '(define-configuration dupe-ser
                   (foo
                    (list '())
                    "Lorem Ipsum."
                    (serializer (lambda _ ""))
                    (serializer (lambda _ ""))))))

  (test-error
   "conflicting use of serializer + empty-serializer" #t
   (macroexpand '(define-configuration ser+empty-ser
                   (foo
                    (list '())
                    "Lorem Ipsum."
                    (serializer (lambda _ "lorem"))
                    empty-serializer)))))

(test-group "Mix of deprecated and new syntax"
  (test-error
   "Mix of bare serializer and new syntax" #t
   (macroexpand '(define-configuration mixed
                   (foo
                    (list '())
                    "Lorem Ipsum."
                    (sanitizer (lambda () #t))
                    (lambda _ "lorem")))))

  (test-error
   "Mix of bare serializer and new syntax, permutation)" #t
   (macroexpand '(define-configuration mixed
                   (foo
                    (list '())
                    "Lorem Ipsum."
                    (lambda _ "lorem")
                    (sanitizer (lambda () #t)))))))


;;;
;;; define-maybe macro.
;;;
(define-maybe number)

(define-configuration config-with-maybe-number
  (port  (maybe-number 80) "")
  (count maybe-number ""))

(test-equal "maybe value serialization"
  "port=80"
  (serialize-maybe-number "port" 80))

(define (config-with-maybe-number->string x)
  (eval (gexp->approximate-sexp
         (serialize-configuration x config-with-maybe-number-fields))
        (current-module)))

(test-equal "maybe value serialization of the instance"
  "port=42count=43"
  (config-with-maybe-number->string
   (config-with-maybe-number
    (port 42)
    (count 43))))

(test-equal "maybe value serialization of the instance, unspecified"
  "port=42"
  (config-with-maybe-number->string
   (config-with-maybe-number
    (port 42))))

(define (serialize-symbol name value)
  (format #f "~a=~a~%" name value))

(define-maybe symbol)

(define-configuration config-with-maybe-symbol
  (protocol maybe-symbol ""))

(test-equal "symbol maybe value serialization, unspecified"
  ""
  (eval-gexp
   (serialize-configuration (config-with-maybe-symbol)
                            config-with-maybe-symbol-fields)))

(define-maybe/no-serialization string)

(define-configuration config-with-maybe-string/no-serialization
  (name (maybe-string) "The name of the item.")
  (no-serialization))

(test-assert "maybe value without serialization no procedure bound"
  (not (defined? 'serialize-maybe-string)))

(test-assert "maybe type, no default"
  (eq? %unset-value
       (config-with-maybe-string/no-serialization-name
        (config-with-maybe-string/no-serialization))))

(test-assert "maybe type, with default"
  (equal?
   "foo"
   (config-with-maybe-string/no-serialization-name
    (config-with-maybe-string/no-serialization
     (name "foo")))))
s ("pkg-config" ,pkg-config))) (home-page "https://gparted.org/") (synopsis "Partition editor to graphically manage disk partitions") (description "GParted is a GNOME partition editor for creating, reorganizing, and deleting disk partitions. It uses libparted from the parted project to detect and manipulate partition tables. Optional file system tools permit managing file systems not included in libparted.") ;; The home page says GPLv2, but the source code says GPLv2+. (license license:gpl2+))) (define-public pydf (package (name "pydf") (version "12") (source (origin (method url-fetch) (uri (pypi-uri "pydf" version)) (sha256 (base32 "0f8ly8xyp93i2hm9c0qjqd4y86nz73axw2f09z01mszwmg1sfivz")))) (build-system python-build-system) (home-page "http://kassiopeia.juls.savba.sk/~garabik/software/pydf/") (synopsis "Colourised @command{df} clone") (description "All-singing, all-dancing, fully colourised @command{df} clone written in Python. It displays the amount of disk space available on the mounted file systems, using different colours for different types of file systems. Output format is completely customizable.") (license license:public-domain))) (define-public f3 (package (name "f3") (version "7.2") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/AltraMayor/f3.git") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1iwdg0r4wkgc8rynmw1qcqz62l0ldgc8lrazq33msxnk5a818jgy")))) (build-system gnu-build-system) (arguments '(#:tests? #f ; no check target #:make-flags (list "CC=gcc" (string-append "PREFIX=" %output)) #:phases (modify-phases %standard-phases (delete 'configure) ; no configure script (add-after 'build 'build-extra (lambda* (#:key make-flags #:allow-other-keys) (apply invoke "make" "extra" make-flags))) (add-after 'build 'install-extra (lambda* (#:key make-flags #:allow-other-keys) (apply invoke "make" "install-extra" make-flags)))))) (inputs `(("eudev" ,eudev) ("parted" ,parted))) (home-page "http://oss.digirati.com.br/f3/") (synopsis "Test real capacity of flash memory cards and such.") (description "F3 (Fight Flash Fraud or Fight Fake Flash) tests the full capacity of a flash card (flash drive, flash disk, pendrive). F3 writes to the card and then checks if can read it. It will assure you haven't been sold a card with a smaller capacity than stated.") (license license:gpl3+))) (define-public python-parted (package (name "python-parted") (version "3.11.2") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/dcantrell/pyparted.git") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0r6916n3w4vldxrq30a3z2iagvxgly4vfmlidjm65vwqnyv17bvn")))) (build-system python-build-system) (arguments `(#:phases (modify-phases %standard-phases (delete 'check) (add-after 'install 'check (lambda* (#:key outputs inputs #:allow-other-keys) (add-installed-pythonpath inputs outputs) ;; See . (substitute* "tests/test__ped_ped.py" (("\"/tmp/temp-device-\"") "self.path")) (invoke "python" "-m" "unittest" "discover" "-v") #t))))) (native-inputs `(("e2fsprogs" ,e2fsprogs) ("pkg-config" ,pkg-config))) (propagated-inputs `(("python-six" ,python-six))) (inputs `(("parted" ,parted))) (home-page "https://github.com/dcantrell/pyparted") (synopsis "Parted bindings for Python") (description "This package provides @code{parted} bindings for Python.") (license license:gpl2+))) (define-public python2-parted (package-with-python2 python-parted)) (define-public duperemove (package (name "duperemove") (version "0.11.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/markfasheh/duperemove.git") (commit (string-append "v" version)))) (sha256 (base32 "1scz76pvpljvrpfn176125xwaqwyy4pirlm11sc9spb2hyzknw2z")) (file-name (git-file-name name version)))) (build-system gnu-build-system) (native-inputs `(("pkg-config" ,pkg-config))) (inputs `(("glib" ,glib) ("sqlite" ,sqlite))) (arguments `(#:tests? #f ; no test suite #:phases (modify-phases %standard-phases (delete 'configure)) ; no configure script #:make-flags (list (string-append "PREFIX=" %output) "CC=gcc"))) (home-page "https://github.com/markfasheh/duperemove") (synopsis "Tools for de-duplicating file system data") (description "Duperemove is a simple tool for finding duplicated extents and submitting them for deduplication. When given a list of files it will hash their contents on a block by block basis and compare those hashes to each other, finding and categorizing blocks that match each other. When given the @option{-d} option, duperemove will submit those extents for deduplication using the Linux kernel extent-same @code{ioctl}. Duperemove can store the hashes it computes in a @dfn{hash file}. If given an existing hash file, duperemove will only compute hashes for those files which have changed since the last run. Thus you can run duperemove repeatedly on your data as it changes, without having to re-checksum unchanged data. Duperemove can also take input from the @command{fdupes} program.") (license license:gpl2))) (define-public ranger (package (name "ranger") (version "1.9.2") (source (origin (method url-fetch) (uri (string-append "https://ranger.github.io/" "ranger-" version ".tar.gz")) (sha256 (base32 "12kbsqakbxs09y0x8hy66mmaf72rk0p850x7ryk2ghkq7wfin78f")))) (build-system python-build-system) (inputs `(("w3m" ,w3m))) (native-inputs `(("which" ,which) ;; For tests. ("python-pytest" ,python-pytest))) (arguments '( ;; The 'test' target runs developer tools like pylint, which fail. #:test-target "test_pytest" #:phases (modify-phases %standard-phases (add-after 'configure 'wrap-program ;; Tell 'ranger' where 'w3mimgdisplay' is. (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (ranger (string-append out "/bin/ranger")) (w3m (assoc-ref inputs "w3m")) (w3mimgdisplay (string-append w3m "/libexec/w3m/w3mimgdisplay"))) (wrap-program ranger `("W3MIMGDISPLAY_PATH" ":" prefix (,w3mimgdisplay))) #t))) (replace 'check ;; The default check phase simply prints 'Ran 0 tests in 0.000s'. (lambda* (#:key test-target #:allow-other-keys) (invoke "make" test-target)))))) (home-page "https://ranger.github.io/") (synopsis "Console file manager") (description "ranger is a console file manager with Vi key bindings. It provides a minimalistic and nice curses interface with a view on the directory hierarchy. It ships with @code{rifle}, a file launcher that is good at automatically finding out which program to use for what file type.") (license license:gpl3))) (define-public volume-key (package (name "volume-key") (version "0.3.12") (source (origin (method url-fetch) (uri (string-append "https://releases.pagure.org/volume_key/volume_key-" version ".tar.xz")) (sha256 (base32 "16rhfz6sjwxlmss1plb2wv2i3jq6wza02rmz1d2jrlnsq67p98vc")))) (build-system gnu-build-system) (native-inputs `(("pkg-config" ,pkg-config) ("util-linux" ,util-linux) ("swig" ,swig) ("python" ,python-3))) ; used to generate the Python bindings (inputs `(("cryptsetup" ,cryptsetup) ("nss" ,nss) ("lvm2" ,lvm2) ; for "-ldevmapper" ("glib" ,glib) ("gpgme" ,gpgme))) (arguments `(#:tests? #f ; not sure how tests are supposed to pass, even when run manually #:phases (modify-phases %standard-phases (add-before 'configure 'patch-python.h-path (lambda* (#:key inputs #:allow-other-keys) (let ((python (assoc-ref inputs "python"))) (substitute* "Makefile.in" (("/usr/include/python") (string-append python "/include/python"))) #t)))))) (home-page "https://pagure.io/volume_key") (synopsis "Manipulate storage volume encryption keys") (description "This package provides a library for manipulating storage volume encryption keys and storing them separately from volumes to handle forgotten passphrases.") (license license:gpl2))) (define-public ndctl (package (name "ndctl") (version "67") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/pmem/ndctl.git") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "076jgw1g2aafqgnq705in0wnabysqk46dq5yxdv1qzgjmyhka39n")))) (build-system gnu-build-system) (native-inputs `(("asciidoc" ,asciidoc) ("automake" ,automake) ("autoconf" ,autoconf) ("bash-completion" ,bash-completion) ("docbook-xsl" ,docbook-xsl) ("libtool" ,libtool) ("libxml2" ,libxml2) ("pkg-config" ,pkg-config) ("xmlto" ,xmlto) ;; Required for offline docbook generation. ("which" ,which))) (inputs `(("eudev" ,eudev) ("json-c" ,json-c) ("keyutils" ,keyutils) ("kmod" ,kmod) ("util-linux" ,util-linux))) (arguments `(#:configure-flags (list "--disable-asciidoctor" ; use docbook-xsl instead "--without-systemd") #:phases (modify-phases %standard-phases (add-after 'unpack 'patch-FHS-file-names (lambda _ (substitute* "git-version-gen" (("/bin/sh") (which "sh"))) (substitute* "git-version" (("/bin/bash") (which "bash"))) #t))) #:make-flags (let ((out (assoc-ref %outputs "out"))) (list (string-append "BASH_COMPLETION_DIR=" out "/share/bash-completion/completions"))))) (home-page "https://github.com/pmem/ndctl") (synopsis "Manage the non-volatile memory device sub-system in the Linux kernel") (description "This package provides a utility library for managing the libnvdimm (non-volatile memory device) sub-system in the Linux kernel.") ;; COPYING says LGPL2.1, but many source files are GPL2 so that's ;; the effective license. Note that some files under ccan/ are ;; covered by BSD-3 or public domain, see the individual folders. (license license:gpl2))) (define-public dmraid (package (name "dmraid") (version "1.0.0.rc16-3") (source (origin (method url-fetch) (uri (string-append "https://people.redhat.com/~heinzm/sw/dmraid/src/dmraid-" version ".tar.bz2")) (sha256 (base32 "1n7vsqvh7y6yvil682q129d21yhb0cmvd5fvsbkza7ypd78inhlk")))) (build-system gnu-build-system) (inputs `(("lvm2" ,lvm2))) (native-inputs `(("which" ,which))) (arguments `(#:tests? #f ; No tests. ;; Prevent a race condition where some target would attempt to link ;; libdmraid.so before it had been built as reported in ;; . #:parallel-build? #f #:phases (modify-phases %standard-phases (add-before 'configure 'change-directory (lambda _ (chdir (string-append ,version "/dmraid")) (substitute* "make.tmpl.in" (("/bin/sh") (which "sh"))) #t))) #:configure-flags (list ;; Make sure programs such as 'dmevent_tool' can ;; find libdmraid.so. (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib")))) (home-page "https://people.redhat.com/~heinzm/sw/dmraid/") (synopsis "Device mapper RAID interface") (description "This software supports RAID device discovery, RAID set activation, creation, removal, rebuild and display of properties for ATARAID/DDF1 metadata. @command{dmraid} uses @file{libdevmapper} and the device-mapper kernel runtime to create devices with respective mappings for the ATARAID sets discovered.") (license license:gpl2+))) (define-public libblockdev (package (name "libblockdev") (version "2.23") (source (origin (method url-fetch) (uri (string-append "https://github.com/storaged-project/" "libblockdev/releases/download/" version "-1/libblockdev-" version ".tar.gz")) (sha256 (base32 "15c7g2gbkahmy8c6677pvbvblan5h8jxcqqmn6nlvqwqynq2mkjm")))) (build-system gnu-build-system) (native-inputs `(("pkg-config" ,pkg-config) ("python" ,python-wrapper) ("util-linux" ,util-linux))) (inputs `(("btrfs-progs" ,btrfs-progs) ("cryptsetup" ,cryptsetup) ("dosfstools" ,dosfstools) ("dmraid" ,dmraid) ("eudev" ,eudev) ("glib" ,glib) ("gobject-introspection" ,gobject-introspection) ("kmod" ,kmod) ("libbytesize" ,libbytesize) ("libyaml" ,libyaml) ("lvm2" ,lvm2) ("mdadm" ,mdadm) ("ndctl" ,ndctl) ("nss" ,nss) ("parted" ,parted) ("volume-key" ,volume-key) ;; ("xfsprogs" ,xfsprogs) ; TODO: Package? )) (home-page "https://github.com/storaged-project/libblockdev") (synopsis "Library for manipulating block devices") (description "libblockdev is a C library supporting GObject introspection for manipulation of block devices. It has a plugin-based architecture where each technology (like LVM, Btrfs, MD RAID, Swap...) is implemented in a separate plugin, possibly with multiple implementations (e.g. using LVM CLI or the new LVM D-Bus API).") (license license:lgpl2.1+))) (define-public rmlint (package (name "rmlint") (version "2.9.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/sahib/rmlint") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1b5cziam14h80xrfb285fmfrzz2rligxcpsq1xsig14xf4l2875i")))) (build-system scons-build-system) (arguments `(#:scons ,scons-python2 #:scons-flags (list (string-append "--prefix=" %output) (string-append "--actual-prefix=" %output)) #:tests? #f ; No tests? #:phases (modify-phases %standard-phases (add-after 'unpack 'scons-propagate-environment (lambda* (#:key inputs #:allow-other-keys) ;; TODO: `rmlint --gui` fails with ;; "Failed to load shredder: No module named 'shredder'". ;; The GUI might also need extra dependencies, such as ;; python-gobject, python-cairo, dconf, librsvg, gtksourceview3. (substitute* "lib/cmdline.c" (("const char \\*commands\\[\\] = \\{\"python3\", \"python\", NULL\\};") (string-append "const char *commands[] = {\"" (assoc-ref inputs "python") "/bin/python" "\", \"python\", NULL};"))) ;; By design, SCons does not, by default, propagate ;; environment variables to subprocesses. See: ;; ;; Here, we modify the SConstruct file to arrange for ;; environment variables to be propagated. (substitute* "SConstruct" (("^env = Environment\\(.*\\)" all) (string-append all "\nenv['ENV']=os.environ")))))))) (native-inputs `(("pkg-config" ,pkg-config) ("glib:bin" ,glib "bin") ("python-sphinx" ,python-sphinx))) (inputs `(("python" ,python-wrapper) ("glib" ,glib) ("libelf" ,libelf) ("elfutils" ,elfutils) ("json-glib" ,json-glib) ("libblkid" ,util-linux))) (home-page "https://rmlint.rtfd.org") (synopsis "Remove duplicates and other lint from the file system") (description "@command{rmlint} finds space waste and other broken things on your file system and offers to remove it. @command{rmlint} can find: @itemize @item duplicate files and duplicate directories, @item non-stripped binaries (i.e. binaries with debug symbols), @item broken symbolic links, @item empty files and directories, @item files with broken user and/or group ID. @end itemize\n") (license license:gpl3+)))