summary refs log tree commit diff
path: root/gnu/packages/file-systems.scm
diff options
context:
space:
mode:
authorHilton Chain <hako@ultrarare.space>2022-12-23 14:35:03 +0800
committerLudovic Courtès <ludo@gnu.org>2023-01-17 16:05:21 +0100
commit8d4c893ab5be6ca1a6082d0c6328af93f927b506 (patch)
tree798540f59a0103dfce0d00a824dc4bc65b3e4ff3 /gnu/packages/file-systems.scm
parentf2deb6c18a023caa4b023627a156e331003d416f (diff)
downloadguix-8d4c893ab5be6ca1a6082d0c6328af93f927b506.tar.gz
gnu: Add bees.
* gnu/packages/patches/bees-beesd-honor-destdir-on-installation.patch: New
file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/file-systems.scm (bees): New variable.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/packages/file-systems.scm')
-rw-r--r--gnu/packages/file-systems.scm73
1 files changed, 73 insertions, 0 deletions
diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm
index c462daf995..1403528426 100644
--- a/gnu/packages/file-systems.scm
+++ b/gnu/packages/file-systems.scm
@@ -81,6 +81,7 @@
   #:use-module (gnu packages rsync)
   #:use-module (gnu packages sssd)
   #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages textutils)
   #:use-module (gnu packages time)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages valgrind)
@@ -1790,3 +1791,75 @@ and rewritable media that wears out (DVD/CD-RW).")
     (description "This package provides an implementation of overlay+shiftfs
 in FUSE for rootless containers.")
     (license license:gpl3)))
+
+(define-public bees
+  (package
+    (name "bees")
+    (version "0.8")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/Zygo/bees")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Unbundle cityhash.
+               #~(begin
+                   (for-each delete-file
+                             '("lib/city.cc" "include/crucible/city.h"))
+                   (substitute* "lib/Makefile"
+                     (("city.o.*") ""))
+                   (substitute* "src/bees-hash.cc"
+                     (("#include .crucible/city.h.") "#include <city.h>"))))
+              (patches
+               (search-patches
+                ;; XXX: Cherry-picked from upstream, remove the patch when
+                ;; bumping version.
+                "bees-beesd-honor-destdir-on-installation.patch"))
+              (sha256
+               (base32
+                "1kxpz1p9k5ir385kpvmfjawki5vg22hlx768k7835w6n5z5a65y4"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list #:test-target "test"
+           #:make-flags
+           #~(list (string-append "CC=" #$(cc-for-target))
+                   (string-append "DESTDIR=" #$output)
+                   (string-append "BEES_VERSION=" #$version)
+                   "PREFIX=''")
+           #:phases
+           #~(modify-phases %standard-phases
+               (delete 'configure)
+               (add-after 'unpack 'fixpath
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   (substitute* "scripts/beesd.in"
+                     (((string-append "\\<(" (string-join (list "realpath"
+                                                                "uuidparse"
+                                                                "grep"
+                                                                "false"
+                                                                "sed"
+                                                                "true"
+                                                                "head"
+                                                                "mkdir"
+                                                                "mount"
+                                                                "touch"
+                                                                "du"
+                                                                "cut"
+                                                                "rm"
+                                                                "truncate"
+                                                                "chmod")
+                                                          "|") ")\\>") command)
+                      (search-input-file inputs (string-append "/bin/" command)))
+
+                     (("btrfs sub")
+                      (string-append (search-input-file inputs "/bin/btrfs") " sub"))))))))
+    (inputs (list btrfs-progs cityhash util-linux))
+    (home-page "https://github.com/Zygo/bees")
+    (synopsis "Best-Effort Extent-Same, a btrfs dedupe agent")
+    (description
+     "@code{bees} is a block-oriented userspace deduplication agent designed
+for large btrfs filesystems.  It is an offline dedupe combined with an
+incremental data scan capability to minimize time data spends on disk from
+write to dedupe.")
+    (license license:gpl3+)))