From 8d4c893ab5be6ca1a6082d0c6328af93f927b506 Mon Sep 17 00:00:00 2001 From: Hilton Chain Date: Fri, 23 Dec 2022 14:35:03 +0800 Subject: gnu: Add bees. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- gnu/packages/file-systems.scm | 73 ++++++++++++++++++++++ .../bees-beesd-honor-destdir-on-installation.patch | 40 ++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 gnu/packages/patches/bees-beesd-honor-destdir-on-installation.patch (limited to 'gnu/packages') 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 @@ (define-module (gnu packages file-systems) #: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 @@ (define-public fuse-overlayfs (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 ")))) + (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+))) diff --git a/gnu/packages/patches/bees-beesd-honor-destdir-on-installation.patch b/gnu/packages/patches/bees-beesd-honor-destdir-on-installation.patch new file mode 100644 index 0000000000..93817f42cf --- /dev/null +++ b/gnu/packages/patches/bees-beesd-honor-destdir-on-installation.patch @@ -0,0 +1,40 @@ +From 66b00f8a972ebb4da68f7aa0d0656f43ce2a2c3a Mon Sep 17 00:00:00 2001 +From: Hilton Chain +Date: Fri, 23 Dec 2022 11:04:46 +0800 +Subject: [PATCH] beesd: Honor DESTDIR on installation. + +Co-authored-by: Adam Faiz +Signed-off-by: Hilton Chain +--- + Defines.mk | 1 + + scripts/beesd.in | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Defines.mk b/Defines.mk +index 9e8df40..e5394ba 100644 +--- a/Defines.mk ++++ b/Defines.mk +@@ -2,6 +2,7 @@ MAKE += PREFIX=$(PREFIX) LIBEXEC_PREFIX=$(LIBEXEC_PREFIX) ETC_PREFIX=$(ETC_PREFI + + define TEMPLATE_COMPILER = + sed $< >$@ \ ++ -e's#@DESTDIR@#$(DESTDIR)#' \ + -e's#@PREFIX@#$(PREFIX)#' \ + -e's#@ETC_PREFIX@#$(ETC_PREFIX)#' \ + -e's#@LIBEXEC_PREFIX@#$(LIBEXEC_PREFIX)#' +diff --git a/scripts/beesd.in b/scripts/beesd.in +index 174bb6c..35d04aa 100755 +--- a/scripts/beesd.in ++++ b/scripts/beesd.in +@@ -15,7 +15,7 @@ readonly AL128K="$((128*1024))" + readonly AL16M="$((16*1024*1024))" + readonly CONFIG_DIR=@ETC_PREFIX@/bees/ + +-readonly bees_bin=$(realpath @LIBEXEC_PREFIX@/bees) ++readonly bees_bin=$(realpath @DESTDIR@/@LIBEXEC_PREFIX@/bees) + + command -v "$bees_bin" &> /dev/null || ERRO "Missing 'bees' agent" + +-- +2.38.1 + -- cgit v1.2.3