From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id uGDyOpG/EWSqFAEASxT56A (envelope-from ) for ; Wed, 15 Mar 2023 13:52:34 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 2JD3OpG/EWRHAQAA9RJhRA (envelope-from ) for ; Wed, 15 Mar 2023 13:52:33 +0100 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 839B4F952 for ; Wed, 15 Mar 2023 13:52:33 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1678884753; 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; bh=W9tFL73P60kZ3tebveDHZhkjaoqKpVwU4RK2svSBRuA=; b=WzoemevWnb8z84/rERjtFU0tqzmdKIB6FWQVErN7ZNjk1JhXAkl408sllP/h01jPyKG1ge rUPwVtCOo0rN/FLCTYgqE2co2A7MkGQF7v+f9Hn5bsvSSHMN4HMHaZ7k7D1dxCoXBpxmxO Z1S4zLlj58ao1Aw4ulMJSnizIC+/+NiBw7WHoMmPy3IMqTUBQrQRQ4sz3NI91aJtHyrZcb LnwxeEHqPVIQ3ilMgiGUE+TpCbdAXJigc1yNxTXNlvzA4O3Hj8zDHJp2C0VRP4h5VGRUtf apZDGrczCwMiDEmBlvjEq9QuK6dDAaSXBymuRxdXpGek9Baw4oVFUWLECRTfKQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1678884753; a=rsa-sha256; cv=none; b=JPbB0O7oL/BfqFgPfhxOxt7E1UlfsstSqAMZkCRga4H0btUjoXPAOysBm9T+OJj7YJ0L7Z JXvbXLHs6TIQiBKlKRTjemBoPNjY73iA8oBmcctxq0nzouN4mYCNnvWDFdRWxBlINzbdos +u0n5Q7VHZfvA3TlM40/Z8wSf89+GAaDJy9aFsCP0REmxbHe40Oq7cT8+rxFQg2wkUviop okhdjxFTY7WkgFCE7d+lqfuifbw+h8esQaIbl/dZH1Y6Vlnym/ICrn1JUv7abjBSudgTb1 usB76bTWr/K52oslscGdS2LRQfxdTFNRSjuox6S6CYspTnlXJs52e5nxuVMd2A== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pcQbu-0003Po-K5; Wed, 15 Mar 2023 08:52:07 -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 1pcQbr-0003Oc-MZ for guix-patches@gnu.org; Wed, 15 Mar 2023 08:52:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pcQbr-00038U-AT for guix-patches@gnu.org; Wed, 15 Mar 2023 08:52:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pcQbr-0001YI-5W for guix-patches@gnu.org; Wed, 15 Mar 2023 08:52:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62202] [PATCH 02/21] import: utils: Change git->origin function to git->origin+version. Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 15 Mar 2023 12:52:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62202@debbugs.gnu.org Cc: ngraves@ngraves.fr Received: via spool by 62202-submit@debbugs.gnu.org id=B62202.16788847065825 (code B ref 62202); Wed, 15 Mar 2023 12:52:03 +0000 Received: (at 62202) by debbugs.gnu.org; 15 Mar 2023 12:51:46 +0000 Received: from localhost ([127.0.0.1]:39295 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcQbZ-0001Vh-9L for submit@debbugs.gnu.org; Wed, 15 Mar 2023 08:51:45 -0400 Received: from 7.mo560.mail-out.ovh.net ([188.165.48.182]:58983) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcQbV-0001VN-GV for 62202@debbugs.gnu.org; Wed, 15 Mar 2023 08:51:42 -0400 Received: from director9.ghost.mail-out.ovh.net (unknown [10.108.4.60]) by mo560.mail-out.ovh.net (Postfix) with ESMTP id C19E420C7E for <62202@debbugs.gnu.org>; Wed, 15 Mar 2023 12:51:39 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-lqxrt (unknown [10.110.115.9]) by director9.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 114611FE98; Wed, 15 Mar 2023 12:51:38 +0000 (UTC) Received: from ngraves.fr ([37.59.142.103]) by ghost-submission-6684bf9d7b-lqxrt with ESMTPSA id lnghCFq/EWTd1wAA847UKw (envelope-from ); Wed, 15 Mar 2023 12:51:38 +0000 X-OVh-ClientIp: 81.67.140.142 Date: Wed, 15 Mar 2023 13:51:11 +0100 Message-Id: <20230315125130.23041-2-ngraves@ngraves.fr> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230315125130.23041-1-ngraves@ngraves.fr> References: <20230315125130.23041-1-ngraves@ngraves.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 13788614688387621602 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrvddvkedggeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepfefgvdfhuedtffelffdvfefftdeffeefudfgfeegheffieeuueegvdduheefteffnecuffhomhgrihhnpehsphgugidrohhrghenucfkphepuddvjedrtddrtddruddpfeejrdehledrudegvddruddtfeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqpdhnsggprhgtphhtthhopedupdhrtghpthhtohepiedvvddtvdesuggvsggsuhhgshdrghhnuhdrohhrghdpoffvtefjohhsthepmhhoheeitddpmhhouggvpehsmhhtphhouhht 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 X-Migadu-Queue-Id: 839B4F952 X-Spam-Score: -2.03 X-Migadu-Spam-Score: -2.03 X-Migadu-Scanner: scn0.migadu.com 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-Country: US X-Migadu-Flow: FLOW_IN X-TUID: AGgklNSAjaH2 --- guix/import/go.scm | 2 +- guix/import/utils.scm | 50 +++++++++++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/guix/import/go.scm b/guix/import/go.scm index f264715fbd..3be82ed164 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -510,7 +510,7 @@ (define* (vcs->origin vcs-type vcs-repo-url version which takes version as an input." (case vcs-type ((git) - (git->origin vcs-repo-url `(tag-or-commit . ,version) transform-version)) + (git->origin vcs-repo-url `(tag-or-commit . ,version) transform-version)) ((hg) `(origin (method hg-fetch) diff --git a/guix/import/utils.scm b/guix/import/utils.scm index 529d7f11f8..171dca54e8 100644 --- a/guix/import/utils.scm +++ b/guix/import/utils.scm @@ -65,6 +65,7 @@ (define-module (guix import utils) url-fetch guix-hash-url + git->origin+dir git->origin package-names->package-inputs @@ -156,9 +157,12 @@ (define (guix-hash-url filename) "Return the hash of FILENAME in nix-base32 format." (bytevector->nix-base32-string (file-sha256 filename))) -(define* (git->origin repo-url ref #:optional ref->commit) - "Generate the `origin' block of a package depending on the git source -control system. REPO-URL or REF can be null." +(define* (git->origin+dir repo-url ref #:optional ref->commit) + "Returns a generated `origin' block of a package depending on the git source +control system, and the directory in the store where the package has been +downloaded, in case further processing is necessary. REPO-URL or REF can be +null. REF->COMMIT can be a function or #t, in which case the commit matching +ref is used. If REF->COMMIT is not used, the value inside REF is used." (let-values (((directory commit) (with-store store (latest-repository-commit store repo-url #:ref ref)))) @@ -172,21 +176,31 @@ (define* (git->origin repo-url ref #:optional ref->commit) version) (_ (ref->commit version))))) - `(origin - (method git-fetch) - (uri (git-reference - (url ,(and (not (eq? repo-url 'null)) repo-url)) - (commit ,vcommit))) - (file-name (git-file-name name version)) - (sha256 - (base32 - ,(if (pair? ref) - (bytevector->nix-base32-string - (file-hash* directory - ;; 'git-fetch' already filtered out the '.git' directory. - #:select? (const #true) - #:recursive? #true)) - #f))))))) + (values + `(origin + (method git-fetch) + (uri (git-reference + (url ,(and (not (eq? repo-url 'null)) repo-url)) + (commit ,vcommit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + ,(if (pair? ref) + (bytevector->nix-base32-string + (file-hash* directory + ;; 'git-fetch' already filtered out the '.git' directory. + #:select? (const #true) + #:recursive? #true)) + #f)))) + directory)))) + +(define* (git->origin repo-url ref #:optional ref->commit) + "Returns a generated `origin' block of a package depending on the git source +control system. REPO-URL or REF can be null. REF->COMMIT can be a function or +#t, in which case the commit matching ref is used. If REF->COMMIT is not used, +the value inside REF is used." + (let-values (((origin _) (git->origin+dir repo-url ref ref->commit))) + origin)) (define %spdx-license-identifiers ;; https://spdx.org/licenses/ -- 2.39.2