summary refs log tree commit diff
path: root/gnu/packages/disk.scm
diff options
context:
space:
mode:
authorPierre Neidhardt <mail@ambrevar.xyz>2019-01-07 14:28:46 +0100
committerPierre Neidhardt <mail@ambrevar.xyz>2019-01-07 14:32:44 +0100
commit3b451546ed9d3f858bfb213eabafdfc3dd4c130f (patch)
treeb0e87e2e20fca7d2c2ba37d71fae6aea2c8882e6 /gnu/packages/disk.scm
parente0aa5b5bbfd0b261d322ba8b0892c45e9434230c (diff)
downloadguix-3b451546ed9d3f858bfb213eabafdfc3dd4c130f.tar.gz
gnu: Add rmlint.
* gnu/packages/disk.scm (rmlint): New variable.
Diffstat (limited to 'gnu/packages/disk.scm')
-rw-r--r--gnu/packages/disk.scm72
1 files changed, 71 insertions, 1 deletions
diff --git a/gnu/packages/disk.scm b/gnu/packages/disk.scm
index 4c4a3b849f..33dba016ca 100644
--- a/gnu/packages/disk.scm
+++ b/gnu/packages/disk.scm
@@ -12,7 +12,7 @@
 ;;; Copyright © 2018 Vasile Dumitrascu <va511e@yahoo.com>
 ;;; Copyright © 2018 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2018 Rutger Helling <rhelling@mykolab.com>
-;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
+;;; Copyright © 2018, 2019 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -41,6 +41,7 @@
   #:use-module (gnu packages databases)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages elf)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
@@ -63,6 +64,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (guix build-system trivial)
+  #:use-module (guix build-system scons)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module ((guix licenses) #:prefix license:)
@@ -748,3 +750,71 @@ 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.8.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
+                "1gc7gbnh0qg1kl151cv1ld87vhpm1v3pnkn7prhscdcc21jrg8nz"))))
+    (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:
+             ;; <http://comments.gmane.org/gmane.linux.distributions.nixos/4969>
+             ;; 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 filesystem")
+    (description "@command{rmlint} finds space waste and other broken things
+on your filesystem 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+)))