From patchwork Sun Sep 8 20:30:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 67778 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 9D90D27BBE9; Sun, 8 Sep 2024 21:34:29 +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 autolearn=unavailable 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 9A61427BBE2 for ; Sun, 8 Sep 2024 21:34:27 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1snObi-0002nq-KE; Sun, 08 Sep 2024 16:34:02 -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 1snObg-0002nS-I1 for guix-patches@gnu.org; Sun, 08 Sep 2024 16:34:00 -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 1snObg-0004TD-7p for guix-patches@gnu.org; Sun, 08 Sep 2024 16:34:00 -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:Date:From:To:Subject; bh=LPUljIpODKu58W93U8eEQL5royQ8H6ANi7zmLC/JBko=; b=tW9joqzJggLjZGPSj3FamgJV0Wg1UzkjZVGqxBCHYcgfU1Zj1fFWqjTv5uJ4kj7kNOZQHv7Vs+lQ75iUxWlU+NTAB2TZB3qDoiijmO+RGqqoDfAcy22nnBz4udUvsNwzx6huJXX4J0eFC2WxhixYwJyDkP75R3tNGXXBuJgS6rHI6L1gJJTeeIM5MLMjv6uq8xewG+EdQKdc+unSGrN5eyIjtJqNt9gfVvcCXYDpFxoMMmxtJls6fP/4i6zSQ2mc1BfNLDthyMA+CefcZvowTsgEl+emVTnsApToH0yBRQvpYjuS4aKB8/XRlUtz9lnqXe0imWocJxoHfDR5dtfEDw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1snObi-00027s-1u for guix-patches@gnu.org; Sun, 08 Sep 2024 16:34:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73126] [PATCH] git-download: Add git-origin macro. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 08 Sep 2024 20:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73126 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73126@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17258276228140 (code B ref -1); Sun, 08 Sep 2024 20:34:01 +0000 Received: (at submit) by debbugs.gnu.org; 8 Sep 2024 20:33:42 +0000 Received: from localhost ([127.0.0.1]:60086 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snObO-00027E-27 for submit@debbugs.gnu.org; Sun, 08 Sep 2024 16:33:42 -0400 Received: from lists.gnu.org ([209.51.188.17]:53050) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snObL-000276-OR for submit@debbugs.gnu.org; Sun, 08 Sep 2024 16:33:40 -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 1snOZD-0002f1-Db for guix-patches@gnu.org; Sun, 08 Sep 2024 16:31:27 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117] helo=email.rimm.ee) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1snOZB-0004OD-OL for guix-patches@gnu.org; Sun, 08 Sep 2024 16:31:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1725827478; 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; bh=LPUljIpODKu58W93U8eEQL5royQ8H6ANi7zmLC/JBko=; b=rBe6yK2SbB2dyPvuRZCdmrOgPGq84pqRrUzlS3rBN3gUxXATk/mXzWOxr2sbaglagilzBX bETtjA0MKUC3l3iS5dfA5CYQfTxGQ7nNcHQg0B4Dd6fryLuYE64czTmzGpoK27CWUuSHQX zrGvv79vNPsVFM6zsUltrZ0qy7jeAAY1L5meSQ3II2iIPIPKfw24HocNLTNgkOk4AP1Xn/ 26ieTla5gu4ptGZlYeQGg9gtleaTh9t5fFck04qeBiIkfDQ5frI/RfNRxwpCGuz2MP96SE VfFFoMpJhPkWXZsiWAl0BiQim9zJNwQaSugzijGraY4sPWi0UdsqP7QwSlbMdg== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 5ba41f1b (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for ; Sun, 8 Sep 2024 20:31:18 +0000 (UTC) Date: Sun, 8 Sep 2024 22:30:24 +0200 Message-ID: <20240908203024.4762-1-herman@rimm.ee> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Received-SPF: pass client-ip=81.205.150.117; envelope-from=herman@rimm.ee; helo=email.rimm.ee X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_PBL=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TVD_RCVD_IP=0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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/packages.scm (git-origin-helper, git-origin): Add macros. --- guix/git-download.scm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/guix/git-download.scm b/guix/git-download.scm index ae2073ea06..d32f9a25eb 100644 --- a/guix/git-download.scm +++ b/guix/git-download.scm @@ -55,6 +55,8 @@ (define-module (guix git-download) git-reference-commit git-reference-recursive? + git-origin + git-fetch git-fetch/lfs git-version @@ -87,6 +89,31 @@ (define (git-lfs-package) (let ((distro (resolve-interface '(gnu packages version-control)))) (module-ref distro 'git-lfs))) +(define-syntax git-origin-helper + (syntax-rules (commit hash repository) + ((_ () (fields ...) c repo) + (origin fields ... + (method git-fetch) + (uri (git-reference (commit c) + (url repo))))) + ((_ ((commit exp) rest ...) others _ repo) + (git-origin-helper (rest ...) others exp repo)) + ((_ ((hash exp) rest ...) (others ...) c repo) + (git-origin-helper + (rest ...) + (others ... (hash (content-hash (base32 exp) sha256))) + c + repo)) + ((_ ((repository exp) rest ...) others c _) + (git-origin-helper (rest ...) others c exp)) + ((_ (field rest ...) (others ...) c repo) + (git-origin-helper (rest ...) (others ... field) c repo)))) + +(define-syntax-rule (git-origin fields ...) + "Build an record, converting the commit and repository field +specifications to a and hash to a ." + (git-origin-helper (fields ...) () #f #f)) + (define (git-fetch-builder git git-lfs git-ref-recursive? hash-algo) (define inputs `(,(or git (git-package))