From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id CIQVCQBLMGRTfwAASxT56A (envelope-from ) for ; Fri, 07 Apr 2023 18:55:28 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id kGIJCQBLMGRGAwEA9RJhRA (envelope-from ) for ; Fri, 07 Apr 2023 18:55:28 +0200 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 CE5FC70AE for ; Fri, 7 Apr 2023 18:55:27 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pkpMe-0001Lx-Rb; Fri, 07 Apr 2023 12:55:04 -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 1pkpMc-0001HX-S5 for guix-patches@gnu.org; Fri, 07 Apr 2023 12:55:02 -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 1pkpMc-0002Hp-KK for guix-patches@gnu.org; Fri, 07 Apr 2023 12:55:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pkpMc-00014E-6J for guix-patches@gnu.org; Fri, 07 Apr 2023 12:55:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#61930] [PATCH] import: factorising git->origin in guix/import/utils.scm. Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 07 Apr 2023 16:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61930 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 61930@debbugs.gnu.org Cc: ngraves@ngraves.fr X-Debbugs-Original-To: Nicolas Graves via Guix-patches via , 61930@debbugs.gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16808864763883 (code B ref -1); Fri, 07 Apr 2023 16:55:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 Apr 2023 16:54:36 +0000 Received: from localhost ([127.0.0.1]:57163 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pkpMB-00010J-6S for submit@debbugs.gnu.org; Fri, 07 Apr 2023 12:54:36 -0400 Received: from lists.gnu.org ([209.51.188.17]:53596) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pkpM9-000105-P9 for submit@debbugs.gnu.org; Fri, 07 Apr 2023 12:54:34 -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 1pkpM9-0001Bb-F3 for guix-patches@gnu.org; Fri, 07 Apr 2023 12:54:33 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pkpM6-00026h-Vd for guix-patches@gnu.org; Fri, 07 Apr 2023 12:54:33 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-2ef67bbb136so171228f8f.1 for ; Fri, 07 Apr 2023 09:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680886469; x=1683478469; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=AI0SUctIvbf0QcrwEDM9szJw1fYSmONphYF9JlEWqWM=; b=PJX39xKvzj3veZrWq97GrW3lFycVgDRSA4GaBR7XeSQD4fkncRziHzgAk3oRhkwNiK RDURaWG9dukblJmDykJ2kGoT0/XRmKrOu0xQYv90Uau86FXknAyg77LRhLqjVSg/yJv3 Yh+BfRdr2I1M11XJHDUCCGQW9ykaK1AKuE2uGVEgnm+iHVYngv9jZ1iAJNI3vnv4TjFF q9HKmt6m4f7gD7OgYuMcqShz3gJVTnUe74/ZIXv63k3Xg+lV6batlUWtBknei/OWx3ZV r63Ze4Uhb6RhH9Rhw/2ZB71zIhz3wV8xbiypeNUMsnD4MdTKrpiw3g41F2qMrpu9l1+s KWqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680886469; x=1683478469; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AI0SUctIvbf0QcrwEDM9szJw1fYSmONphYF9JlEWqWM=; b=tJIpR3cZ0v5XiHb3MvmiZ450It85ZE3pNvwQcHU3xgOsbC51musE8/gbBzba8OUmWr W+1X6iD3jB7NotMh/FHtKStLfZG3DdAs6ywTJM15gpU5r2yDZj+P5QXoQbfiPkOZHQT6 NS4ndAVtDR2mStJ6/xXoBqdQsygx82JKYqOfMAnCbSGkIZHTLHQlwtwuH8JkT2vXiWs1 n+UqDxa7tRdPcomKasPr37hevMGkw5a3ngrb2znsh4GeKk6ic9lOPE1DwYVVwTLgGkfM XCfAfG0n48n02emaZyt94nl8Yf+SpAqTxPm5Pobc1XGVIpSpIgPx/rRJxKALb0FdORYh Lzxg== X-Gm-Message-State: AAQBX9es+mLGngxKKvl/LcReA8d2bqe55N6vPUSN3jsyW+cxla4O59fJ R7OFI3/s5eQOHCFqkJV7egw= X-Google-Smtp-Source: AKy350YEwsb0ir38C4QYTEB4PH9JqI/KbQLSiN+oeZgM26WBCytkvwa6e9XEwDGZPw6DIJLExRPTtg== X-Received: by 2002:a05:600c:1c1a:b0:3f0:330b:d316 with SMTP id j26-20020a05600c1c1a00b003f0330bd316mr1798734wms.3.1680886468637; Fri, 07 Apr 2023 09:54:28 -0700 (PDT) Received: from pfiuh07 ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id k23-20020a05600c0b5700b003ee44b2effasm5170077wmr.12.2023.04.07.09.54.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Apr 2023 09:54:28 -0700 (PDT) From: Simon Tournier In-Reply-To: <20230303110619.21119-1-ngraves@ngraves.fr> References: <87ilfi3yvm.fsf@ngraves.fr> <20230303110619.21119-1-ngraves@ngraves.fr> Date: Fri, 07 Apr 2023 17:26:40 +0200 Message-ID: <87a5zjlnm7.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=zimon.toutoune@gmail.com; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: , 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 ARC-Seal: i=1; s=key1; d=yhetil.org; t=1680886527; a=rsa-sha256; cv=none; b=I5ZAFrBFUw9f6SAes/U2WBEGbfzA9g2zGdtM1Wn37j9NyxTH+hcDRqbn0QBp0XyuYJNxy7 1ugyiUhuN9/iqQbSNBSQEyTPjfD4J/0gILxqRKKHrBGtpUwCNrV14UUvzlas/pJUVUo2X+ dHPGYq8+r1x21j89vBuz/62ZRbr0nVdbnt49ss6DD9I4l9/rJImLFuzXHV7KNC4We/cUdO vDofaXuYyuV6jCoj2oFmB3OzuhP3EYXJnxv1iRGWMu/h3fmjx2zEPpbNnC43TwKGZRtnu2 /VxlWWhIsHC3X2pQ3t2Tzc9FDI9jsA0CuswR31U84DbMQC3kWLvc4X4po4oLsw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=PJX39xKv; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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=1680886527; 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=AI0SUctIvbf0QcrwEDM9szJw1fYSmONphYF9JlEWqWM=; b=EzDv2nV+hdKubEWyCW/YcqW0rc0dNbMjI0aoFxJ/Sq03eVUtm92G0HKZbvphqH2Bh7K0CB K7psPt5u/xugjhovI8rtllG/DvRR0VDxBV/yvR3mRynEqARmUTBRRV5k0ijz5EViTROSfz FI4KaZRbjE1wb9R5UvhmdBe7cY1hzS3leTxJ+sM5d0kGzKzzPYcMweAVbP9BfTFcwdgX2s gQul5MdeGX3YUf3mKJHVGdI/dpfhhQsVVFz3v3zrMHKGXM4Cff7BQYNKMChcdbn1tEGh77 HVDyF7dIAv64EbEaksAShOfruut0RfPiJgu+ue9A/dd3Inkyvec1SVb/Gu+DRg== X-Migadu-Spam-Score: 7.08 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=PJX39xKv; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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" X-Spam-Score: 7.08 X-Migadu-Queue-Id: CE5FC70AE X-TUID: LFEkXreO4HRF Hi Nicolas, Sorry for the late reply. On ven., 03 mars 2023 at 12:06, Nicolas Graves via Guix-patches via wrote: > --- > guix/import/elpa.scm | 44 +++++++++++-------------------------- > guix/import/go.scm | 47 +++++++++------------------------------- > guix/import/minetest.scm | 28 ++---------------------- > guix/import/utils.scm | 36 ++++++++++++++++++++++++++++++ > tests/minetest.scm | 11 ++-------- > 5 files changed, 63 insertions(+), 103 deletions(-) This patch does not apply anymore. Could you rebase it on the top of master? Well, when using =E2=80=9Cgit format-patch=E2=80=9D the option =E2=80=99--b= ase=E2=80=99 is helpful for this kind of cases because it stores the base commit against which it applies. Then, anyone is able to easily rebase. > +(define (ref recipe) > + "Create REF from MELPA RECIPE." Maybe instead, I would move this as a local definition under =E2=80=99melpa-recipe->origin=E2=80=99. > diff --git a/guix/import/utils.scm b/guix/import/utils.scm > index 72795d2c61..3b31338e00 100644 > --- a/guix/import/utils.scm > +++ b/guix/import/utils.scm > @@ -13,6 +13,7 @@ > ;;; Copyright =C2=A9 2022 Alice Brenon > ;;; Copyright =C2=A9 2022 Kyle Meyer > ;;; Copyright =C2=A9 2022 Philip McGrath > +;;; Copyright =C2=A9 2023 Nicolas Graves > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -40,6 +41,8 @@ (define-module (guix import utils) > #:use-module (guix discovery) > #:use-module (guix build-system) > #:use-module (guix gexp) > + #:use-module (guix git) > + #:use-module (guix hash) > #:use-module ((guix i18n) #:select (G_)) > #:use-module (guix store) > #:use-module (guix download) > @@ -63,6 +66,7 @@ (define-module (guix import utils) >=20=20 > url-fetch > guix-hash-url > + git->origin >=20=20 > package-names->package-inputs > maybe-inputs > @@ -153,6 +157,38 @@ (define (guix-hash-url filename) > "Return the hash of FILENAME in nix-base32 format." > (bytevector->nix-base32-string (file-sha256 filename))) >=20=20 > +(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." > + (let-values (((directory commit) > + (with-store store > + (latest-repository-commit store repo-url #:ref ref)))) > + (let* ((version (if (pair? ref) > + (cdr ref) > + #f)) > + (vcommit (match ref->commit --^ why vcommit? Why not =E2=80=99identifier=E2=80=99? Cheers, simon