all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Hilton Chain via Guix-patches via <guix-patches@gnu.org>
To: 60250@debbugs.gnu.org
Cc: Adam Faiz <adam.faiz@disroot.org>
Subject: [bug#60250] [PATCH v2] gnu: Add bees.
Date: Fri, 23 Dec 2022 14:35:03 +0800	[thread overview]
Message-ID: <874jtm7hm0.wl-hako@ultrarare.space> (raw)
In-Reply-To: <875ye27i1p.wl-hako@ultrarare.space>

* 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.
---
v1 -> v2:
1. Unbundle cityhash.
2. Patch beesd.in for DESTDIR handling.
3. Modify beesd.in to use absolute paths of commands.

 gnu/local.mk                                  |  1 +
 gnu/packages/file-systems.scm                 | 73 +++++++++++++++++++
 ...-beesd-honor-destdir-on-installation.patch | 40 ++++++++++
 3 files changed, 114 insertions(+)
 create mode 100644 gnu/packages/patches/bees-beesd-honor-destdir-on-installation.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 45d05de02d..a733d296bd 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -935,6 +935,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/bsd-games-prevent-name-collisions.patch	\
   %D%/packages/patches/bsd-games-stdio.h.patch			\
   %D%/packages/patches/beancount-disable-googleapis-fonts.patch	\
+  %D%/packages/patches/bees-beesd-honor-destdir-on-installation.patch	\
   %D%/packages/patches/beignet-correct-file-names.patch		\
   %D%/packages/patches/bidiv-update-fribidi.patch		\
   %D%/packages/patches/binutils-2.37-file-descriptor-leak.patch	\
diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm
index 57a25a0d90..b7c681d1fb 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)
@@ -1766,3 +1767,75 @@ (define-public udftools
 and other optical media.  It supports read-only media (DVD/CD-R)
 and rewritable media that wears out (DVD/CD-RW).")
     (license license:gpl2+)))
+
+(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+)))
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..4800bfc618
--- /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 <hako@ultrarare.space>
+Date: Fri, 23 Dec 2022 11:04:46 +0800
+Subject: [PATCH] beesd: Honor DESTDIR on installation.
+
+Co-authored-by: Adam Faiz <adam.faiz@disroot.org>
+Signed-off-by: Hilton Chain <hako@ultrarare.space>
+---
+ 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
+

base-commit: 1b29fccff2334fb5d6e979a290233a452969e39b
--
2.38.1




  reply	other threads:[~2022-12-23  6:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-22  8:19 [bug#60250] [PATCH] gnu: Add bees Hilton Chain via Guix-patches via
2022-12-22 18:52 ` Adam Faiz via Guix-patches via
2022-12-23  6:25   ` Hilton Chain via Guix-patches via
2022-12-23  6:35     ` Hilton Chain via Guix-patches via [this message]
2023-01-17 15:02       ` bug#60250: " Ludovic Courtès
2022-12-23  7:57     ` [bug#60250] " Adam Faiz via Guix-patches via
2022-12-24 11:34       ` Hilton Chain via Guix-patches via
2022-12-24 16:31         ` Adam Faiz via Guix-patches via
2022-12-22 19:22 ` Adam Faiz via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874jtm7hm0.wl-hako@ultrarare.space \
    --to=guix-patches@gnu.org \
    --cc=60250@debbugs.gnu.org \
    --cc=adam.faiz@disroot.org \
    --cc=hako@ultrarare.space \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.