From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.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 UPm1CkaIbmf4YQAAe85BDQ:P1 (envelope-from ) for ; Fri, 27 Dec 2024 10:58:14 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id UPm1CkaIbmf4YQAAe85BDQ (envelope-from ) for ; Fri, 27 Dec 2024 11:58:14 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=GdGVd9ul; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=V3DogwGX; 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=1735297094; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: 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=2Ql5mPBI+6VirdjeTblezMhGv51kMkI+Tgo9ynQmO2o=; b=KaVJ60lA/ws+xlxKgObokIF+CXU/HswYqR6rAqkZR/ATion7rAIdRzcXfdpIFEuQ7SlJ/e hjWhdK8yF7aYRTaoljtrvyeM4ijiry/laUaAgt6GouDZk9Bvr2CIKak9QEdd644vbRLXl2 VwNiFZojLUl2+m9z0JeMKQDQQHn0dyAIR5oQPoVv22YELThAkljhWJiyzoIzYOY5TfjON8 v+G6iIpm98ZqXcz70hu+osyuxtYLZHX7IjUPnLYSxZ1BySFlOTLACLN50CRTEdxQhiyRai FlrZfiX0NZQAq+z66ZNj+2Syd378+0VSDHLsVupCeSfOvplyWnNzvgOEwdAzBw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=GdGVd9ul; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=V3DogwGX; 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-Seal: i=1; s=key1; d=yhetil.org; t=1735297094; a=rsa-sha256; cv=none; b=VZ2iWYl//8bUv8LqiHvSYTr7RMeRaGHiLeDEWtVMLQ+iTb7pIlZNTb9XmRQVamygoCs7Qq jtMdppaV/FJN+ZL1PUjYImt4GHmOlej7e3P3ecKCK/wLleiKm0MSQ65kkXtr5sLq9t0dmz gcab/jg5Dxxk4kSqiMullWLhrc2nGl3hTQwZDHe/BPRpdrSp8iL5Jj55Ly4tDMOGlnKCAh zidjlExw7SCtHhN2Mot2MTKREYsIl1fu+ypzSyaGVBH96Z8SvhCMUigDJt0/mo+M4pZcdc VDwRLg+ybWkliKtEJZ/OEuTJHa6M+b3pnrFIiowMdp1RYFCZ80k/S6D3oTALiw== 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 E93C678AFF for ; Fri, 27 Dec 2024 11:58:13 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tR82e-00030H-Sj; Fri, 27 Dec 2024 05:58:04 -0500 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 1tR82d-0002zw-EM for guix-patches@gnu.org; Fri, 27 Dec 2024 05:58:03 -0500 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 1tR82d-0003yN-4Z; Fri, 27 Dec 2024 05:58:03 -0500 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=2Ql5mPBI+6VirdjeTblezMhGv51kMkI+Tgo9ynQmO2o=; b=GdGVd9ulUj9/putyNa66E/PxbW3DRUundfBNEhS/A+zWxlUYp5aptUgVimiu0MFZ62McxBEOPfWFbYsi6fXwBhq4buR+CPccbnpgAA7o7/g+zyLeYDPAQStWTucTCLmaHkt5fqoBlktvkCQG9ec8+meIh/8f730gsAMLoGPVt/hhijbuANXI60yTJRFyqpmENPOfqXOuVSuWB0kExy76h8uCMokxO9d+DsyRjzZlKBgT4Ix82XHPL8gKZUF7UH0r3PawnbX8Y3VPrirKkRpk6KsA0n+oJ1jxJoFnovXbf/lvk9SdzMH6JNKHmCUYPD9wm5Y872yD8ASY75MfQ6hEDg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tR82c-0001fj-E5; Fri, 27 Dec 2024 05:58:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#75137] [PATCH 4/4] transformations: =?UTF-8?Q?=E2=80=98package-with-upstream-version=E2=80=99?= can preserve archive type. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 27 Dec 2024 10:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75137 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75137@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 75137-submit@debbugs.gnu.org id=B75137.17352970296342 (code B ref 75137); Fri, 27 Dec 2024 10:58:02 +0000 Received: (at 75137) by debbugs.gnu.org; 27 Dec 2024 10:57:09 +0000 Received: from localhost ([127.0.0.1]:44826 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tR81l-0001eD-6b for submit@debbugs.gnu.org; Fri, 27 Dec 2024 05:57:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:32862) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tR81b-0001cV-LJ for 75137@debbugs.gnu.org; Fri, 27 Dec 2024 05:57:00 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tR81W-0003uN-FH; Fri, 27 Dec 2024 05:56:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=2Ql5mPBI+6VirdjeTblezMhGv51kMkI+Tgo9ynQmO2o=; b=V3DogwGXqUBFXdArxyoa 5dBhvglrS+a5bxHNA+f6SfNansqlcw438E6jtR95IazgFhkaw4NCoI2UZza6DbHDQs+w8xcgbsJXE 2d9jyQhFhMHD7J5NeD/ColX7k2m+cVZGRNUIcFw09euEAApiyO5pwiZUiwvE1R/KZ/zT4zdZtjQ26 OSEPXyXLerLCJsV6Z1i+V6vEVQQ2msG41SsyfD2uFUBIXQXbdVvDiYh8SxLOJ3QtnpWT1DJFUHuBT lbJzeRxpyRL4vHaYIdgi3czgV0IAOwawXOmiy1FxcsGiLJ8ssb9ylMpPueUZvsVvTTEct+m1UIc5S W+rEoWonw/1/yg==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Fri, 27 Dec 2024 11:56:43 +0100 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: E93C678AFF X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: 0.61 X-Spam-Score: 0.61 X-TUID: 2HSInLDey5vt 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