From patchwork Mon Sep 16 16:29:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 67990 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 55B8027BBEB; Mon, 16 Sep 2024 17:32:24 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id DB6DE27BBE2 for ; Mon, 16 Sep 2024 17:32:23 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqEdp-0007ch-F5; Mon, 16 Sep 2024 12:31:57 -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 1sqEdn-0007Tn-Ok for guix-patches@gnu.org; Mon, 16 Sep 2024 12:31:55 -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 1sqEdn-0004NF-Er; Mon, 16 Sep 2024 12:31:55 -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=eKjwHNpcFAVHA5jSEs9mCLuK/E8nyh+ECsWHiwAHNCo=; b=LXSBZatZHiocGgmholgLlGxyZA+xTTWs+ZsEbjzju9/iNGcmPOYAFMpMr9W0hfqEE1lFs/PRC5rXMLvfVTvuDqzx6GxwdDCIuT6ufeFIss1h1eQq3gwOwA6qs/lQriYsGLiPe0XCOaNtR98dF0R9gP7BMsGOipc7vQh72eD9XUVp4N38mICSOyrbBY2Os4Z8hgm5xweB4gLVVCk75Su1pkRlnZPIcJjCovfyVS9l44SWYsb6qStdrKV7XrXPRvRG08KC+Jw4Db6TednEl7W+rOwNBv8VJE3OP/abtLnNpOm8uGV3zxVPEx4nsOly1OmTlG5nwwPPtgjzgAzGCW6umw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sqEdu-0001vn-V1; Mon, 16 Sep 2024 12:32:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73126] [PATCH v2 1/2] download: Add git-source. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, pelzflorian@pelzflorian.de, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, maxim.cournoyer@gmail.com, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 16 Sep 2024 16:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73126 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73126@debbugs.gnu.org Cc: Christopher Baines , Florian Pelz , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Florian Pelz , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 73126-submit@debbugs.gnu.org id=B73126.17265042877344 (code B ref 73126); Mon, 16 Sep 2024 16:32:02 +0000 Received: (at 73126) by debbugs.gnu.org; 16 Sep 2024 16:31:27 +0000 Received: from localhost ([127.0.0.1]:53159 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqEdL-0001uN-Br for submit@debbugs.gnu.org; Mon, 16 Sep 2024 12:31:27 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:52173 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqEdG-0001td-8a for 73126@debbugs.gnu.org; Mon, 16 Sep 2024 12:31:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1726504257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eKjwHNpcFAVHA5jSEs9mCLuK/E8nyh+ECsWHiwAHNCo=; b=EkFqI7OdvynHmM+3LyJ/OOKPWikS8Uc7KPghy8rBdSfmuAbH0B49f3JFqIsP8HfICFFh2M lSHqGPHUu5YZsJ3e/w5S/SGuXCPoZ2dOepKhOankT4TwLXArKQGk16FsQIXBWgCfj5x//Q 9EZul4zx6eBG5JKCkBDREBl3Df9C6bWWN5xFK278tRQsqic7HvjyyzsdqpNrUFVYpsPTMX P/zm6bEmm0TfpozYQMqGa+ec1VeamekjFIzs9e4IJXJXg0XHyNDWSHten84qm3Y0ovbyho teDyp8dcLzWahUHg6k7BJmDPdlpYaiEi1w8Llm1+nwz/tp779nqbYIDiMXiLLA== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id f252f8a4 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for <73126@debbugs.gnu.org>; Mon, 16 Sep 2024 16:30:57 +0000 (UTC) Date: Mon, 16 Sep 2024 18:29:57 +0200 Message-ID: <6857a5838688c629dc90efd5fe3769a7d4301223.1726495443.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 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: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/git-download.scm (git-source): Add and export procedure. * doc/guix.texi (origin Reference): Document git-source. Change-Id: I40c24ff10135e4895c5319f969005ba1c09760db --- doc/guix.texi | 7 +++++++ guix/git-download.scm | 12 +++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index bc4d306c2d..fa64c6a3fc 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -8248,6 +8248,13 @@ origin Reference @end lisp @end deftp +@deffn {Procedure} git-source hash host author project commit [prefix] +Return an @code{origin} corresponding to the @var{host}'s repository for +the @var{author}'s @var{project}. It is checked out at @var{commit}, +with a consistent @var{prefix} used in some repositories. @var{hash} is +the string for a base32-encoded SHA256 hash used by @code{git-fetch}. +@end deffn + For Mercurial repositories, the module @code{(guix hg-download)} defines the @code{hg-fetch} origin method and @code{hg-reference} data type for support of the Mercurial version control system. diff --git a/guix/git-download.scm b/guix/git-download.scm index ae2073ea06..6de53fec70 100644 --- a/guix/git-download.scm +++ b/guix/git-download.scm @@ -59,7 +59,8 @@ (define-module (guix git-download) git-fetch/lfs git-version git-file-name - git-predicate)) + git-predicate + git-source)) ;;; Commentary: ;;; @@ -395,4 +396,13 @@ (define* (git-predicate directory #:key (recursive? #t)) (#f #f))))) (const #f))) +(define* (git-source hash host author project commit #:optional prefix) + (origin + (method git-fetch) + (uri (git-reference + (url (string-join (list "https:/" host author project) "/")) + (commit (if prefix (string-append prefix commit) commit)))) + (file-name (git-file-name project commit)) + (hash (content-hash (base32 hash) sha256)))) + ;;; git-download.scm ends here