From: "Ludovic Courtès" <ludo@gnu.org>
To: 75137@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>,
"Christopher Baines" <guix@cbaines.net>,
"Josselin Poiret" <dev@jpoiret.xyz>,
"Ludovic Courtès" <ludo@gnu.org>,
"Mathieu Othacehe" <othacehe@gnu.org>,
"Simon Tournier" <zimon.toutoune@gmail.com>,
"Tobias Geerinckx-Rice" <me@tobias.gr>
Subject: [bug#75137] [PATCH 4/4] transformations: ‘package-with-upstream-version’ can preserve archive type.
Date: Fri, 27 Dec 2024 11:56:43 +0100 [thread overview]
Message-ID: <a07fb528e941d820625cbad3d6effd5a44a1e724.1735296761.git.ludo@gnu.org> (raw)
In-Reply-To: <cover.1735296761.git.ludo@gnu.org>
Fixes a discrepancy for ‘url-fetch’ packages where upstream provides
several source tarballs. For example, for ‘xorg-server’,
‘package-with-upstream-version’ would pick the “tar.gz” tarball even
though the package definition uses “tar.xz”. It now picks “tar.xz” by
default.
* guix/transformations.scm (package-with-upstream-version):
Add #:preserve-archive-type?. Call ‘preferred-upstream-source’ to honor
it.
Change-Id: Iefa007aba339d81709faf82b7c52a5a2c7a6aad7
---
guix/transformations.scm | 44 +++++++++++++++++++++++-----------------
1 file changed, 25 insertions(+), 19 deletions(-)
diff --git a/guix/transformations.scm b/guix/transformations.scm
index 131b8564f8..2887d91a34 100644
--- a/guix/transformations.scm
+++ b/guix/transformations.scm
@@ -33,6 +33,7 @@ (define-module (guix transformations)
#:autoload (guix git) (git-checkout git-checkout? git-checkout-url)
#:autoload (guix upstream) (upstream-source
package-latest-release
+ preferred-upstream-source
upstream-source-version
upstream-source-signature-urls)
#:autoload (guix cpu) (current-cpu
@@ -865,12 +866,14 @@ (define (upstream-source-without-signatures source)
(define* (package-with-upstream-version p #:optional version
#:key
(preserve-patches? #f)
- (authenticate? #t))
+ (authenticate? #t)
+ (preserve-archive-type? #t))
"Return package P changed to use the given upstream VERSION or, if VERSION
is #f, the latest known upstream version. When PRESERVE-PATCHES? is true,
preserve patches and snippets found in the source of P, provided it's an
origin. When AUTHENTICATE? is false, disable OpenPGP signature verification
-of upstream source code."
+of upstream source code. When PRESERVE-ARCHIVE-TYPE? is true, use the same
+archive type as P's source (gz, xz, zstd, etc.)"
(let ((source (and=> (package-latest-release p #:version version)
(if authenticate?
identity
@@ -899,24 +902,27 @@ (define* (package-with-upstream-version p #:optional version
(upstream-source-version source)
(package-version p)))
- (unless (pair? (upstream-source-signature-urls source))
- (warning (G_ "cannot authenticate source of '~a', version ~a~%")
- (package-name p)
- (upstream-source-version source)))
+ (let ((source (if preserve-archive-type?
+ (preferred-upstream-source source p)
+ source)))
+ (unless (pair? (upstream-source-signature-urls source))
+ (warning (G_ "cannot authenticate source of '~a', version ~a~%")
+ (package-name p)
+ (upstream-source-version source)))
- ;; TODO: Take 'upstream-source-input-changes' into account.
- (package
- (inherit p)
- (version (upstream-source-version source))
- (source (if (and preserve-patches?
- (origin? (package-source p)))
- ;; Inherit P's origin so snippets and patches are
- ;; applied as if we had run 'guix refresh -u'.
- (origin
- (inherit (package-source p))
- (method upstream-fetch)
- (uri source))
- source)))))))
+ ;; TODO: Take 'upstream-source-input-changes' into account.
+ (package
+ (inherit p)
+ (version (upstream-source-version source))
+ (source (if (and preserve-patches?
+ (origin? (package-source p)))
+ ;; Inherit P's origin so snippets and patches are
+ ;; applied as if we had run 'guix refresh -u'.
+ (origin
+ (inherit (package-source p))
+ (method upstream-fetch)
+ (uri source))
+ source))))))))
(define (transform-package-latest specs)
"Return a procedure that rewrites package graphs such that those in SPECS
--
2.46.0
next prev parent reply other threads:[~2024-12-27 10:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-27 10:55 [bug#75137] [PATCH 0/4] 'package-with-upstream-version' can preserve archive type Ludovic Courtès
2024-12-27 10:56 ` [bug#75137] [PATCH 1/4] upstream: Switch to SRFI-71 Ludovic Courtès
2025-01-06 10:57 ` Simon Tournier
2025-01-08 9:59 ` Ludovic Courtès
2025-01-09 11:11 ` Simon Tournier
2024-12-27 10:56 ` [bug#75137] [PATCH 2/4] upstream: Extract ‘preferred-upstream-source-url’ Ludovic Courtès
2024-12-27 10:56 ` [bug#75137] [PATCH 3/4] upstream: Define ‘preferred-upstream-source’ Ludovic Courtès
2024-12-27 10:56 ` Ludovic Courtès [this message]
2025-01-06 11:09 ` [bug#75137] [PATCH 0/4] 'package-with-upstream-version' can preserve archive type Simon Tournier
2025-01-08 23:26 ` bug#75137: " Ludovic Courtès
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=a07fb528e941d820625cbad3d6effd5a44a1e724.1735296761.git.ludo@gnu.org \
--to=ludo@gnu.org \
--cc=75137@debbugs.gnu.org \
--cc=dev@jpoiret.xyz \
--cc=guix@cbaines.net \
--cc=me@tobias.gr \
--cc=othacehe@gnu.org \
--cc=zimon.toutoune@gmail.com \
/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.