From patchwork Thu May 25 15:41:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 50318 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 1C34827BBEA; Thu, 25 May 2023 16:42:28 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, 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 90D8127BBE2 for ; Thu, 25 May 2023 16:42:27 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2D6N-0001XO-9a; Thu, 25 May 2023 11:42: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 1q2D6J-0001VW-21 for guix-patches@gnu.org; Thu, 25 May 2023 11:42:04 -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 1q2D6I-0002Wr-Q5 for guix-patches@gnu.org; Thu, 25 May 2023 11:42:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q2D6I-00018b-Ln for guix-patches@gnu.org; Thu, 25 May 2023 11:42:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63647] [PATCH v2 1/3] guix: import: go: Sort hint about available versions. References: In-Reply-To: Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 25 May 2023 15:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63647 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63647@debbugs.gnu.org Cc: Simon Tournier Received: via spool by 63647-submit@debbugs.gnu.org id=B63647.16850292924287 (code B ref 63647); Thu, 25 May 2023 15:42:02 +0000 Received: (at 63647) by debbugs.gnu.org; 25 May 2023 15:41:32 +0000 Received: from localhost ([127.0.0.1]:47885 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2D5o-000173-2F for submit@debbugs.gnu.org; Thu, 25 May 2023 11:41:32 -0400 Received: from mail-wr1-f51.google.com ([209.85.221.51]:39214) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2D5j-00016M-D1 for 63647@debbugs.gnu.org; Thu, 25 May 2023 11:41:27 -0400 Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-3094ca1df73so351036f8f.1 for <63647@debbugs.gnu.org>; Thu, 25 May 2023 08:41:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685029280; x=1687621280; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=y244qRQORWlQPqsRz2FcEtZrdw2xPx9OOtmkOHi0wPs=; b=i2aAk6pd5PF71VdqgjCnK66LFUaM++tTnsS7HLnAzxl8CChWxl0wrj/5vU5/vDalv6 mqAbeUgYBFU+WXSj/BgrEYS1wMzLcjx8g5uLjpkEHhgg8KnL9bgtkdd73AmttJKpT0t9 efQJP6x0OaiSxMWxiV/j/Yk7apvp3DrR/Dnv00A0WtNzMkdXtmV6CC2xLorliPlgBSne oMd6anZzyau64ECWxtJ2xQZQ5g3HmB970/yP0iYu2agaqS5lM0fsmH/d2jUJKHkmbqtS 3H2qIJHw+Mi5Ao6R9fo/NxG9Lt8NrFXrkuCrR2Bh8wQ1IW4PMomKLWmbz1UVukXdQbqN YQlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685029280; x=1687621280; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=y244qRQORWlQPqsRz2FcEtZrdw2xPx9OOtmkOHi0wPs=; b=N9qOwCulwXljWSIdt3+50QT+lX5C/2Xo0nHXx21LarMLv67mv1Z9z0tvU/qk8SD+I9 oEK5ZH8WrSdmXVMvo9Uu4QetgvxR5cS3GVxKF744odsVbSFGM/yXYHRMhItA2aVtMm9o kDHI6rJNVEqducQODG8HdZWm6g6VoAk4FJGhGeKJh8UbqwVdUvtE+CNgdc1NA/x2t9/g NKCIZOrJAVVd3GC1Hr5BYHMGw8a1IP4WE8deBgqOR/FXE+5PEB9vlqmTdudoxW/9ivF6 8BUhWFFjDOfjynUxT4FTIt8eesw3EMZhD88+S/gAWWD0SCgLTfxDBXJ6dUnB8CLZjZd8 swEg== X-Gm-Message-State: AC+VfDyRKLRx1v/MgZCRx5mpR5UWT7sWcPmE3zMmNivmJhwrhZkXTPGe 3RVMMaFEUtUD7/EALp59zSMHdcXBN0w= X-Google-Smtp-Source: ACHHUZ6wZz8Y7UVCODHV9Z4lEXVzcM4KQFa/PfIZ+N1oIdXDXh5hWxXAtgu+pe0JX8pcU6TkTwJXIQ== X-Received: by 2002:a5d:6208:0:b0:2f9:59a3:eb30 with SMTP id y8-20020a5d6208000000b002f959a3eb30mr13358466wru.0.1685029280025; Thu, 25 May 2023 08:41:20 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id q2-20020adff502000000b003062c0ef959sm2172258wro.69.2023.05.25.08.41.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 08:41:19 -0700 (PDT) From: Simon Tournier Date: Thu, 25 May 2023 17:41:10 +0200 Message-Id: X-Mailer: git-send-email 2.39.2 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: , 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/import/go.scm (validate-version): Sort available versions. --- guix/import/go.scm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) base-commit: 99fc7e5dd3c9c92f9b6c2e51db9dc5b0481a56b2 diff --git a/guix/import/go.scm b/guix/import/go.scm index 0357e6a1eb..1943869162 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -34,6 +34,7 @@ (define-module (guix import go) #:use-module (guix packages) #:use-module (guix http-client) #:use-module (guix memoization) + #:use-module (guix utils) #:autoload (htmlprag) (html->sxml) ;from Guile-Lib #:autoload (guix base32) (bytevector->nix-base32-string) #:autoload (guix build utils) (mkdir-p) @@ -588,8 +589,9 @@ (define (validate-version version available-versions module-path) (condition (&fix-hint (hint (format #f (G_ "Pick one of the following \ available versions:~{ ~a~}.") - (map strip-v-prefix - available-versions))))))))) + (sort (map strip-v-prefix + available-versions) + version>?))))))))) (define* (go-module->guix-package module-path #:key (goproxy "https://proxy.golang.org") From patchwork Thu May 25 15:41:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 50317 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 EC1B427BBE9; Thu, 25 May 2023 16:42:14 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, 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 C418F27BBE2 for ; Thu, 25 May 2023 16:42:12 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2D6L-0001Wc-UN; Thu, 25 May 2023 11:42:06 -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 1q2D6I-0001UG-Jk for guix-patches@gnu.org; Thu, 25 May 2023 11:42:04 -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 1q2D6I-0002Wk-B8 for guix-patches@gnu.org; Thu, 25 May 2023 11:42:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q2D6I-00018T-7F for guix-patches@gnu.org; Thu, 25 May 2023 11:42:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63647] [PATCH v2 2/3] guix: import: go: Catch Git error. Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 25 May 2023 15:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63647 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63647@debbugs.gnu.org Cc: Felix Lechner , Simon Tournier Received: via spool by 63647-submit@debbugs.gnu.org id=B63647.16850292894274 (code B ref 63647); Thu, 25 May 2023 15:42:02 +0000 Received: (at 63647) by debbugs.gnu.org; 25 May 2023 15:41:29 +0000 Received: from localhost ([127.0.0.1]:47883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2D5k-00016r-LO for submit@debbugs.gnu.org; Thu, 25 May 2023 11:41:29 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]:38309) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2D5i-00016N-9q for 63647@debbugs.gnu.org; Thu, 25 May 2023 11:41:27 -0400 Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-30aa563abdaso272377f8f.1 for <63647@debbugs.gnu.org>; Thu, 25 May 2023 08:41:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685029280; x=1687621280; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CSnHPMzezOPOSZyv6KXp9jZFfx9VEwTPOCtQsJi6uGA=; b=jm4FKkxm6Cvf2ftb0Ba2nnjDJiFFYN2dvunLEbZg8ybsQnU2bb7OLBgiWYTL1+wlg2 MiNFgOrhFMz9mBIi+PTBhUlzclTrHUAnpfzSGX9dC2Xzh2zWtBVxzf6eZpdEVUqGBPzJ gIaa3/HpdkoZzrdSSlwQsC4oCu4rJaD0Kd8sC1/Gvam4lyNnSBquw3uBpdes4yikJbdm 1tczV0Lwt52ic/aKy28bAGVZs6wVw7h56U0cUdeg6z1eV4fUYXati3ntDO+a20v8gbrt Ze7H48cjOzJjeo7dzFCR1jKPd2rYsgpvYWiJZ2R8zUZBPzNBmixzFwsvgLazL5pk9wMI 7mHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685029280; x=1687621280; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CSnHPMzezOPOSZyv6KXp9jZFfx9VEwTPOCtQsJi6uGA=; b=BizvC9k2ggC3iCzXskwsToWVrG8BkAqlqVhtggqOGoUYGTE4htknfWBJR2FoyGV5Bo oD+JOWf+r+6v315u2nsiuJQ8qQ3GLxog+WBfqkYPsTOsTqWVXcMqToyK1b7FC+kS/3Cx wvDBE7b6me1B2tzOfmLl7Ey391HGs9XW3A9KiKeDB5sryESXA/rovBEYdm5O7RryT4R8 uPw35U0axmAaAZ+vuy303OByR8BVPFB1aa+DpMdynvkMD4pB9cWzctCWWeL9bGQ9EYWC F57J0mKLVuc3AgyK7BhaN6dKUINun1JEO2riq6HX88Pf9MdjNaJO3uE7Ku6zRbyl+6hb CrPA== X-Gm-Message-State: AC+VfDwRFVThLmJ46Wp77GTeffQqMUb8TUZAVMCldsxyD2AE3PW3VIzk UbngsNaZ83G8jt7L5RRM0xSKXoS/iG8= X-Google-Smtp-Source: ACHHUZ5ImuWUKoVD1rRjMDKY8Sz+OywiIkchiMpTa0IAPAcDUpAHC7Ya1DnqkfCYAKVf0n4cxuRuqQ== X-Received: by 2002:a5d:6785:0:b0:309:22bb:e00 with SMTP id v5-20020a5d6785000000b0030922bb0e00mr4045628wru.5.1685029280407; Thu, 25 May 2023 08:41:20 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id q2-20020adff502000000b003062c0ef959sm2172258wro.69.2023.05.25.08.41.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 08:41:20 -0700 (PDT) From: Simon Tournier Date: Thu, 25 May 2023 17:41:11 +0200 Message-Id: X-Mailer: git-send-email 2.39.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: , 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/import/go.scm (git-checkout-hash): Catch Git error. Reported-by: Felix Lechner . --- guix/import/go.scm | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/guix/import/go.scm b/guix/import/go.scm index 1943869162..c6258296f6 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -6,7 +6,7 @@ ;;; Copyright © 2021-2022 Ludovic Courtès ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2021 Sarah Morgensen -;;; Copyright © 2021 Simon Tournier +;;; Copyright © 2021, 2023 Simon Tournier ;;; ;;; This file is part of GNU Guix. ;;; @@ -36,9 +36,11 @@ (define-module (guix import go) #:use-module (guix memoization) #:use-module (guix utils) #:autoload (htmlprag) (html->sxml) ;from Guile-Lib - #:autoload (guix base32) (bytevector->nix-base32-string) + #:autoload (guix base32) (bytevector->nix-base32-string nix-base32-string->bytevector) #:autoload (guix build utils) (mkdir-p) + #:autoload (guix ui) (warning) #:autoload (gcrypt hash) (hash-algorithm sha256) + #:autoload (git structs) (git-error-message) #:use-module (ice-9 format) #:use-module (ice-9 match) #:use-module (ice-9 peg) @@ -507,12 +509,18 @@ (define* (git-checkout-hash url reference algorithm) ;; 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))) + (catch 'git-error + (lambda _ + (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))) + (lambda (key error . rest) + (warning (G_ "Git error: ~a in ~a~%") (git-error-message error) url) + (nix-base32-string->bytevector + "0000000000000000000000000000000000000000000000000000")))) (define (vcs->origin vcs-type vcs-repo-url version) "Generate the `origin' block of a package depending on what type of source From patchwork Thu May 25 15:41:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 50319 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 210CE27BBE9; Thu, 25 May 2023 16:42:30 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, 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 9ECE327BBE2 for ; Thu, 25 May 2023 16:42:28 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2D6M-0001Wi-V9; Thu, 25 May 2023 11:42:06 -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 1q2D6J-0001VX-Dl for guix-patches@gnu.org; Thu, 25 May 2023 11:42:04 -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 1q2D6J-0002Wz-5P for guix-patches@gnu.org; Thu, 25 May 2023 11:42:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q2D6J-00018i-1O for guix-patches@gnu.org; Thu, 25 May 2023 11:42:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63647] [PATCH v2 3/3] guix: import: go: Use correct tag for go module in subdirectory. Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 25 May 2023 15:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63647 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63647@debbugs.gnu.org Cc: Stephen Paul Weber , Simon Tournier Received: via spool by 63647-submit@debbugs.gnu.org id=B63647.16850292934294 (code B ref 63647); Thu, 25 May 2023 15:42:02 +0000 Received: (at 63647) by debbugs.gnu.org; 25 May 2023 15:41:33 +0000 Received: from localhost ([127.0.0.1]:47887 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2D5o-000176-Ef for submit@debbugs.gnu.org; Thu, 25 May 2023 11:41:32 -0400 Received: from mail-wr1-f53.google.com ([209.85.221.53]:39216) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2D5j-00016P-29 for 63647@debbugs.gnu.org; Thu, 25 May 2023 11:41:27 -0400 Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3094ca1df73so351039f8f.1 for <63647@debbugs.gnu.org>; Thu, 25 May 2023 08:41:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685029281; x=1687621281; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IGxbiqGMkKYf02xQ8jmP+1cjWMBkw0vK+f7mNuPZKsU=; b=AwAM8Mbfox6ZsJHJ3tTx8T8cdLp4hF4jq/7MzTymlI73V+ugGVfH5O0//R7cpVJ6ni PUgdmp2t+H/Kad7K3vINdsc01CGxjwb2EaH3iXJLSLBPa/TMPS7evAMmuqXLSVpGmPbS ef8QRRNQUSx7ZUDHTAczTGPwFrVZG+jpnjmbjorUeFYWSgjMUOl1zMueH5X5NLHTa1/f AgKlmcqZHuJR9XAUHu89RBBPKAGZ8ODmK5UKs40EKRcQOVigM0rkX5gsdzDXUyxAViNu 2HY2DSOiZg6Fc6zAx2gerBl9qbzsikDkl65AMYpEyPAmb+lyvsX+DO85YWWP1s+3s4rz ES0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685029281; x=1687621281; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IGxbiqGMkKYf02xQ8jmP+1cjWMBkw0vK+f7mNuPZKsU=; b=It7Z4nQ/8OIdDJwLd+UU3nR95xoL6jZZEI/kuI9a/7l62sACGGNz9AGhzWtchMhIFt ZJwVUGA5TQLPWP4FOf8Yu3psWzfVLjJMjU9kLA26POCVaqZb4V3bxQRc3rS1IKrVzonv G3deyzl7yHO5PVABUJ6VocAgpRTFM0iTanT3MZD6/NHnHaURlAUvRAQmUNgZUEGBRkr5 9EAUsQxoWtf6G1ZQ7BluQSk3henerM+nn1RgrkByTxl2Qg+lGAEU/cYK4agArcdK2lr0 jeAE5PSO/Xy+pfHF2bHeqx7roUNJytlIVyMJjhBuicwr0DewhkHGgzzHnNXnXSjopADn Eemw== X-Gm-Message-State: AC+VfDwaQzdqbY0rS7gQCqcP4oBJ57DaA2WpIHc78xk8HARHYcY9uD7v bFuZhPpD7pRFDS4jnUme9HVJJoc0AEs= X-Google-Smtp-Source: ACHHUZ49WiwBhudrYrPWaB2bb2oNVSnz7fSIcpvsObs/F4GdWCP+Sj/rmmxmtEPHg/TfRStFd8ncBA== X-Received: by 2002:a5d:6208:0:b0:2f9:59a3:eb30 with SMTP id y8-20020a5d6208000000b002f959a3eb30mr13358506wru.0.1685029280975; Thu, 25 May 2023 08:41:20 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id q2-20020adff502000000b003062c0ef959sm2172258wro.69.2023.05.25.08.41.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 08:41:20 -0700 (PDT) From: Simon Tournier Date: Thu, 25 May 2023 17:41:12 +0200 Message-Id: <27b0652df204a77a5b38554a95128fb54ca64dd9.1685029183.git.zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.39.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: , 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 From: Stephen Paul Weber * guix/import/go.scm (vcs->origin): New argument module-path-subdirectory. Use it to get Git tag as described by . Signed-off-by: Simon Tournier --- guix/import/go.scm | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/guix/import/go.scm b/guix/import/go.scm index c6258296f6..f02c098f1c 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2021-2022 Ludovic Courtès ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2021 Sarah Morgensen +;;; Copyright © 2022 Stephen Paul Weber ;;; Copyright © 2021, 2023 Simon Tournier ;;; ;;; This file is part of GNU Guix. @@ -522,28 +523,34 @@ (define* (git-checkout-hash url reference algorithm) (nix-base32-string->bytevector "0000000000000000000000000000000000000000000000000000")))) -(define (vcs->origin vcs-type vcs-repo-url version) +(define (vcs->origin vcs-type vcs-repo-url module-path-subdirectory 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))) + (let* ((plain-version? (string=? version (go-version->git-ref version))) + (v-prefixed? (string-prefix? "v" version)) + ;; A module in a subdirectory has a tag prefixed by this + ;; subdirectory. See . + (tag-prefix (if (string=? module-path-subdirectory "") ; + "" + (string-append + (substring module-path-subdirectory 1) "/"))) + (git-commit (if plain-version? + (string-append tag-prefix version) + (go-version->git-ref 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) + `(string-append ,tag-prefix "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) + (git-checkout-hash vcs-repo-url git-commit (hash-algorithm sha256)))))))) ((hg) `(origin @@ -621,12 +628,17 @@ (define* (go-module->guix-package module-path #:key dependencies+versions (map car dependencies+versions))) (module-path-sans-suffix - (match:prefix (string-match "([\\./]v[0-9]+)?$" module-path))) + (if (string-prefix? "gopkg.in" module-path) + module-path + (match:prefix (string-match "([\\./]v[0-9]+)?$" module-path)))) (guix-name (go-module->guix-package-name module-path)) - (root-module-path (module-path->repository-root module-path)) + (root-module-path (module-path->repository-root module-path-sans-suffix)) ;; The VCS type and URL are not included in goproxy information. For ;; this we need to fetch it from the official module page. (meta-data (fetch-module-meta-data root-module-path)) + (module-path-subdirectory + (substring module-path-sans-suffix + (string-length (module-meta-import-prefix meta-data)))) (vcs-type (module-meta-vcs meta-data)) (vcs-repo-url (module-meta-data-repo-url meta-data goproxy)) (synopsis (go-package-synopsis module-path)) @@ -637,7 +649,7 @@ (define* (go-module->guix-package module-path #:key (name ,guix-name) (version ,(strip-v-prefix version*)) (source - ,(vcs->origin vcs-type vcs-repo-url version*)) + ,(vcs->origin vcs-type vcs-repo-url module-path-subdirectory version*)) (build-system go-build-system) (arguments '(#:import-path ,module-path