Package: guix-patches;
Reported by: Hilton Chain <hako <at> ultrarare.space>
Date: Tue, 18 Mar 2025 07:18:02 UTC
Severity: normal
Tags: patch
View this message in rfc822 format
From: Hilton Chain <hako <at> ultrarare.space> To: 77093 <at> debbugs.gnu.org Cc: Hilton Chain <hako <at> ultrarare.space>, Divya Ranjan Pattanaik <divya <at> subvertising.org>, Efraim Flashner <efraim <at> flashner.co.il>, Hilton Chain <hako <at> ultrarare.space>, Lars-Dominik Braun <lars <at> 6xq.net>, Liliana Marie Prikler <liliana.prikler <at> gmail.com>, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, Munyoki Kilyungi <me <at> bonfacemunyoki.com>, Noé Lopez <noelopez <at> free.fr>, Sharlatan Hellseher <sharlatanus <at> gmail.com>, Steve George <steve <at> futurile.net>, Tanguy Le Carrour <tanguy <at> bioneland.org>, Vivien Kraus <vivien <at> planete-kraus.eu> Subject: [bug#77093] [PATCH v4 rust-team 14/22] build/cargo: Don't vendor self. Date: Tue, 29 Apr 2025 00:23:11 +0800
* guix/build/cargo-build-system.scm (crate-src?, configure): Exclude self. * gnu/packages/gnome.scm (librsvg)[#:phases]: Remove ‘dont-vendor-self’. * gnu/packages/python-crypto.scm (python-cryptography)[#:arguments]: Likewise. * gnu/packages/python-xyz.scm (python-libcst)[#:arguments]: Likewise. * gnu/packages/syndication.scm (newsboat)[#:arguments]: Likewise. * gnu/packages/antivirus.scm (clamav)[#:arguments]: Likewise. Change-Id: I5e01721fb705937f5fcf858c21b6d7e27ade6c10 --- gnu/packages/antivirus.scm | 5 +--- gnu/packages/gnome.scm | 5 ---- gnu/packages/python-crypto.scm | 5 ---- gnu/packages/python-xyz.scm | 5 ---- gnu/packages/syndication.scm | 5 ---- guix/build/cargo-build-system.scm | 43 ++++++++++++++++--------------- 6 files changed, 23 insertions(+), 45 deletions(-) diff --git a/gnu/packages/antivirus.scm b/gnu/packages/antivirus.scm index 4a01115abd..d2060fa385 100644 --- a/gnu/packages/antivirus.scm +++ b/gnu/packages/antivirus.scm @@ -116,10 +116,7 @@ (define-public clamav (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")))) + (rename-file ".cargo/config" ".cargo/config.toml"))) (add-after 'patch-cargo-checksums 'cmake-configure (lambda* (#:key outputs #:allow-other-keys) ((assoc-ref cmake:%standard-phases 'configure) diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm index 26416df155..3de0dfb293 100644 --- a/gnu/packages/gnome.scm +++ b/gnu/packages/gnome.scm @@ -3780,11 +3780,6 @@ (define-public librsvg "--host=" #$(%current-target-system))) #~("--enable-vala"))) args))) - (add-after 'configure 'dont-vendor-self - (lambda* (#:key vendor-dir #:allow-other-keys) - ;; Don't keep the whole tarball in the vendor directory - (delete-file-recursively - (string-append vendor-dir "/" #$name "-" #$version ".tar.xz")))) (replace 'build (assoc-ref gnu:%standard-phases 'build)) (replace 'check diff --git a/gnu/packages/python-crypto.scm b/gnu/packages/python-crypto.scm index d004f6a69e..f7b6609315 100644 --- a/gnu/packages/python-crypto.scm +++ b/gnu/packages/python-crypto.scm @@ -561,11 +561,6 @@ (define-public python-cryptography #:install-source? #false #:phases #~(modify-phases %standard-phases - (add-after 'configure 'dont-vendor-self - (lambda* (#:key vendor-dir #:allow-other-keys) - ;; Don't keep the whole tarball in the vendor directory - (delete-file-recursively - (string-append vendor-dir "/cryptography-" #$version ".tar.zst")))) (replace 'build (assoc-ref py:%standard-phases 'build)) (delete 'check) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index c63a0a7708..b56d15f202 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -23694,11 +23694,6 @@ (define-public python-libcst (add-after 'unpack 'prepare-source (lambda _ (delete-file "native/Cargo.lock"))) - (add-after 'configure 'dont-vendor-self - (lambda* (#:key vendor-dir #:allow-other-keys) - ;; Don't keep the whole tarball in the vendor directory - (delete-file-recursively - (string-append vendor-dir "/libcst-" #$version ".tar.zst")))) (replace 'build (assoc-ref py:%standard-phases 'build)) (add-after 'install 'wrap diff --git a/gnu/packages/syndication.scm b/gnu/packages/syndication.scm index 61220bb9fe..b597bf9004 100644 --- a/gnu/packages/syndication.scm +++ b/gnu/packages/syndication.scm @@ -311,11 +311,6 @@ (define-public newsboat (("if curl-config") (string-append "if " (search-input-file inputs "/bin/curl-config")))))) - (add-after 'configure 'dont-vendor-self - (lambda* (#:key vendor-dir #:allow-other-keys) - ;; Don't keep the whole tarball in the vendor directory - (delete-file-recursively - (string-append vendor-dir "/" #$name "-" #$version ".tar.xz")))) (add-after 'unpack 'patch-source (lambda* (#:key outputs #:allow-other-keys) (substitute* "Makefile" diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index d1020bab52..c6865e6e81 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -70,27 +70,28 @@ (define (single-crate? dir) (call-with-input-file manifest-file get-string-all) "[workspace]"))))) -(define (crate-src? path) +(define* (crate-src? path #:key source) "Check if PATH refers to a crate source, namely a gzipped tarball with a Cargo.toml file present at its root." - (if (directory-exists? path) - ;; The build system only handles sources containing single crate. - ;; Workspaces should be packaged into crates (via 'package phase) - ;; and used in inputs. - (single-crate? path) - (and (not (string-suffix? "py" path)) ;sanity-check.py - ;; First we print out all file names within the tarball to see - ;; if it looks like the source of a crate. However, the tarball - ;; will include an extra path component which we would like to - ;; ignore (since we're interested in checking if a Cargo.toml - ;; exists at the root of the archive, but not nested anywhere - ;; else). We do this by cutting up each output line and only - ;; looking at the second component. We then check if it matches - ;; Cargo.toml exactly and short circuit if it does. - (invoke "sh" "-c" - (string-append "tar -tf " path - " | cut -d/ -f2" - " | grep -q '^Cargo.toml$'"))))) + (and (not (string=? path source)) ;Exclude self. + (if (directory-exists? path) + ;; The build system only handles sources containing single crate. + ;; Workspaces should be packaged into crates (via 'package phase) + ;; and used in inputs. + (single-crate? path) + (and (not (string-suffix? "py" path)) ;sanity-check.py + ;; First we print out all file names within the tarball to see + ;; if it looks like the source of a crate. However, the tarball + ;; will include an extra path component which we would like to + ;; ignore (since we're interested in checking if a Cargo.toml + ;; exists at the root of the archive, but not nested anywhere + ;; else). We do this by cutting up each output line and only + ;; looking at the second component. We then check if it matches + ;; Cargo.toml exactly and short circuit if it does. + (invoke "sh" "-c" + (string-append "tar -tf " path + " | cut -d/ -f2" + " | grep -q '^Cargo.toml$'")))))) (define* (unpack-rust-crates #:key inputs (vendor-dir "guix-vendor") #:allow-other-keys) @@ -155,7 +156,7 @@ (define* (check-for-pregenerated-files #:key parallel-build? #:allow-other-keys) (format #t "error: Possible pre-generated file found: ~a~%" file))) (find-files "." (negate empty-file?))))) -(define* (configure #:key inputs +(define* (configure #:key source inputs target system (cargo-target #f) (vendor-dir "guix-vendor") @@ -172,7 +173,7 @@ (define* (configure #:key inputs ((name . path) (let* ((basepath (strip-store-file-name path)) (crate-dir (string-append vendor-dir "/" basepath))) - (and (crate-src? path) + (and (crate-src? path #:source source) ;; Gracefully handle duplicate inputs (not (file-exists? crate-dir)) (if (directory-exists? path) -- 2.49.0
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.