From unknown Tue Jun 17 20:20:47 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#61930 <61930@debbugs.gnu.org> To: bug#61930 <61930@debbugs.gnu.org> Subject: Status: [PATCH 0/1] Factorising git->origin function for imports. Reply-To: bug#61930 <61930@debbugs.gnu.org> Date: Wed, 18 Jun 2025 03:20:47 +0000 retitle 61930 [PATCH 0/1] Factorising git->origin function for imports. reassign 61930 guix-patches submitter 61930 Nicolas Graves severity 61930 normal tag 61930 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 03 05:36:49 2023 Received: (at submit) by debbugs.gnu.org; 3 Mar 2023 10:36:49 +0000 Received: from localhost ([127.0.0.1]:59684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pY2mO-00073C-UW for submit@debbugs.gnu.org; Fri, 03 Mar 2023 05:36:49 -0500 Received: from lists.gnu.org ([209.51.188.17]:57774) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pY2mN-000734-22 for submit@debbugs.gnu.org; Fri, 03 Mar 2023 05:36:47 -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 1pY2mM-0008VZ-Nz for guix-patches@gnu.org; Fri, 03 Mar 2023 05:36:46 -0500 Received: from 12.mo581.mail-out.ovh.net ([178.33.107.167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY2mL-0007ho-0R for guix-patches@gnu.org; Fri, 03 Mar 2023 05:36:46 -0500 Received: from director5.ghost.mail-out.ovh.net (unknown [10.109.146.211]) by mo581.mail-out.ovh.net (Postfix) with ESMTP id 8B8AF270B9 for ; Fri, 3 Mar 2023 10:36:31 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-hg4sr (unknown [10.110.103.149]) by director5.ghost.mail-out.ovh.net (Postfix) with ESMTPS id A76D71FE4F; Fri, 3 Mar 2023 10:36:29 +0000 (UTC) Received: from ngraves.fr ([37.59.142.105]) by ghost-submission-6684bf9d7b-hg4sr with ESMTPSA id DZfALK3NAWR7KgEAPWOdjg (envelope-from ); Fri, 03 Mar 2023 10:36:29 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-105G0068d6a1b01-257e-4321-b4c9-c343750c4164, DA04169B0A2C3BFEE6971970B2D8B7FD8D2A11CF) smtp.auth=ngraves@ngraves.fr X-OVh-ClientIp: 81.67.140.142 From: Nicolas Graves To: guix-patches@gnu.org Subject: [PATCH 0/1] Factorising git->origin function for imports. Date: Fri, 03 Mar 2023 11:36:29 +0100 Message-ID: <87ilfi3yvm.fsf@ngraves.fr> MIME-Version: 1.0 Content-Type: text/plain X-Ovh-Tracer-Id: 14821064902514893412 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrudelledguddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkfggtgesthdtredttddttdenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpeeugefgtdekvdeujefhfeeggfevjeehfffgjedvteeuheffheegueffhfdttdehheenucfkphepuddvjedrtddrtddruddpfeejrdehledrudegvddruddtheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqpdhnsggprhgtphhtthhopedupdhrtghpthhtohepghhuihigqdhprghttghhvghssehgnhhurdhorhhgpdfovfetjfhoshhtpehmohehkedupdhmohguvgepshhmthhpohhuth Received-SPF: pass client-ip=178.33.107.167; envelope-from=ngraves@ngraves.fr; helo=12.mo581.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: zimoun X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Hi Guix! While looking for creating a juliahub import script, I had to look on how other packages were downloading repositories, and some things could be factorised. I plan to use this new function for the juliahub importer I'm writing. I still need to experiment with it a bit, ensure that all cases are covered, but here's a preliminary patch to get some feedback. I believe such could also be done for other VCS, as Katherine Cox-Buday probably had in mind when writing the go importer. The code to download and hash from hg is already there in the cran "download" helper. Maybe we can also add some options to the original hg-fetch function from guix/build/hg.scm to factorize hg directly ? -- Best regards, Nicolas Graves From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 03 06:06:29 2023 Received: (at 61930) by debbugs.gnu.org; 3 Mar 2023 11:06:29 +0000 Received: from localhost ([127.0.0.1]:59782 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pY3F6-0001so-IQ for submit@debbugs.gnu.org; Fri, 03 Mar 2023 06:06:29 -0500 Received: from 6.mo575.mail-out.ovh.net ([46.105.63.100]:40111) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pY3F3-0001sd-Kf for 61930@debbugs.gnu.org; Fri, 03 Mar 2023 06:06:27 -0500 Received: from director8.ghost.mail-out.ovh.net (unknown [10.108.16.32]) by mo575.mail-out.ovh.net (Postfix) with ESMTP id 1752C23851 for <61930@debbugs.gnu.org>; Fri, 3 Mar 2023 11:06:22 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-txjsz (unknown [10.110.103.46]) by director8.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 5A7A61FE0A; Fri, 3 Mar 2023 11:06:21 +0000 (UTC) Received: from ngraves.fr ([37.59.142.96]) by ghost-submission-6684bf9d7b-txjsz with ESMTPSA id mNmbBq3UAWTDoAAAXKQCxA (envelope-from ); Fri, 03 Mar 2023 11:06:21 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-96R0016ad5eaec-790a-4547-868e-2d5042e2d556, DA04169B0A2C3BFEE6971970B2D8B7FD8D2A11CF) smtp.auth=ngraves@ngraves.fr X-OVh-ClientIp: 81.67.140.142 From: Nicolas Graves To: 61930@debbugs.gnu.org Subject: [PATCH] import: factorising git->origin in guix/import/utils.scm. Date: Fri, 3 Mar 2023 12:06:19 +0100 Message-Id: <20230303110619.21119-1-ngraves@ngraves.fr> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 15325186585740567266 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 11 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrudelledgudelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucgfrhhlucfvnfffucdluddumdenucfjughrpefhvfevufffkffogggtgfesthekredtredtjeenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpeekvdethfetuddutefgkeeludetgfevgfduleejgeeviefhvdehjeetteetkeduueenucffohhmrghinhepghhithhlrggsrdgtohhmpdhsphgugidrohhrghenucfkphepuddvjedrtddrtddruddpfeejrdehledrudegvddrleeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqedpnhgspghrtghpthhtohepuddprhgtphhtthhopeeiudelfedtseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehjeehpdhmohguvgepshhmthhpohhuth X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 61930 Cc: ngraves@ngraves.fr X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --- 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(-) diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm index f9e9f2de53..cfd149a697 100644 --- a/guix/import/elpa.scm +++ b/guix/import/elpa.scm @@ -8,6 +8,7 @@ ;;; Copyright © 2021 Sarah Morgensen ;;; Copyright © 2021 Simon Tournier ;;; Copyright © 2022 Hartmut Goebel +;;; Copyright © 2023 Nicolas Graves ;;; ;;; This file is part of GNU Guix. ;;; @@ -45,7 +46,6 @@ (define-module (guix import elpa) #:use-module ((guix serialization) #:select (write-file)) #:use-module (guix store) #:use-module (guix ui) - #:use-module (guix base32) #:use-module (guix upstream) #:use-module (guix packages) #:use-module (guix memoization) @@ -210,11 +210,6 @@ (define* (fetch-elpa-package name #:optional (repo 'gnu)) url))) (_ #f)))) -(define* (download-git-repository url ref) - "Fetch the given REF from the Git repository at URL." - (with-store store - (latest-repository-commit store url #:ref ref))) - (define (package-name->melpa-recipe package-name) "Fetch the MELPA recipe for PACKAGE-NAME, represented as an alist from keywords to values." @@ -234,28 +229,15 @@ (define (data->recipe data) (close-port port) (data->recipe (cons ':name data)))) -(define (git-repository->origin recipe url) - "Fetch origin details from the Git repository at URL for the provided MELPA -RECIPE." - (define ref - (cond - ((assoc-ref recipe #:branch) - => (lambda (branch) (cons 'branch branch))) - ((assoc-ref recipe #:commit) - => (lambda (commit) (cons 'commit commit))) - (else - '()))) - - (let-values (((directory commit) (download-git-repository url ref))) - `(origin - (method git-fetch) - (uri (git-reference - (url ,url) - (commit ,commit))) - (sha256 - (base32 - ,(bytevector->nix-base32-string - (file-hash* directory #:recursive? #true))))))) +(define (ref recipe) + "Create REF from MELPA RECIPE." + (cond + ((assoc-ref recipe #:branch) + => (lambda (branch) (cons 'branch branch))) + ((assoc-ref recipe #:commit) + => (lambda (commit) (cons 'commit commit))) + (else + '()))) (define* (melpa-recipe->origin recipe) "Fetch origin details from the MELPA recipe and associated repository for @@ -266,9 +248,9 @@ (define (gitlab-repo->url repo) (string-append "https://gitlab.com/" repo ".git")) (match (assq-ref recipe ':fetcher) - ('github (git-repository->origin recipe (github-repo->url (assq-ref recipe ':repo)))) - ('gitlab (git-repository->origin recipe (gitlab-repo->url (assq-ref recipe ':repo)))) - ('git (git-repository->origin recipe (assq-ref recipe ':url))) + ('github (git->origin (github-repo->url (assq-ref recipe ':repo)) (ref recipe))) + ('gitlab (git->origin (gitlab-repo->url (assq-ref recipe ':repo)) (ref recipe))) + ('git (git->origin (assq-ref recipe ':url) (ref recipe))) (#f #f) ; if we're not using melpa then this stops us printing a warning (_ (warning (G_ "Unsupported MELPA fetcher: ~a, falling back to unstable MELPA source.~%") (assq-ref recipe ':fetcher)) diff --git a/guix/import/go.scm b/guix/import/go.scm index 90d4c8931d..c8ee16fd39 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -7,6 +7,7 @@ ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2021 Sarah Morgensen ;;; Copyright © 2021 Simon Tournier +;;; Copyright © 2023 Nicolas Graves ;;; ;;; This file is part of GNU Guix. ;;; @@ -501,49 +502,21 @@ (define (module-meta-data-repo-url meta-data goproxy) goproxy (module-meta-repo-root meta-data))) -(define* (git-checkout-hash url reference algorithm) - "Return the ALGORITHM hash of the checkout of URL at REFERENCE, a commit or -tag." - (define cache - (string-append (or (getenv "TMPDIR") "/tmp") - "/guix-import-go-" - (passwd:name (getpwuid (getuid))))) - - ;; Use a custom cache to avoid cluttering the default one under - ;; ~/.cache/guix, but choose one under /tmp so that it's persistent across - ;; subsequent "guix import" invocations. - (mkdir-p cache) - (chmod cache #o700) - (let-values (((checkout commit _) - (parameterize ((%repository-cache-directory cache)) - (update-cached-checkout url - #:ref - `(tag-or-commit . ,reference))))) - (file-hash* checkout #:algorithm algorithm #:recursive? #true))) +;; This is done because the version field of the package, which the generated +;; quoted expression refers to, has been stripped of any 'v' prefixed. +(define (transform-version version) + (let ((plain-version? (string=? version (go-version->git-ref version))) + (v-prefixed? (string-prefix? "v" version))) + ,(if (and plain-version? v-prefixed?) + '(string-append "v" version) + '(go-version->git-ref version)))) (define (vcs->origin vcs-type vcs-repo-url version) "Generate the `origin' block of a package depending on what type of source control system is being used." (case vcs-type ((git) - (let ((plain-version? (string=? version (go-version->git-ref version))) - (v-prefixed? (string-prefix? "v" version))) - `(origin - (method git-fetch) - (uri (git-reference - (url ,vcs-repo-url) - ;; This is done because the version field of the package, - ;; which the generated quoted expression refers to, has been - ;; stripped of any 'v' prefixed. - (commit ,(if (and plain-version? v-prefixed?) - '(string-append "v" version) - '(go-version->git-ref version))))) - (file-name (git-file-name name version)) - (sha256 - (base32 - ,(bytevector->nix-base32-string - (git-checkout-hash vcs-repo-url (go-version->git-ref version) - (hash-algorithm sha256)))))))) + (git->origin vcs-repo-url `(tag-or-commit . ,version) transform-version)) ((hg) `(origin (method hg-fetch) diff --git a/guix/import/minetest.scm b/guix/import/minetest.scm index e5775e2fa9..f080539bda 100644 --- a/guix/import/minetest.scm +++ b/guix/import/minetest.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021, 2022 Maxime Devos ;;; Copyright © 2022 Hartmut Goebel +;;; Copyright © 2023 Nicolas Graves ;;; ;;; This file is part of GNU Guix. ;;; @@ -38,7 +39,6 @@ (define-module (guix import minetest) #:use-module (guix import json) #:use-module ((gcrypt hash) #:select (open-sha256-port port-sha256)) #:use-module (json) - #:use-module (guix base32) #:use-module (guix git) #:use-module ((guix git-download) #:prefix download:) #:use-module (guix hash) @@ -283,12 +283,6 @@ (define url (string-append (%contentdb-api) "packages/?type=" type -;; XXX copied from (guix import elpa) -(define* (download-git-repository url ref) - "Fetch the given REF from the Git repository at URL." - (with-store store - (latest-repository-commit store url #:ref ref))) - (define (make-minetest-sexp author/name version repository commit inputs home-page synopsis description media-license license) @@ -298,25 +292,7 @@ (define (make-minetest-sexp author/name version repository commit `(package (name ,(contentdb->package-name author/name)) (version ,version) - (source - (origin - (method git-fetch) - (uri (git-reference - (url ,repository) - (commit ,commit))) - (sha256 - (base32 - ;; The git commit is not always available. - ,(and commit - (bytevector->nix-base32-string - (file-hash* - (download-git-repository repository - `(commit . ,commit)) - ;; 'download-git-repository' already filtered out the '.git' - ;; directory. - #:select? (const #true) - #:recursive? #true))))) - (file-name (git-file-name name version)))) + (source ,(git->origin repository `(tag-or-commit . ,commit))) (build-system minetest-mod-build-system) ,@(maybe-propagated-inputs (map contentdb->package-name inputs)) (home-page ,home-page) 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 © 2022 Alice Brenon ;;; Copyright © 2022 Kyle Meyer ;;; Copyright © 2022 Philip McGrath +;;; Copyright © 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) url-fetch guix-hash-url + git->origin 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))) +(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 + (#t + commit) + (null? + 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))))))) + (define %spdx-license-identifiers ;; https://spdx.org/licenses/ ;; The gfl1.0, nmap, repoze diff --git a/tests/minetest.scm b/tests/minetest.scm index cbb9e83889..c03f731845 100644 --- a/tests/minetest.scm +++ b/tests/minetest.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021 Maxime Devos +;;; Copyright © 2023 Nicolas Graves ;;; ;;; This file is part of GNU Guix. ;;; @@ -57,15 +58,7 @@ (define* (make-package-sexp #:key `(package (name ,guix-name) (version ,version) - (source - (origin - (method git-fetch) - (uri (git-reference - (url ,(and (not (eq? repo 'null)) repo)) - (commit #f))) - (sha256 - (base32 #f)) - (file-name (git-file-name name version)))) + (source (git->origin repo #f)) (build-system minetest-mod-build-system) ,@(maybe-propagated-inputs inputs) (home-page ,home-page) -- 2.39.1 From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 07 12:54:36 2023 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 To: Nicolas Graves via Guix-patches via , 61930@debbugs.gnu.org Subject: Re: [bug#61930] [PATCH] import: factorising git->origin in guix/import/utils.scm. 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-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: ngraves@ngraves.fr X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) 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 From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 03 18:38:54 2024 Received: (at 61930-done) by debbugs.gnu.org; 3 Feb 2024 23:38:54 +0000 Received: from localhost ([127.0.0.1]:47285 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWPb3-00021X-UR for submit@debbugs.gnu.org; Sat, 03 Feb 2024 18:38:54 -0500 Received: from 13.mo584.mail-out.ovh.net ([178.33.251.8]:36687) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWPb1-00021N-6Q for 61930-done@debbugs.gnu.org; Sat, 03 Feb 2024 18:38:52 -0500 Received: from director5.ghost.mail-out.ovh.net (unknown [10.108.2.115]) by mo584.mail-out.ovh.net (Postfix) with ESMTP id 0CBF227345 for <61930-done@debbugs.gnu.org>; Sat, 3 Feb 2024 23:38:38 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-ctjrb (unknown [10.110.178.210]) by director5.ghost.mail-out.ovh.net (Postfix) with ESMTPS id C40EA1FDB5 for <61930-done@debbugs.gnu.org>; Sat, 3 Feb 2024 23:38:37 +0000 (UTC) Received: from ngraves.fr ([37.59.142.95]) by ghost-submission-6684bf9d7b-ctjrb with ESMTPSA id wS4PLX3OvmXtSxgAF6xv8A (envelope-from ) for <61930-done@debbugs.gnu.org>; Sat, 03 Feb 2024 23:38:37 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-95G001151cfa8a-6347-4d02-b1ac-b7f4a921e213, CDD90146079FDB87F723A7A7FD21F5F4569C6C59) smtp.auth=ngraves@ngraves.fr X-OVh-ClientIp: 81.67.146.208 From: Nicolas Graves To: 61930-done@debbugs.gnu.org Subject: close 61930 Date: Sun, 04 Feb 2024 00:38:37 +0100 Message-ID: <874jepce4i.fsf@ngraves.fr> MIME-Version: 1.0 Content-Type: text/plain X-Ovh-Tracer-Id: 14879330219841675935 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrfedujedgudefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvffufffkgggtsehttdertddttddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepueejleeileejfffhleetjedtleejheevudffleevgfdufeekhefgvddvveegveefnecukfhppeduvdejrddtrddtrddupdekuddrieejrddugeeirddvtdekpdefjedrheelrddugedvrdelheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqpdhnsggprhgtphhtthhopedupdhrtghpthhtohepieduleeftddqughonhgvseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehkeegpdhmohguvgepshhmthhpohhuth X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 61930-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Obsolete, see 62202. -- Best regards, Nicolas Graves From unknown Tue Jun 17 20:20:47 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 03 Mar 2024 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator