[PATCH] gnu: bcachefs-tools: Update to 1.11.0.

  • Open
  • quality assurance status badge
Details
One participant
  • Tobias Geerinckx-Rice
Owner
unassigned
Submitted by
Tobias Geerinckx-Rice
Severity
normal
T
T
Tobias Geerinckx-Rice wrote on 12 Sep 23:33 +0200
(address . guix-patches@gnu.org)
b828946ffd39464e6daabb06313ab47a64f7a055.1726176837.git.me@tobias.gr
* gnu/packages/crates-io.scm (rust-rustix-for-bcachefs-tools):
New public variable.
* gnu/packages/file-systems.scm (bcachefs-tools-rust-target)
(bcachefs-tools-target/release, bcachefs-tools-cargo-args)
(bcachefs-tools-make-flags, bcachefs-tools-make-install-flags):
New variables.
(bcachefs-tools): Update to 1.11.0.
[build-system]: Switch to Cargo.
[arguments]: Remove #:make-flags. Add Cargo keywords.
Run the test suite with upstream defaults.
Delete 'promote-mount.bcachefs.sh phase.
[native-inputs]: Remove python, python-docutils, python-pytest,
and valgrind.
[inputs]: Remove bash-minimal, coreutils-minimal, gawk, and util-linux.
Add clang.
(bcachefs-tools/static): Modify #:phases instead of #:make-flags,
and adjust accordingly.

Change-Id: I872f5dea88b75f855f3cdcbffbbd9c70d7ebe8d6
---
gnu/packages/crates-io.scm | 16 ++-
gnu/packages/file-systems.scm | 190 +++++++++++++++++++++-------------
2 files changed, 134 insertions(+), 72 deletions(-)

Toggle diff (296 lines)
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 0cdb071ea0..c08ccd29fd 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -66141,7 +66141,7 @@ (define-public rust-rusticata-macros-4
(define-public rust-rustix-0.38
(package
(name "rust-rustix")
- (version "0.38.31")
+ (version "0.38.31") ;XXX drop rust-rustix-for-bcachefs-tools when updating
(source
(origin
(method url-fetch)
@@ -66195,6 +66195,20 @@ (define-public rust-rustix-0.38
;; Apache 2.0, Apache 2.0 with LLVM exception, or Expat.
(license (list license:asl2.0 license:expat))))
+(define-public rust-rustix-for-bcachefs-tools
+ ;; The package above is too old; too many dependents to update it directly.
+ (package
+ (inherit rust-rustix-0.38)
+ (name (package-name rust-rustix-0.38))
+ (version "0.38.34")
+ (source
+ (origin
+ (inherit (package-source rust-rustix-0.38))
+ (uri (crate-uri "rustix" version))
+ (file-name (string-append name "-" version ".tar.gz"))
+ (sha256
+ (base32 "03vkqa2ism7q56rkifyy8mns0wwqrk70f4i4fd53r97p8b05xp3h"))))))
+
(define-public rust-rustix-0.37
(package
(inherit rust-rustix-0.38)
diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm
index c6a49a6bc0..a5020e1f87 100644
--- a/gnu/packages/file-systems.scm
+++ b/gnu/packages/file-systems.scm
@@ -34,8 +34,10 @@ (define-module (gnu packages file-systems)
#:use-module (guix gexp)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
+ #:use-module (guix platform)
#:use-module (guix download)
#:use-module (guix git-download)
+ #:use-module (guix build-system cargo)
#:use-module (guix build-system cmake)
#:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
@@ -58,6 +60,7 @@ (define-module (gnu packages file-systems)
#:use-module (gnu packages check)
#:use-module (gnu packages compression)
#:use-module (gnu packages cpp)
+ #:use-module (gnu packages crates-io)
#:use-module (gnu packages crypto)
#:use-module (gnu packages curl)
#:use-module (gnu packages cyrus-sasl)
@@ -85,6 +88,7 @@ (define-module (gnu packages file-systems)
#:use-module (gnu packages libffi)
#:use-module (gnu packages libunwind)
#:use-module (gnu packages linux)
+ #:use-module (gnu packages llvm)
#:use-module (gnu packages maths)
#:use-module (gnu packages man)
#:use-module (gnu packages m4)
@@ -589,10 +593,39 @@ (define-public gphotofs
(home-page "http://www.gphoto.org/proj/gphotofs/")
(license license:gpl2+)))
+(define bcachefs-tools-rust-target
+ (platform-rust-target (lookup-platform-by-target-or-system
+ (or (%current-target-system)
+ (%current-system)))))
+
+(define bcachefs-tools-target/release
+ (string-append "target/" bcachefs-tools-rust-target "/release"))
+
+(define bcachefs-tools-cargo-args
+ ;; Distinct from -MAKE-FLAGS for use with ‘cargo test’ in 'check.
+ #~(list "--release"
+ (string-append "--target=" #$bcachefs-tools-rust-target)))
+
+;; XXX We want to share common make flags across different packages & phases,
+;; but the cargo-build-system doesn't allow #:make-flags.
+(define bcachefs-tools-make-flags
+ ;; These result of these flags should be as minimal as possible.
+ ;; Enable any optional features in the bcachefs-tools package instead.
+ #~(list (string-append "CARGO_BUILD_ARGS="
+ (string-join #$bcachefs-tools-cargo-args " "))
+ (string-append "CC=" #$(cc-for-target))
+ (string-append "PKG_CONFIG=" #$(pkg-config-for-target))))
+
+(define bcachefs-tools-make-install-flags
+ #~(cons* (string-append "PREFIX=" #$output)
+ "INITRAMFS_DIR=$(PREFIX)/share/initramfs-tools"
+ "PKGCONFIG_UDEVRULESDIR=$(PREFIX)/lib/udev/rules.d"
+ #$bcachefs-tools-make-flags))
+
(define-public bcachefs-tools
(package
(name "bcachefs-tools")
- (version "1.4.1")
+ (version "1.11.0")
(source
(origin
(method git-fetch)
@@ -601,84 +634,74 @@ (define-public bcachefs-tools
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
- (base32 "0axwbckqrw1v3v50nzhpkvpyjbjwy3rq5bv23db84x3xia497apq"))))
- (build-system gnu-build-system)
+ (base32 "0m6z8z1cv78ay9yspypgr0kv70ck4wpln5n44f6n57i7sihqhrrg"))))
+ (build-system cargo-build-system)
(arguments
- (list #:make-flags
- #~(list (string-append "VERSION=" #$version) ; ‘v…-nogit’ otherwise
- (string-append "PREFIX=" #$output)
- "INITRAMFS_DIR=$(PREFIX)/share/initramfs-tools"
- "PKGCONFIG_UDEVRULESDIR=$(PREFIX)/lib/udev/rules.d"
- (string-append "CC=" #$(cc-for-target))
- (string-append "PKG_CONFIG=" #$(pkg-config-for-target))
- ;; ‘This will be less of an option in the future, as more
- ;; code gets rewritten in Rust.’
- "NO_RUST=better")
- #:phases
- #~(modify-phases %standard-phases
- (delete 'configure) ; no configure script
- (replace 'check
- ;; The test suite is moribund upstream (‘never been useful’),
- ;; but let's keep running it as a sanity check until then.
- (lambda* (#:key tests? make-flags #:allow-other-keys)
- (when tests?
- ;; We must manually build the test_helper first.
- (apply invoke "make" "tests" make-flags)
- (invoke (string-append
- #$(this-package-native-input "python-pytest")
- "/bin/pytest") "-k"
- ;; These fail (‘invalid argument’) on kernels
- ;; with a previous bcachefs version.
- (string-append "not test_format and "
- "not test_fsck and "
- "not test_list and "
- "not test_list_inodes and "
- "not test_list_dirent")))))
- (add-after 'install 'promote-mount.bcachefs.sh
- ;; The (optional) ‘mount.bcachefs’ requires rust:cargo.
- ;; This shell alternative does the job well enough for now.
- (lambda* (#:key inputs #:allow-other-keys)
- (define (whence file)
- (dirname (search-input-file inputs file)))
- (let ((mount (string-append #$output
- "/sbin/mount.bcachefs")))
- (delete-file mount) ; symlink to ‘bcachefs’
- (copy-file "mount.bcachefs.sh" mount)
- ;; WRAP-SCRIPT causes bogus ‘Insufficient arguments’ errors.
- (wrap-program mount
- `("PATH" ":" prefix
- ,(list (getcwd)
- (whence "bin/tail")
- (whence "bin/awk")
- (whence "bin/mount"))))))))))
+ (list
+ #:install-source? #f
+ ;; The Makefile CCs *every* C file anywhere beneath the build directory,
+ ;; even in Rust crates, creating ludicrous and totally bogus dependencies
+ ;; such as the Android SDK. Put our crates elsewhere.
+ #:vendor-dir "../guix-vendor"
+ #:cargo-inputs
+ `(("rust-aho-corasick" ,rust-aho-corasick-1)
+ ("rust-anstream" ,rust-anstream-0.6)
+ ("rust-anstyle" ,rust-anstyle-1)
+ ("rust-anstyle-parse" ,rust-anstyle-parse-0.2)
+ ("rust-anyhow" ,rust-anyhow-1)
+ ("rust-autocfg" ,rust-autocfg-1)
+ ("rust-bitfield" ,rust-bitfield-0.14)
+ ("rust-clap" ,rust-clap-4)
+ ("rust-clap-complete" ,rust-clap-complete-4)
+ ("rust-either" ,rust-either-1)
+ ("rust-errno" ,rust-errno-0.2)
+ ("rust-env-logger" ,rust-env-logger-0.10)
+ ("rust-libc" ,rust-libc-0.2)
+ ("rust-log" ,rust-log-0.4)
+ ("rust-memoffset" ,rust-memoffset-0.8)
+ ("rust-owo-colors" ,rust-owo-colors-4)
+ ("rust-rustix" ,rust-rustix-for-bcachefs-tools)
+ ("rust-strum" ,rust-strum-0.26)
+ ("rust-strum-macros" ,rust-strum-macros-0.26)
+ ("rust-udev" ,rust-udev-0.7)
+ ("rust-uuid" ,rust-uuid-1)
+ ("rust-zeroize" ,rust-zeroize-1))
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'build
+ (lambda* (#:key parallel-build? #:allow-other-keys)
+ (apply invoke "make"
+ "-j" (if parallel-build?
+ (number->string (parallel-job-count))
+ "1")
+ (string-append "VERSION=" #$version)
+ #$bcachefs-tools-make-flags)))
+ (add-before 'install 'patch-install
+ ;; ‘make install’ hard-codes target/release/bcachefs, which is
+ ;; incorrect when passing --target, as required to cross-compile or
+ ;; even just link statically. We always pass it, so always patch.
+ (lambda _
+ (substitute* "Makefile"
+ (("target/release")
+ #$bcachefs-tools-target/release))))
+ (replace 'install
+ (lambda _
+ (apply invoke "make" "install"
+ #$bcachefs-tools-make-install-flags))))))
(native-inputs
- (cons* pkg-config
- ;; For generating documentation with rst2man.
- python
- python-docutils
- ;; For tests.
- python-pytest
- (if (member (%current-system) (package-supported-systems valgrind))
- (list valgrind)
- '())))
+ (list pkg-config))
(inputs
- (list bash-minimal
+ (list clang
eudev
keyutils
libaio
libscrypt
libsodium
liburcu
- `(,util-linux "lib")
+ `(,util-linux "lib") ;libblkid
lz4
zlib
- `(,zstd "lib")
-
- ;; Only for mount.bcachefs.sh.
- bash-minimal
- coreutils-minimal
- gawk
- util-linux))
+ `(,zstd "lib")))
(home-page "https://bcachefs.org/")
(synopsis "Tools to create and manage bcachefs file systems")
(description
@@ -701,9 +724,34 @@ (define-public bcachefs-tools/static
(name "bcachefs-tools-static")
(arguments
(substitute-keyword-arguments (package-arguments bcachefs-tools)
- ((#:make-flags make-flags)
- #~(append #$make-flags
- (list "LDFLAGS=-static")))))
+ ((#:phases phases #~%standard-phases)
+ #~(modify-phases #$phases
+ (add-after 'configure 'set-rust-flags
+ (lambda _
+ (setenv "RUSTFLAGS" (string-join
+ '("-C" "link-arg=-z"
+ "-C" "link-arg=muldefs"
+ "-C" "target-feature=+crt-static"
+ "-C" "relocation-model=static")
+ " "))))
+ (replace 'build
+ (lambda* (#:key parallel-build? #:allow-other-keys)
+ (apply invoke "make"
+ "-j" (if parallel-build?
+ (number->string (parallel-job-count))
+ "1")
+ (string-append "VERSION="
+ #$(package-version this-package))
+ #$bcachefs-tools-make-flags)))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (apply invoke "cargo" "test" #$bcachefs-tools-cargo-args))))
+ (replace 'install
+ (lambda _
+ (apply invoke "make" "install"
+ (string-append "PREFIX=" #$output)
+ #$bcachefs-tools-make-install-flags)))))))
(inputs (modify-inputs (package-inputs bcachefs-tools)
(prepend `(,eudev "static")
`(,keyutils "static")

base-commit: 191e0f9e5214783f8261ef9b6325abfff834ecbc
prerequisite-patch-id: 5e305d35139259ba5f9f91c562c22b926bf9e801
prerequisite-patch-id: 2aa756ea2c34fed8b4cb5dcde72fa558a396d3bd
prerequisite-patch-id: 5a5eb3c0f4ce59d4ce340a14bb697b3f1d189e71
prerequisite-patch-id: 241cb117acd301ac875feea5574544adb9e2abf4
prerequisite-patch-id: 5b7fb5afed6a45b653178002c3bc17c6d3015566
prerequisite-patch-id: 4fc8aac18afc1b417e3c9825015f6013a7d31209
--
2.46.0
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 73212@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 73212
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch