From patchwork Thu Sep 12 21:33:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Geerinckx-Rice X-Patchwork-Id: 67898 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B262E27BBE9; Thu, 12 Sep 2024 22:35:17 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id DE82127BBE2 for ; Thu, 12 Sep 2024 22:35:14 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sorSu-0002uh-LD; Thu, 12 Sep 2024 17:35:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sorSo-0002tG-Up for guix-patches@gnu.org; Thu, 12 Sep 2024 17:34:55 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sorSo-00033S-LQ for guix-patches@gnu.org; Thu, 12 Sep 2024 17:34:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=F00RZg2mXSHxYw4crVjkqNB/qbXAkiS6q/YTZb4O3FQ=; b=O1DPqEg3IB6JzvAQcXZWXBn7BALzIgAGy+Db0Rs7Ajc7kHizDe4RdjNgRD85GjH6V9HCPZCuy6hOTK4+yIJiCvcGFIyg+rD+s0sA352mgpmpxdrLO5gCeQ5PSmJmnsiSc7CAYvoGdrfmm9hmXBPPXiiZRsObQ4gJ1frhk2FLXmNZul+SzomHL1VelEVK/US/plsYn7YcQDDLrCXSjDCHHmpM9i/3D0v0kkL1dzTGphGygDHA+tn9Q6t4sk/EH4VxS8BYxPWaQ0luOVyGMi3dsHuVkGIRhL2EThuGnmFBW1JacUdCtj5KVbH72KXECseu/E3ss6Qscb5JymaNzwzQ4g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sorSw-0003Pn-Bb for guix-patches@gnu.org; Thu, 12 Sep 2024 17:35:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73212] [PATCH] gnu: bcachefs-tools: Update to 1.11.0. Resent-From: Tobias Geerinckx-Rice Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 12 Sep 2024 21:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73212 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73212@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.172617687413072 (code B ref -1); Thu, 12 Sep 2024 21:35:02 +0000 Received: (at submit) by debbugs.gnu.org; 12 Sep 2024 21:34:34 +0000 Received: from localhost ([127.0.0.1]:42055 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sorST-0003Ol-GG for submit@debbugs.gnu.org; Thu, 12 Sep 2024 17:34:34 -0400 Received: from lists.gnu.org ([209.51.188.17]:43406) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sorSM-0003OX-BM for submit@debbugs.gnu.org; Thu, 12 Sep 2024 17:34:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sorSC-0002oy-CQ for guix-patches@gnu.org; Thu, 12 Sep 2024 17:34:16 -0400 Received: from tobias.gr ([2a02:c205:2020:6054::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sorS9-00031S-Qy for guix-patches@gnu.org; Thu, 12 Sep 2024 17:34:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=2018; bh=F00RZg2mXSHxY w4crVjkqNB/qbXAkiS6q/YTZb4O3FQ=; h=date:subject:to:from; d=tobias.gr; b=WYfd9P4oBnbllVWlzaeGMYYOMsWIBX9sSCFR7wt4MLsNgpP8LoGSz7DXNFNKpculf13E 4xPcwOArqGGIe3gybiPjzn4u/UGnxNIHdO1uVc0x2RwaXH21yORzpA8WkiPDnzBIyzvXpj g1VUI8+BJxQyw3kTAjHJ7BBu0aRXVP3Xu8aslNqF59NNFxbOswEaC1rtTdE/5NB0lSwgWg 5JUHnVUoPqnNZ9Yn2nwpVDTrhJButiGpH4h9MrfEwcPRdgUXij6Bb/0yEvyZq93hzqtHxj tdYVVO0iX3MVlRh10v87kcbFz1pwkFaBwSOD3917+Mo3bIBcJcnQbW9Nfc48X/sA== Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id 39a3d764 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Thu, 12 Sep 2024 21:34:05 +0000 (UTC) Date: Thu, 12 Sep 2024 23:33:57 +0200 Message-ID: X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a02:c205:2020:6054::1; envelope-from=me@tobias.gr; helo=tobias.gr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Tobias Geerinckx-Rice X-ACL-Warn: , Tobias Geerinckx-Rice via Guix-patches X-Patchwork-Original-From: Tobias Geerinckx-Rice via Guix-patches via From: Tobias Geerinckx-Rice Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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(-) 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 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")