From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id 8Bl6F2KncWVimAAAauVa8A:P1 (envelope-from ) for ; Thu, 07 Dec 2023 12:07:14 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 8Bl6F2KncWVimAAAauVa8A (envelope-from ) for ; Thu, 07 Dec 2023 12:07:14 +0100 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 0D13439AD3 for ; Thu, 7 Dec 2023 12:07:14 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=iN7QF+0C; dmarc=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=1701947234; 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=dI+e32aqtj6wR5xXJcetv6e2EF+4GqCniYcw+BDtkMo=; b=S8GvlxYwQrMNrhZ6v4ljGd1OBYM80Ly3HRP14trAdkzC2xY3giII+UPXYI6paegl0+J/tC RpsJATAomiK0rBzhT7/osImZWNOj7s9FDkHev6AWesVwJAlulkxiSB0pNl0/eP3/xyXUNO tYZvH/yTIRhMytiDrM007gnouIP1i4XrK1akCIjNDTqgzB35V/lUjkDsgVKWjUWE2kYyo+ Yw8A1KxS5VvC+zgnL/nnXx86GDznPYH3d22bocaS2Ge1a4OiMnsaQdcSRDzRICAbOfAUU1 9+xORONVF0GnTd6ZVC7c+hFGdoJ+euCOD0Z+OQviaOkBJ+qrq5SBt7wGv/j/ng== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1701947234; a=rsa-sha256; cv=none; b=qF6BTJxy1O4u6ICPBauw3Y4cZwGDlrNQxx8fdegZSktfH/PND6Wn2Y12nTwFZsg7i/I1jt DYODYwImXFqZgk7GCMxNusVKNdTKRHdO/IC+xqz1m3wQiRcjyTNeNSJedma3Jfy6IKrXg3 xYIO5emlitv8q6pSJl63hk9m4djS5ICKloHy+TjslRLkUH5+jnwgl4iD2miFULXm/JmOY+ YqhB+3pUSoUE0AjUMzDsBD9IeefQWLmHys/dQh+VAOkh49dyIlM3Dznr9Z/TAWMLR4dVpY EfKxhgKxhvm0jKt9iuiDL4mv3YK96GZDNnTujp0oOK3rqqQg04qEznMJIbpRBA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=iN7QF+0C; dmarc=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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rBCDU-0001Oh-3k; Thu, 07 Dec 2023 06:06:52 -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 1rBCDS-0001NV-18 for guix-patches@gnu.org; Thu, 07 Dec 2023 06:06:50 -0500 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 1rBCDR-00041C-OJ for guix-patches@gnu.org; Thu, 07 Dec 2023 06:06:49 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rBCDe-0006hS-0K; Thu, 07 Dec 2023 06:07:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67503] [PATCH v2 2/2] guix: import: Report go version for go importer. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: cox.katherine.e+guix@gmail.com, guix-patches@gnu.org Resent-Date: Thu, 07 Dec 2023 11:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67503 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67503@debbugs.gnu.org Cc: Efraim Flashner , Katherine Cox-Buday X-Debbugs-Original-Xcc: Katherine Cox-Buday Received: via spool by 67503-submit@debbugs.gnu.org id=B67503.170194716425663 (code B ref 67503); Thu, 07 Dec 2023 11:07:01 +0000 Received: (at 67503) by debbugs.gnu.org; 7 Dec 2023 11:06:04 +0000 Received: from localhost ([127.0.0.1]:41191 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBCCh-0006fq-FR for submit@debbugs.gnu.org; Thu, 07 Dec 2023 06:06:03 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:45278) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBCCe-0006fE-JQ for 67503@debbugs.gnu.org; Thu, 07 Dec 2023 06:06:02 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40c2c65e6aaso2099875e9.2 for <67503@debbugs.gnu.org>; Thu, 07 Dec 2023 03:05:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701947142; x=1702551942; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=dI+e32aqtj6wR5xXJcetv6e2EF+4GqCniYcw+BDtkMo=; b=iN7QF+0CycHuz7k2t9SlbEIOr1RtAxhvBtEaJoaGK12Euj/ALmcIZNgkPLOedBPUK+ 5JB6tD3cYvkv0CIvEZC/3vAey+v9ZZbd3QJO+x0hacU2oimrJPaVw8lx9a7Vj3P9d/J3 g2A33juzIPuv9dohTWQUmEs3Id7/QEUarelO3GXhT0mUF7d6G81ZzyMDtJbxTMIACSdX ZC1MFKvHWL7ndZraGRYo+4fUlQNLOoxgSTblhTCbdB3rVGDpJqJL89uTjwbnLAzjewZ3 Cd/42IO4ynvt0Bu76Qi82wXxTeDRnXtwqw0zG1UfpbBgswh+c4/0Dkhz0z7zeT3YzG+B 5FLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701947142; x=1702551942; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=dI+e32aqtj6wR5xXJcetv6e2EF+4GqCniYcw+BDtkMo=; b=Xw8MMSYPtzKu6LA6arkJ9mKIyKvxtCmyBqfH+HPMYh1RCqxTmWhDst5DswtsjdrcGd HeCFt4eKkhsFz+psiOKYnnEAWqR2ltS+7AWEKS8ViQiLuR9MZHRlfCRYjtzoc13vr6tD WTHfCyEInbXiohoNAoRIdiwENlhqtAn81to6cFtS70mXtNSoRYJ6iS10GWFOiKKpUezY Dreo5CwchnOdskqmDTlz6VsmINL2uYrDdHdqltXe13QSfDBQFzGlvOdvdo7ku79GPjIl G5uy7m4Zc0eBadz+ZKx0V4K2ttiIQ+KQVVNEOqd1hc8p/HePjM0XiAY9iaoUil6T0gUF WWSA== X-Gm-Message-State: AOJu0Yx+8XGEIVS2+gnkHNEPSqVphd0RikapIhpXw23AZkQoUyXGeGVG SQUsJ2i6fKbTv/1iBYoKPJH5LXADWo3m7g== X-Google-Smtp-Source: AGHT+IHlnVbjO4OEBCNtv1c/oZeI6XHw3SC3fz+8Y9STu4QjhrmoM6bU7e8QZQD9D11Bbs+jq9EKrQ== X-Received: by 2002:a05:600c:1f16:b0:40c:1e66:4dd5 with SMTP id bd22-20020a05600c1f1600b0040c1e664dd5mr1186957wmb.216.1701947142451; Thu, 07 Dec 2023 03:05:42 -0800 (PST) Received: from localhost ([188.120.129.233]) by smtp.gmail.com with ESMTPSA id k18-20020a5d5252000000b0033330846e76sm1140401wrc.86.2023.12.07.03.05.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 03:05:42 -0800 (PST) From: Efraim Flashner Date: Thu, 7 Dec 2023 13:05:26 +0200 Message-ID: <2c3f8637eea1edd83116fc055a873b827266f977.1701412758.git.efraim@flashner.co.il> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: -4.15 X-Spam-Score: -4.15 X-Migadu-Queue-Id: 0D13439AD3 X-TUID: M5ZLl49jmzID * guix/import/go.scm (go-package, go.mod-go-version): New procedures. (go-module->guix-package): Add the #:go keyword in the generated package definition if the required go is newer than the default go. * tests/go.scm (mock-http-get): Use gexps for package arguments. Change-Id: I8d005740a442330ac307a40a53764c803ceffc4f --- guix/import/go.scm | 31 ++++++++++++++++++++++++++----- tests/go.scm | 6 +++--- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/guix/import/go.scm b/guix/import/go.scm index 940cdac4b0..dd9298808d 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -29,6 +29,7 @@ (define-module (guix import go) #:use-module (guix git) #:use-module (guix hash) #:use-module (guix i18n) + #:use-module ((guix utils) #:select (version>?)) #:use-module (guix diagnostics) #:use-module (guix import utils) #:use-module (guix import json) @@ -93,6 +94,11 @@ (define-module (guix import go) ;;; Code: +(define (go-package) + "Return the 'go' package. This is a lazy reference so that we don't +depend on (gnu packages golang)." + (module-ref (resolve-interface '(gnu packages golang)) 'go)) + (define http-fetch* ;; Like http-fetch, but memoized and returning the body as a string. (memoize (lambda args @@ -314,7 +320,7 @@ (define (parse-go.mod content) (define-peg-pattern with all (or (and module-path version) file-path)) (define-peg-pattern replace all (and original => with EOL)) (define-peg-pattern replace-top body - (and (ignore "replace") + (and (ignore "replace") (or (and block-start (* (or replace block-line)) block-end) replace))) ;; RetractSpec = ( Version | "[" Version "," Version "]" ) newline . @@ -378,6 +384,17 @@ (define (go.mod-requirements go.mod) ;; Prevent inlining of this procedure, which is accessed by unit tests. (set! go.mod-requirements go.mod-requirements) +(define (go.mod-go-version go.mod) + "Return the minimum version of go required to specified by GO.MOD." + (let ((go-version (go.mod-directives go.mod 'go))) + (if (null? go-version) + ;; If the go directive is missing, go 1.16 is assumed. + '(version "1.16") + (flatten go-version)))) + +;; Prevent inlining of this procedure, which is accessed by unit tests. +(set! go.mod-go-version go.mod-go-version) + (define-record-type (%make-vcs url-prefix root-regex type) vcs? @@ -610,6 +627,7 @@ (define* (go-module->guix-package module-path #:key available-versions module-path)) (content (fetch-go.mod goproxy module-path version*)) + (min-go-version (second (go.mod-go-version (parse-go.mod content)))) (dependencies+versions (go.mod-requirements (parse-go.mod content))) (dependencies (if pin-versions? dependencies+versions @@ -634,10 +652,13 @@ (define* (go-module->guix-package module-path #:key ,(vcs->origin vcs-type vcs-repo-url version*)) (build-system go-build-system) (arguments - '(#:import-path ,module-path - ,@(if (string=? module-path-sans-suffix root-module-path) - '() - `(#:unpack-path ,root-module-path)))) + (list ,@(if (version>? min-go-version (package-version (go-package))) + `(#:go ,(string->number min-go-version)) + '()) + #:import-path ,module-path + ,@(if (string=? module-path-sans-suffix root-module-path) + '() + `(#:unpack-path ,root-module-path)))) ,@(maybe-propagated-inputs (map (match-lambda ((name version) diff --git a/tests/go.scm b/tests/go.scm index a70a0ddbf5..d2e8846b30 100644 --- a/tests/go.scm +++ b/tests/go.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2021 François Joulaud -;;; Copyright © 2021 Sarah Morgensen +;;; Copyright © 2021 François Joulaud +;;; Copyright © 2021 Sarah Morgensen ;;; ;;; This file is part of GNU Guix. ;;; @@ -387,7 +387,7 @@ (define (mock-http-get testcase) "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5")))) (build-system go-build-system) (arguments - '(#:import-path "github.com/go-check/check")) + (list #:import-path "github.com/go-check/check")) (propagated-inputs `(("go-github-com-kr-pretty" ,go-github-com-kr-pretty))) (home-page "https://github.com/go-check/check") -- Efraim Flashner רנשלפ ××™×¨×¤× GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted