From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id yDuOMVDTJmdUoQAAqHPOHw:P1 (envelope-from ) for ; Sun, 03 Nov 2024 01:35:12 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id yDuOMVDTJmdUoQAAqHPOHw (envelope-from ) for ; Sun, 03 Nov 2024 02:35:12 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=BI9EOAhk; dkim=fail ("headers rsa verify failed") header.d=ngraves.fr header.s=ovhmo4487190-selector1 header.b="sMnIq/+B"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1730597712; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=KDhBy+0LEZ240Nj2YFMpRPvbrlr0VVjvxLF4Q9WgEK8=; b=TgOeMKUgTjWxJAy9TMidt8TBziyFr76aH5hTiw9LzVpflwINmXl/81pBGVmhCr0/y3rK3b N8y91BD3+CNxvZJD9E/r4Boed4iF7XrAwdOTqR7WUzwqM+SFbs9mDhkuLupMAJswsqUwwd anGlNMHikdTmTtTsTkEWf1s+VojQXDDj/ExSlHS5ott0FhbAABXKwc/SLy9ckA4QhyNMfu ScoqM24dfR5DuuVLhU2+eDYcdeExg2Ylv+hhA6JSBinDWufwJIiJv9Pf5LiRXvS7GNYiHD vtS+IE//s+0q3+SywLGJM3EppCehqppTY6+HpiDdaN72abKa8F7HLm7mvHnCLA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1730597712; a=rsa-sha256; cv=none; b=H3e3d4Rwdciay3gEO2fcYXbwR235WYLROKLKaUySeKsSPDRmyCWOdoCazEggLzQa7JPxdg Rh8qaUwx1vyUeSz7hKao9/JJ7vM8EoqaLxrx8iMZPzyb0QWw8CFd97vzOlRM7nbF18BAyE h2mRvbJjIcYVwtzWYmezCTFnoh9CY8vpiaai55/chmR1nIvmXpnkfA6hqPKSAoqzCZ1oo/ GgvYG2wb91auSpKPsinSg16CMFseTAK6qgczRoVT00hPnyokE44fLLeAFIu4i0qAKL7kDK jbgCrFPxU9nZZKQk+Kj/RArQ4aKKB1T67hOua7b7dA92kJwP7VWv+pQ3abvfSw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=BI9EOAhk; dkim=fail ("headers rsa verify failed") header.d=ngraves.fr header.s=ovhmo4487190-selector1 header.b="sMnIq/+B"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 86F9E22C7 for ; Sun, 03 Nov 2024 02:35:12 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t7PVQ-0000cs-08; Sat, 02 Nov 2024 21:34:16 -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 1t7PVM-0000Zx-Pr for guix-patches@gnu.org; Sat, 02 Nov 2024 21:34:12 -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 1t7PVM-0002q9-H4 for guix-patches@gnu.org; Sat, 02 Nov 2024 21:34:12 -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:References:In-Reply-To:Date:From:To:Subject; bh=KDhBy+0LEZ240Nj2YFMpRPvbrlr0VVjvxLF4Q9WgEK8=; b=BI9EOAhka8fGc6hugfIhvLCNqkwd7vbWGx8woSSu04L9ayzBJhuO7UaCjPeT1gaHwRSLmBzHdwMUJ5RIVx0jS6fQb6yXE2s80E4nih/uUlXiK16mQCNknacm8z8P9gZ5RnFQQmftzlli/NW6erxv2KzSIjzvGV/YoMSm/qs5Vbcj8Im+2is2g7LT+3uQhA9+aSsn1nQJ6cdORu9MugrXurFA3llWRw9PYf1S1q1NdojB2aQPNPtfoltSeTU011+3of9XAc3NzD+0zq1yvap+R/OL3rwNScF0WruZG/W5SzLNEUHfoDSndtGe6mMy9+g+NIv8Q9d7XpBE8Gmw2rr2VA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t7PVM-0000dX-C2 for guix-patches@gnu.org; Sat, 02 Nov 2024 21:34:12 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73896] [PATCH v3 20/20] gnu: clamav: Unbundle rust dependencies. Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 03 Nov 2024 01:34:12 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73896 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73896@debbugs.gnu.org Cc: Nicolas Graves Received: via spool by 73896-submit@debbugs.gnu.org id=B73896.17305976292292 (code B ref 73896); Sun, 03 Nov 2024 01:34:12 +0000 Received: (at 73896) by debbugs.gnu.org; 3 Nov 2024 01:33:49 +0000 Received: from localhost ([127.0.0.1]:56889 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t7PUy-0000at-TR for submit@debbugs.gnu.org; Sat, 02 Nov 2024 21:33:49 -0400 Received: from 19.mo550.mail-out.ovh.net ([178.32.97.206]:48855) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t7PUu-0000ab-Jn for 73896@debbugs.gnu.org; Sat, 02 Nov 2024 21:33:45 -0400 Received: from director5.ghost.mail-out.ovh.net (unknown [10.108.25.23]) by mo550.mail-out.ovh.net (Postfix) with ESMTP id 4XgxvW3gF3z1TW8 for <73896@debbugs.gnu.org>; Sun, 3 Nov 2024 01:33:43 +0000 (UTC) Received: from ghost-submission-5b5ff79f4f-nt4t8 (unknown [10.108.54.3]) by director5.ghost.mail-out.ovh.net (Postfix) with ESMTPS id C41001FDB1; Sun, 3 Nov 2024 01:33:42 +0000 (UTC) Received: from ngraves.fr ([37.59.142.102]) by ghost-submission-5b5ff79f4f-nt4t8 with ESMTPSA id 9vtMIfbSJmdxLAAALLcWog (envelope-from ); Sun, 03 Nov 2024 01:33:42 +0000 X-OVh-ClientIp: 86.246.19.221 Date: Sun, 3 Nov 2024 02:30:27 +0100 Message-ID: <20241103013258.26141-21-ngraves@ngraves.fr> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241103013258.26141-1-ngraves@ngraves.fr> References: <20241103013258.26141-1-ngraves@ngraves.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 15201619071012365026 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrvdelvddgfeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepleffjeetueethfefkeffffefvddukeejkefgleduiedthfekvefhiedvhfffgeegnecukfhppeduvdejrddtrddtrddupdekiedrvdegiedrudelrddvvddupdefjedrheelrddugedvrddutddvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepuddprhgtphhtthhopeejfeekleeiseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehhedtpdhmohguvgepshhmthhpohhuth DKIM-Signature: a=rsa-sha256; bh=KDhBy+0LEZ240Nj2YFMpRPvbrlr0VVjvxLF4Q9WgEK8=; c=relaxed/relaxed; d=ngraves.fr; h=From; s=ovhmo4487190-selector1; t=1730597623; v=1; b=sMnIq/+BXwD+j2HJWGfqp7wLSbGqCBW/428pv3BUP5FS7J8DyEV7uL1wXlW6w3vB66LfVMJa oKqWggc28sd/xCnCNMxGAfrTUSIWTAg5RSlB1D2Zqv0WQWzvU0lHJ6HqipXCMacx97e0KewUh7R MGnA4JlRNoyv95G4jr1QNxpc2FpNRZ1I3w9XG2QzkeC6ETkALkyAnnS9V8mXi58YVGFiutxMvgs /mu96fATGJYFE1rU+Vvcr5QGs1scrI0ob0j6KUmRH4ORaSUKnCYj12s+7Jk9RO6KH9wtTVsiQzW uf01xHLENY/AKlfqJrRI/zj+pXNxvxfle8beKzNiSDCiQ== 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: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches From: Nicolas Graves via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -2.68 X-Spam-Score: -2.68 X-Migadu-Queue-Id: 86F9E22C7 X-Migadu-Scanner: mx13.migadu.com X-TUID: fjLDH6JdVAK4 * gnu/packages/antivirus.scm (clamav) [origin]: Unbundle rust dependencies. [build-system]: Switch to cargo-build-system. [arguments]: Adapt to the change of base build-system. [native-inputs]: Add cmake-minimal. Remove rust and rust:cargo. --- gnu/packages/antivirus.scm | 135 +++++++++++++++++++++++++++---------- 1 file changed, 99 insertions(+), 36 deletions(-) diff --git a/gnu/packages/antivirus.scm b/gnu/packages/antivirus.scm index 1a23657a61..b561ff060a 100644 --- a/gnu/packages/antivirus.scm +++ b/gnu/packages/antivirus.scm @@ -31,12 +31,17 @@ (define-module (gnu packages antivirus) #:use-module (gnu packages) #:use-module (gnu packages check) #:use-module (gnu packages compression) + #:use-module (gnu packages cmake) + #:use-module (gnu packages crates-crypto) + #:use-module (gnu packages crates-graphics) + #:use-module (gnu packages crates-io) #:use-module (gnu packages curl) #:use-module (gnu packages ncurses) #:use-module (gnu packages pcre) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) #:use-module (gnu packages python-check) + #:use-module (gnu packages rust-apps) #:use-module (gnu packages rust) #:use-module (gnu packages tls) #:use-module (gnu packages web) @@ -62,49 +67,107 @@ (define-public clamav (snippet '(begin (delete-file "Cargo.lock") - (for-each - delete-file - (find-files ".cargo/vendor" ".cargo-checksum\\.json")) (for-each delete-file-recursively - '("win32" ; unnecessary + '(".cargo" ; vendored rust inputs + "win32" ; unnecessary "libclamunrar")))))) ; non-free license - (build-system cmake-build-system) + (build-system cargo-build-system) (arguments - (list - #:configure-flags - #~(list "-DENABLE_MILTER=OFF" "-DENABLE_UNRAR=OFF") - #:imported-modules `((guix build cargo-utils) - ,@%cmake-build-system-modules) - #:phases - #~(modify-phases %standard-phases - (add-after 'unpack 'inject-rust-onenote - (lambda _ - (substitute* "libclamav_rust/Cargo.toml" - (("onenote_parser = .*") - "onenote_parser = \"0.3.1\"\n")))) - (add-after 'patch-source-shebangs 'patch-cargo-checksums - (lambda _ - (use-modules - (srfi srfi-1) (ice-9 ftw) (guix build cargo-utils)) - (with-directory-excursion ".cargo/vendor" - (for-each generate-all-checksums - (delete "." (delete ".." (scandir "."))))))) - (add-after 'unpack 'skip-clamd-tests - ;; XXX: The check?_clamd tests fail inside the build - ;; chroot, but pass outside. - (lambda* (#:key tests? #:allow-other-keys) - (when tests? - (substitute* "unit_tests/CMakeLists.txt" - (("clamd_test\\.py" test) - (string-append - test " -k \"not test_clamd_08_VirusEvent\""))))))))) + (let ((cargo-inputs + `(("rust-flate2" ,rust-flate2-1) + ("rust-hex" ,rust-hex-0.4) + ("rust-libc" ,rust-libc-0.2) + ("rust-log" ,rust-log-0.4) + ("rust-sha2" ,rust-sha2-0.10) + ("rust-tempfile" ,rust-tempfile-3) + ("rust-thiserror" ,rust-thiserror-1) + ("rust-image" ,rust-image-0.24) + ("rust-rustdct" ,rust-rustdct-0.7) + ("rust-transpose" ,rust-transpose-0.2) + ("rust-num-traits" ,rust-num-traits-0.2) + ("rust-base64" ,rust-base64-0.21) + ("rust-sha1" ,rust-sha1-0.10) + ("rust-unicode-segmentation" ,rust-unicode-segmentation-1) + ("rust-bindgen" ,rust-bindgen-0.66) + ("rust-onenote-parser" ,rust-onenote-parser-for-clamav) + ("rust-hex-literal" ,rust-hex-literal-0.4) + ("rust-inflate" ,rust-inflate-0.4) + ("rust-bzip2-rs" ,rust-bzip2-rs-0.1) + ("rust-byteorder" ,rust-byteorder-1) + ("rust-delharc" ,rust-delharc-0.6))) + (cargo-development-inputs + `(("rust-cbindgen" ,rust-cbindgen-0.26) + ("rust-bindgen" ,rust-bindgen-0.66)))) + (list + #:cargo-inputs cargo-inputs + #:cargo-development-inputs cargo-development-inputs + #:vendor-dir ".cargo/vendor" + #:imported-modules `(,@%cmake-build-system-modules + ,@%cargo-build-system-modules) + #:modules '((guix build cargo-build-system) + ((guix build cmake-build-system) #:prefix cmake:) + (guix build utils)) + #:phases + #~(modify-phases %standard-phases + ;; There is a .exe file used in unit tests. + (delete 'check-for-pregenerated-files) + (add-after 'configure 'fix-cargo-inputs-vendoring + (lambda _ + ;; Reproduce the original layout, fails with config. + (rename-file ".cargo/config" ".cargo/config.toml") + ;; Wrongly placed by configure + (delete-file-recursively + (string-append ".cargo/vendor/clamav-" #$version ".tar.zst")))) + (add-after 'patch-cargo-checksums 'cmake-configure + (lambda* (#:key outputs #:allow-other-keys) + ((assoc-ref cmake:%standard-phases 'configure) + #:configure-flags + (list "-DENABLE_MILTER=OFF" "-DENABLE_UNRAR=OFF") + #:outputs outputs))) + (replace 'build + (assoc-ref cmake:%standard-phases 'build)) + (add-after 'patch-cargo-checksums 'patch-rust-requirements + (lambda _ + (substitute* "libclamav_rust/Cargo.toml" + (("onenote_parser = .*") + (format #f "onenote_parser = ~s~%" + #$(package-version + (car (assoc-ref cargo-inputs + "rust-onenote-parser"))))) + (("^bindgen = .*") + (format #f "bindgen = ~s~%" + #$(package-version + (car (assoc-ref cargo-inputs + "rust-bindgen"))))) + (("cbindgen = \\{ version =\".*\",") + (format #f "cbindgen = { version =~s," + #$(package-version + (car (assoc-ref cargo-development-inputs + "rust-cbindgen")))))))) + (delete 'package) + (replace 'install + (assoc-ref cmake:%standard-phases 'install)) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + ((assoc-ref cmake:%standard-phases 'check) + #:tests? tests? + #:parallel-tests? #t + #:test-target "test"))) + (add-after 'unpack 'skip-clamd-tests + ;; XXX: The check?_clamd tests fail inside the build + ;; chroot, but pass outside. + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (substitute* "unit_tests/CMakeLists.txt" + (("clamd_test\\.py" test) + (string-append + test " -k \"not test_clamd_08_VirusEvent\"")))))))))) (native-inputs (list check ; for tests + cmake-minimal pkg-config python-minimal - python-pytest - rust - (list rust "cargo"))) + python-pytest)) (inputs (list bzip2 curl -- 2.46.0