From patchwork Tue May 3 11:42:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 39097 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 3B4E427BBEA; Tue, 3 May 2022 12:44:42 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,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 06BE027BBE9 for ; Tue, 3 May 2022 12:44:42 +0100 (BST) Received: from localhost ([::1]:46054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlqxN-00040t-4p for patchwork@mira.cbaines.net; Tue, 03 May 2022 07:44:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlqwl-0003dT-56 for guix-patches@gnu.org; Tue, 03 May 2022 07:44:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44941) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlqwk-0002RK-T3 for guix-patches@gnu.org; Tue, 03 May 2022 07:44:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nlqwk-0005Py-Oh for guix-patches@gnu.org; Tue, 03 May 2022 07:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55242] [PATCH 03/10] guix: import: go: Add mockup logging facility. Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 03 May 2022 11:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55242 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55242@debbugs.gnu.org Cc: Attila Lendvai Received: via spool by 55242-submit@debbugs.gnu.org id=B55242.165157821120693 (code B ref 55242); Tue, 03 May 2022 11:44:02 +0000 Received: (at 55242) by debbugs.gnu.org; 3 May 2022 11:43:31 +0000 Received: from localhost ([127.0.0.1]:38818 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwE-0005Nb-Nk for submit@debbugs.gnu.org; Tue, 03 May 2022 07:43:31 -0400 Received: from mail-ed1-f41.google.com ([209.85.208.41]:44919) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwC-0005N5-06 for 55242@debbugs.gnu.org; Tue, 03 May 2022 07:43:28 -0400 Received: by mail-ed1-f41.google.com with SMTP id t5so8893499edw.11 for <55242@debbugs.gnu.org>; Tue, 03 May 2022 04:43:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ciL5s8kgsW0EDkkrAmCGv6Qfsm0IiCBAXD36VWmnSq8=; b=I26vDRqvmntuLghbcECWaWiMcRyXYxoSTzZPIDorxAb452nqNdKWJsbeTbkIZR85VB ydhg8JHYH39nn6bS1bHBhqdeCKitlf+lHm1Gtf+zDy6jSQXmL6lVnAZk+CLUJfAPTBKa V2EebBIW0aJRtLco7xtp50sgSpyLm7uM4EeRzOf8zAhLFvZZuruReLWL728W/8pKyIIQ L3RoYqhcF2ACd9QhsSrWyyWbSpYmZX3klmLTGe++A3XA/dBz9ToWWqozMvQNKil4zq75 6RnKlVAEhucVc3AbSKipPcxQ+IixImlyEqT80jMi11ix/JYQRMQSTOMzGmPOCWYasqv0 pWPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ciL5s8kgsW0EDkkrAmCGv6Qfsm0IiCBAXD36VWmnSq8=; b=XBuc4fycRkprDbEiex1vCCvLNNYJdO867NfG0Xqb4gPqahy6DY17JAuMcrbno+MB6m OATOCKBFq8ryMrcKEJ3/ygx9LZTldZu2xE290m6Kxszfg59Ard8RE8jmI1iL4+H00AB+ y+lf0+nVxOxoJIBQm++DgecQMyqHG698NBekW+sZaSfmITiKxcJO20U3hq0rogdFR2eI J5b8weJYqJ/lrii+4J7ZSrNxXM3oai471fm5bFbTCeGvjMMgmtFmgWMZ8V8X49/ep14u c513sp9HjiPk7HDHCoTCpXyKPb8grBZLhUnROAIkvCYCselg8M5Z0EUnXunggOhs30sg fcMw== X-Gm-Message-State: AOAM5300aP/KMM9SRAYWgWpICPenaP2ZUIaYFrwougUOi1RfVqmMCbhe qU0RFsggJmcgUAz5q5m+uQ3z/3T+3OM= X-Google-Smtp-Source: ABdhPJw6EErevOKNEI+PBV7igXU/Ydu5XZXbb2T7GLy6jOvBrrefjw/XMAhqeCcEST/fdaPglRNfag== X-Received: by 2002:a05:6402:1385:b0:413:2bc6:4400 with SMTP id b5-20020a056402138500b004132bc64400mr17907660edv.94.1651578202388; Tue, 03 May 2022 04:43:22 -0700 (PDT) Received: from lelap.local (catv-89-132-245-188.catv.fixed.vodafone.hu. [89.132.245.188]) by smtp.gmail.com with ESMTPSA id k13-20020a05640212cd00b0042617ba63d6sm7766964edx.96.2022.05.03.04.43.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 May 2022 04:43:21 -0700 (PDT) From: Attila Lendvai Date: Tue, 3 May 2022 13:42:54 +0200 Message-Id: <20220503114301.9524-3-attila@lendvai.name> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220503114301.9524-2-attila@lendvai.name> References: <20220503114301.9524-2-attila@lendvai.name> 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" X-getmail-retrieved-from-mailbox: Patches Introduce a (local) mockup logger, so that we don't need to keep adding and deleting format's when debugging the codebase. * guix/import/go.scm (log.info) (log.debug): New macros. --- guix/import/go.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/guix/import/go.scm b/guix/import/go.scm index bb4bb7bb7b..0af5e4b5e2 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -100,6 +100,17 @@ (define-module (guix import go) ;;; Code: +;; FIXME set up logging for the entire project, and replace this poor man's +;; logger with the proper one. +(define-syntax-rule (log.info format-string ...) + (let ((port (current-warning-port))) + (format port format-string ...) + (newline port))) + +(define-syntax-rule (log.debug format-string ...) + ;;(log.info format-string ...) + '()) + (define http-fetch* ;; Like http-fetch, but memoized and returning the body as a string. (memoize (lambda args From patchwork Tue May 3 11:42:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 39099 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 84CEE27BBEA; Tue, 3 May 2022 12:45:03 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,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 BA05C27BBE9 for ; Tue, 3 May 2022 12:45:02 +0100 (BST) Received: from localhost ([::1]:46710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlqxh-0004TU-To for patchwork@mira.cbaines.net; Tue, 03 May 2022 07:45:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlqwm-0003e8-BD for guix-patches@gnu.org; Tue, 03 May 2022 07:44:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44944) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlqwm-0002Rl-39 for guix-patches@gnu.org; Tue, 03 May 2022 07:44:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nlqwm-0005QK-0z for guix-patches@gnu.org; Tue, 03 May 2022 07:44:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55242] [PATCH 04/10] guix: import: go: Fix the interpretation of the replace directive. Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 03 May 2022 11:44:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55242 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55242@debbugs.gnu.org Cc: Attila Lendvai Received: via spool by 55242-submit@debbugs.gnu.org id=B55242.165157821420744 (code B ref 55242); Tue, 03 May 2022 11:44:03 +0000 Received: (at 55242) by debbugs.gnu.org; 3 May 2022 11:43:34 +0000 Received: from localhost ([127.0.0.1]:38828 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwH-0005OQ-Rn for submit@debbugs.gnu.org; Tue, 03 May 2022 07:43:34 -0400 Received: from mail-ed1-f52.google.com ([209.85.208.52]:45618) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwF-0005NC-BF for 55242@debbugs.gnu.org; Tue, 03 May 2022 07:43:31 -0400 Received: by mail-ed1-f52.google.com with SMTP id be20so19512279edb.12 for <55242@debbugs.gnu.org>; Tue, 03 May 2022 04:43:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8AS+bwnBiW5h+Jn9QhXNURpZsGBqogHAd3TY/Q7wtEY=; b=C19XHXcA/cNVDwDQvPxJJpiWHtY6GonPU7F7BeeyFBWvM37XC5AClRL67+5wCfPyW9 R5h/sjmrfFZcMbCfq3SremekjAKZOHTG23TJgXKjboWP4f3JFyq2oXT1SDLGgNPJjvpB FkmN8AhgnxiOxRPSMks5A5tph1Bi/Ziw+OBUEGE/Y6LOfAB9Pb3scSOXgRnmtbQ0tKRT aU+dQBgZxoNOn5k5iUAQnHs9ge1wcng5h37CErZ19IJcCTU1GydYRGficAXecb/U0y0k JHF43HVCx8zJE66zN/HVMIXPnPKchqYrSerJIfjyPUW0V28f7F0mQupVg6pztYxXgJm3 c/Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8AS+bwnBiW5h+Jn9QhXNURpZsGBqogHAd3TY/Q7wtEY=; b=miQ1w/q7gH5hwJCahplA7jV/7F1un/7zvkVIhyhmYVUcfykwwmK1TQ+qXx8tM2nblU HsiFJ54/0OHb78P5ktjFkerbE7VgoJsXssPMRIAWDk7/hLHETLwMJ9P9mB8+Ua5j/nWW 0wyTcLFsTSII+K6oxgWi+qkS7heFn2fiX44PX0oB64ko+yTikxHRgMQ2nUKH+A2Yzj0W QuNiwKRGSaTtlruE2On47sOfzTVvWGVRPTCrmLK/SXVKShtCtg+LiLOS4dUpjd8Ezzim 1U0haHGeYNgsvxOOnqD9mlxeqTI6G31LhhOcxUWyzNfyhs/DxvRRgqwZMGarbm8YpBwo ZrLg== X-Gm-Message-State: AOAM533y5RhXnDvc6wUePh/AGtHY7o0PhdgBRgHY7J+xDORQoKKAlO97 27ueZLhqSLZ+bK/kY8W6AbLkP2+rfXk= X-Google-Smtp-Source: ABdhPJxiuCX6iWHRvhew9WfO5GSHkg2C7tORKzfWdFVbha2m52btbQeb4RjmN/AMXn6/nKAxHx4PGg== X-Received: by 2002:a05:6402:84a:b0:426:262d:967e with SMTP id b10-20020a056402084a00b00426262d967emr17646593edz.286.1651578203253; Tue, 03 May 2022 04:43:23 -0700 (PDT) Received: from lelap.local (catv-89-132-245-188.catv.fixed.vodafone.hu. [89.132.245.188]) by smtp.gmail.com with ESMTPSA id k13-20020a05640212cd00b0042617ba63d6sm7766964edx.96.2022.05.03.04.43.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 May 2022 04:43:22 -0700 (PDT) From: Attila Lendvai Date: Tue, 3 May 2022 13:42:55 +0200 Message-Id: <20220503114301.9524-4-attila@lendvai.name> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220503114301.9524-2-attila@lendvai.name> References: <20220503114301.9524-2-attila@lendvai.name> 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" X-getmail-retrieved-from-mailbox: Patches When a version is specified in a replace directive, then we must also match the version against any potential replacements. * guix/import/go.scm (go.mod-requirements): Fix by also matching the version. --- guix/import/go.scm | 53 +++++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/guix/import/go.scm b/guix/import/go.scm index 0af5e4b5e2..a115c61adc 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -331,7 +331,7 @@ (define-peg-pattern original all (or (and module-path version) module-path)) (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 . @@ -365,22 +365,39 @@ (define (go.mod-directives go.mod directive) (define (go.mod-requirements go.mod) "Compute and return the list of requirements specified by GO.MOD." (define (replace directive requirements) - (define (maybe-replace module-path new-requirement) - ;; Do not allow version updates for indirect dependencies (see: - ;; https://golang.org/ref/mod#go-mod-file-replace). - (if (and (equal? module-path (first new-requirement)) - (not (assoc-ref requirements module-path))) - requirements - (cons new-requirement (alist-delete module-path requirements)))) - + ;; Specification: https://golang.org/ref/mod#go-mod-file-replace + ;; Interesting test cases: + ;; github.com/influxdata/influxdb-client-go/v2@v2.4.0 + (log.debug "inside replace, directive ~S, requirements ~S" directive requirements) + (define (maybe-replace old-module-path old-version new-module-path new-version) + (let ((matched-entry (assoc-ref requirements old-module-path))) + (log.debug "inside maybe-replace, ~S ~S => ~S ~S, matched-entry ~S" + old-module-path old-version new-module-path new-version matched-entry) + (cond ((and (equal? old-module-path new-module-path) + (not matched-entry)) + ;; "A replace directive has no effect if the module version on the left + ;; side is not required." + ;; Do not allow version updates for indirect dependencies. + requirements) + ((and matched-entry + (or (not old-version) + (equal? old-version new-version))) + (cons (list new-module-path new-version) + (alist-delete old-module-path requirements))) + (else + requirements)))) + (log.debug "toplevel directive is ~S" directive) (match directive - ((('original ('module-path module-path) . _) with . _) + ((('original ('module-path old-module-path) ('version old-version) ...) with) + (unless (null? old-version) + (set! old-version (first old-version))) (match with - (('with ('file-path _) . _) - (alist-delete module-path requirements)) - (('with ('module-path new-module-path) ('version new-version) . _) - (maybe-replace module-path - (list new-module-path new-version))))))) + (('with ('file-path _)) + ;; Superseded by a module in a local path, so let's delete it. + (alist-delete old-module-path requirements)) + (('with ('module-path new-module-path) ('version new-version)) + (maybe-replace old-module-path old-version + new-module-path new-version)))))) (define (require directive requirements) (match directive @@ -389,8 +406,10 @@ (define (require directive requirements) (let* ((requires (go.mod-directives go.mod 'require)) (replaces (go.mod-directives go.mod 'replace)) - (requirements (fold require '() requires))) - (fold replace requirements replaces))) + (requirements (fold require '() requires)) + (result (fold replace requirements replaces))) + (log.debug "requires:~% ~S~%replaces:~% ~S~%result:~% ~S" requires replaces result) + result)) ;; Prevent inlining of this procedure, which is accessed by unit tests. (set! go.mod-requirements go.mod-requirements) From patchwork Tue May 3 11:42:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 39102 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 2690727BBEA; Tue, 3 May 2022 12:50:57 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,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 E787E27BBE9 for ; Tue, 3 May 2022 12:50:56 +0100 (BST) Received: from localhost ([::1]:48616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlr3Q-0006BM-52 for patchwork@mira.cbaines.net; Tue, 03 May 2022 07:50:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlqwl-0003dg-HL for guix-patches@gnu.org; Tue, 03 May 2022 07:44:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44942) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlqwl-0002RQ-8c for guix-patches@gnu.org; Tue, 03 May 2022 07:44:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nlqwl-0005Q5-6l for guix-patches@gnu.org; Tue, 03 May 2022 07:44:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55242] [PATCH 05/10] guix: import: go: Harden sxml->texi conversion. Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 03 May 2022 11:44:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55242 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55242@debbugs.gnu.org Cc: Attila Lendvai Received: via spool by 55242-submit@debbugs.gnu.org id=B55242.165157821220716 (code B ref 55242); Tue, 03 May 2022 11:44:03 +0000 Received: (at 55242) by debbugs.gnu.org; 3 May 2022 11:43:32 +0000 Received: from localhost ([127.0.0.1]:38822 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwG-0005O4-2u for submit@debbugs.gnu.org; Tue, 03 May 2022 07:43:32 -0400 Received: from mail-ed1-f42.google.com ([209.85.208.42]:34329) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwD-0005N7-Ke for 55242@debbugs.gnu.org; Tue, 03 May 2022 07:43:29 -0400 Received: by mail-ed1-f42.google.com with SMTP id a21so19525563edb.1 for <55242@debbugs.gnu.org>; Tue, 03 May 2022 04:43:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l8EBOt5SVXWzpaDhx/Bhrgf83/rE3rCzepMLOfV+yCc=; b=AnPL6C6a0VvRTC5OJaMcI5ikMZDsRmcY4TNvZl2eUXHxwUJrI/73kBs1seZuRxZzJe pYdcWlhnMify8Ogen1ulhnNJ10841tb5TEb6+BClw8F6wYps4aJfqGXV1egtDtHYJuEx tHo6wakwsxti7L+sROcRdQ0+XDoqOvxfluvGnaPYEmA9mSmv40ZQLCYZnPX0rsqd4K2A Pjx3jR8kvNvtNkJJgsQr82yQyUTE1QVQM5C2aITH8FCUtX2YrGw8QyH8o2/oDYlIdDad eB7q11GYcbprjcS+om+SiP+0ffHesrrLh7VeW1cJNzbL7PWfHcaKDMIgr7L+VmBouH1z WiaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=l8EBOt5SVXWzpaDhx/Bhrgf83/rE3rCzepMLOfV+yCc=; b=LNa4spye5B8UMcq+gz1vqYjw2taZsUHfSbZ0RpiO/cTHIMsi9mosUbbaHNicn4lEHs iXhw3F/Zy7v8c/7kn4FH+rVBv4J/+0X/moOwUmfo0UAwzYxlGnFzgdysN/y3gUtZDFmN RXOhXLAOKp9UzHAWwmviG9ODOYhZ1KdxYrX3XCx5J4oPSCeN8LwsfIBrM+1YctyUEjUm NXV1YGRBZBUeStGImRfvk7N2cOrF12MsuLv9Z8PjHuH4Vva/kfjn8n8rV4q3zJZx0NVF vu+gRxrYyqyEoNCZXZFKyiQhHYqyrFKLLPL5eVpz7BpgaoqFnItpxQxFsJXj6iDGTkbT 7n/w== X-Gm-Message-State: AOAM530tHTpc1qIxQb/LueJJs9A/2rR53Jxeyw9lBEzSzEvYVFvD/B0i wkEyjJQgmpNG1ZSl7DF7WkaKoS+uSUQ= X-Google-Smtp-Source: ABdhPJyiF6hFnrR6qsZw7KZ2CKW6ZpWVIHoS4lW2O+m2Me6l/HPUiVOMsskzxKz8pElVyAUNPWL6Vw== X-Received: by 2002:a50:8a96:0:b0:425:e046:76d9 with SMTP id j22-20020a508a96000000b00425e04676d9mr17531066edj.115.1651578204017; Tue, 03 May 2022 04:43:24 -0700 (PDT) Received: from lelap.local (catv-89-132-245-188.catv.fixed.vodafone.hu. [89.132.245.188]) by smtp.gmail.com with ESMTPSA id k13-20020a05640212cd00b0042617ba63d6sm7766964edx.96.2022.05.03.04.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 May 2022 04:43:23 -0700 (PDT) From: Attila Lendvai Date: Tue, 3 May 2022 13:42:56 +0200 Message-Id: <20220503114301.9524-5-attila@lendvai.name> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220503114301.9524-2-attila@lendvai.name> References: <20220503114301.9524-2-attila@lendvai.name> 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" X-getmail-retrieved-from-mailbox: Patches * guix/import/go.scm (sxml->texi): Escape @ as @@, and only emit the text part of URLs if they are plain strings. --- guix/import/go.scm | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/guix/import/go.scm b/guix/import/go.scm index a115c61adc..6b0fbaa8b6 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -172,13 +172,26 @@ (define (sxml->texi sxml-node) "A very basic SXML to Texinfo converter which attempts to preserve HTML formatting and links as text." (sxml-match sxml-node - ((strong ,text) - (format #f "@strong{~a}" text)) - ((a (@ (href ,url)) ,text) - (format #f "@url{~a,~a}" url text)) - ((code ,text) - (format #f "@code{~a}" text)) - (,something-else something-else))) + ((strong ,text) + (format #f "@strong{~a}" text)) + ((a (@ (href ,url)) ,body) + ;; Examples: image in the url: github.com/go-openapi/jsonpointer + ;; (code ...) in the URL body: github.com/mwitkow/go-conntrack + (if (string? body) + (format #f "@url{~a,~a}" url body) + (sxml-match body + ((code ,text) + (format #f "@url{~a,~a}" url (sxml->texi body))) + (,_ + (format #f "@url{~a}" url))))) + ((code ,text) + (format #f "@code{~a}" text)) + (,something-else + ;; Example: @ in the description: github.com/ethersphere/langos + (if (string? something-else) + (string-replace-substring something-else + "@" "@@") + something-else)))) (define (go-package-description name) "Retrieve a short description for NAME, a Go package name, From patchwork Tue May 3 11:42:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 39098 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 C3CFD27BBEA; Tue, 3 May 2022 12:44:50 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,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 29C6227BBE9 for ; Tue, 3 May 2022 12:44:50 +0100 (BST) Received: from localhost ([::1]:46440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlqxV-0004I0-B4 for patchwork@mira.cbaines.net; Tue, 03 May 2022 07:44:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlqwl-0003dv-VB for guix-patches@gnu.org; Tue, 03 May 2022 07:44:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44943) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlqwl-0002Rc-M8 for guix-patches@gnu.org; Tue, 03 May 2022 07:44:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nlqwl-0005QC-K3 for guix-patches@gnu.org; Tue, 03 May 2022 07:44:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55242] [PATCH 06/10] guix: import: go: Add a local duplicate of http-fetch. Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 03 May 2022 11:44:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55242 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55242@debbugs.gnu.org Cc: Attila Lendvai Received: via spool by 55242-submit@debbugs.gnu.org id=B55242.165157821320737 (code B ref 55242); Tue, 03 May 2022 11:44:03 +0000 Received: (at 55242) by debbugs.gnu.org; 3 May 2022 11:43:33 +0000 Received: from localhost ([127.0.0.1]:38826 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwH-0005OH-Af for submit@debbugs.gnu.org; Tue, 03 May 2022 07:43:33 -0400 Received: from mail-ed1-f44.google.com ([209.85.208.44]:39809) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwE-0005N9-Gz for 55242@debbugs.gnu.org; Tue, 03 May 2022 07:43:31 -0400 Received: by mail-ed1-f44.google.com with SMTP id g20so19511897edw.6 for <55242@debbugs.gnu.org>; Tue, 03 May 2022 04:43:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gdXWK8w8gBi+z5S1dgCIitSmkMrxIP2VPhd8XbARarQ=; b=HyT0crT8mm3ccVqm4+LrFQX4+WiSxtSoDxXeiDCKMi0m0+yfRxgHbU335LD3UyA2qS faSoQOL1S7Ic4iyEgX8MymFdKKpsUSTMqMsy9BCttAhPXeYfJEAr7W4RkQm+YNCsa9SB o2u/iUFOjx3OOOVjJEmb4qTziWQQapiyf13ZizMbAAxUChmv28eos7AVXQ3ObP2WESNS uRc6tLh+MfV1WVZpyh1DLZgGc7EwctnBqnTVTNTywVfW+cJjUT+itpCoGytSnAwNLC4Z MPIGdy5m3WEcMeXjYAeGVL3olBC1pLNrUsf88UUT1nCjIV9MbxrdSu0iB/XkQPpfTdJY Z/UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=gdXWK8w8gBi+z5S1dgCIitSmkMrxIP2VPhd8XbARarQ=; b=Fn66oExjvWeDzNZ65FwRpVFfoi8CYxe9yIfoSz4hQ/wC2WezgBgbxltyjOg4SD5jgq D03JR5CurhRKeFmcI0EY+EN7zkrWQpfFRcCK3jCePWuhkcNGJ+rdSqoGD1yVfPll9/i6 RdiPIaatifV+Wh70PduLTFjBzkkr3MrONzbrxYKWOWDFaPueByFY55JC04eOtL5UPLcp eaMZLU8kciFXf9USIcWb+sT9tOL3hJ7uVJ8V/HEeDVD+cq7RRTL65NbpKD8Yrhh2TsA+ hSp0zxwax0C88DLL9Tq7YkGoz4DilZQA9R2+hMk2SGAjHwueimyLty5N52p9VD5zYdC9 j5NQ== X-Gm-Message-State: AOAM533iBh/q1QIpqtHKQKtmkqqikcVEBvESx7TJ0IvFPAz9SeMYlfDX ay6cJqPIHvr+Rfbe885u4P47E8OZu28= X-Google-Smtp-Source: ABdhPJw6GCQJ3tKo7W92ii6KOVMfj+EE/DhSOzgMXDjsmzwQY7qmRgluEc7ZYnlbxQhB/J6RQXdhMw== X-Received: by 2002:a05:6402:354a:b0:427:d0e1:8ef3 with SMTP id f10-20020a056402354a00b00427d0e18ef3mr7012237edd.66.1651578204809; Tue, 03 May 2022 04:43:24 -0700 (PDT) Received: from lelap.local (catv-89-132-245-188.catv.fixed.vodafone.hu. [89.132.245.188]) by smtp.gmail.com with ESMTPSA id k13-20020a05640212cd00b0042617ba63d6sm7766964edx.96.2022.05.03.04.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 May 2022 04:43:24 -0700 (PDT) From: Attila Lendvai Date: Tue, 3 May 2022 13:42:57 +0200 Message-Id: <20220503114301.9524-6-attila@lendvai.name> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220503114301.9524-2-attila@lendvai.name> References: <20220503114301.9524-2-attila@lendvai.name> 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" X-getmail-retrieved-from-mailbox: Patches This is needed when dealing with golang packages, as per: https://golang.org/ref/mod#vcs-find A page may return 404, but at the same time also contain the sought after `go-import` meta tag. An example for such a project/page is: https://www.gonum.org/v1/gonum?go-get=1 It's not enough to just handle the thrown exception, because we need to be able to get hold of the fetched content, too. Discussion why it's duplicated here: https://issues.guix.gnu.org/54836 * guix/import/go.scm (http-fetch): Add a copy and extend it with the accept-all-response-codes? param. --- guix/import/go.scm | 107 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 2 deletions(-) diff --git a/guix/import/go.scm b/guix/import/go.scm index 6b0fbaa8b6..a08005d090 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -33,13 +33,22 @@ (define-module (guix import go) #:use-module (guix import json) #:use-module (guix packages) #:use-module ((guix utils) #:select (string-replace-substring)) - #:use-module (guix http-client) + ;; FIXME? We use a local copy of http-fetch. + ;; See https://issues.guix.gnu.org/54836 + #:use-module ((guix http-client) #:hide (http-fetch)) + #:use-module (guix base64) + #:use-module (rnrs bytevectors) + #:use-module ((guix build download) + #:select (open-socket-for-uri + (open-connection-for-uri + . guix:open-connection-for-uri) + resolve-uri-reference)) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix memoization) #:autoload (htmlprag) (html->sxml) ;from Guile-Lib #:autoload (guix serialization) (write-file) #:autoload (guix base32) (bytevector->nix-base32-string) - #:autoload (guix build utils) (mkdir-p) + #:autoload (guix build utils) (mkdir-p dump-port) #:autoload (gcrypt hash) (hash-algorithm sha256) #:use-module (ice-9 format) #:use-module (ice-9 match) @@ -69,6 +78,100 @@ (define-module (guix import go) go-module->guix-package* go-module-recursive-import)) +;; This is a duplicate from (guix http-client) with the addition of a +;; #:accept-all-response-codes? param. See https://issues.guix.gnu.org/54836 +(define* (http-fetch uri #:key port (text? #f) (buffered? #t) + (open-connection guix:open-connection-for-uri) + (keep-alive? #f) + (verify-certificate? #t) + (headers '((user-agent . "GNU Guile"))) + (log-port (current-error-port)) + timeout + (accept-all-response-codes? #f)) + "Return an input port containing the data at URI, and the expected number of +bytes available or #f. If TEXT? is true, the data at URI is considered to be +textual. Follow any HTTP redirection. When BUFFERED? is #f, return an +unbuffered port, suitable for use in `filtered-port'. HEADERS is an alist of +extra HTTP headers. + +When KEEP-ALIVE? is true, the connection is marked as 'keep-alive' and PORT is +not closed upon completion. + +When VERIFY-CERTIFICATE? is true, verify HTTPS server certificates. + +TIMEOUT specifies the timeout in seconds for connection establishment; when +TIMEOUT is #f, connection establishment never times out. + +Write information about redirects to LOG-PORT. + +When ACCEPT-ALL-RESPONSE-CODES? is false then raise an '&http-get-error' +condition if downloading fails, otherwise return the response regardless +of the reponse code." + (define parsed-initial-uri + (if (string? uri) (string->uri uri) uri)) + + (define (open-connection* uri) + (open-connection uri + #:verify-certificate? verify-certificate? + #:timeout timeout)) + + (let loop ((current-uri parsed-initial-uri) + (current-port (or port (open-connection parsed-initial-uri)))) + (let ((headers (match (uri-userinfo current-uri) + ((? string? str) + (cons (cons 'Authorization + (string-append "Basic " + (base64-encode + (string->utf8 str)))) + headers)) + (_ headers)))) + (unless (or buffered? (not (file-port? current-port))) + (setvbuf current-port 'none)) + (let*-values (((resp data) + (http-get current-uri #:streaming? #t #:port current-port + #:keep-alive? keep-alive? + #:headers headers)) + ((code) + (response-code resp))) + (case code + ((200) + (values data (response-content-length resp))) + ((301 ; moved permanently + 302 ; found (redirection) + 303 ; see other + 307 ; temporary redirection + 308) ; permanent redirection + (let ((host (uri-host current-uri)) + (new-uri (resolve-uri-reference (response-location resp) + current-uri))) + (if keep-alive? + (dump-port data (%make-void-port "w0") + (response-content-length resp)) + (close-port current-port)) + (format log-port (G_ "following redirection to `~a'...~%") + (uri->string new-uri)) + (loop new-uri + (or (and keep-alive? + (or (not (uri-host new-uri)) + (string=? host (uri-host new-uri))) + current-port) + (open-connection* new-uri))))) + (else + (if accept-all-response-codes? + (values data (response-content-length resp)) + (raise (condition (&http-get-error + (uri current-uri) + (code code) + (reason (response-reason-phrase resp)) + (headers (response-headers resp))) + (&message + (message + (format + #f + (G_ "~a: HTTP download failed: ~a (~s)") + (uri->string current-uri) code + (response-reason-phrase resp))))))))))))) + ;;; Commentary: ;;; ;;; (guix import go) attempts to make it easier to create Guix package From patchwork Tue May 3 11:42:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 39096 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 5D66827BBEA; Tue, 3 May 2022 12:44:36 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,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 AC16C27BBE9 for ; Tue, 3 May 2022 12:44:35 +0100 (BST) Received: from localhost ([::1]:45690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlqxG-0003kG-Sa for patchwork@mira.cbaines.net; Tue, 03 May 2022 07:44:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlqwm-0003eo-TL for guix-patches@gnu.org; Tue, 03 May 2022 07:44:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44945) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlqwm-0002Rr-GW for guix-patches@gnu.org; Tue, 03 May 2022 07:44:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nlqwm-0005QR-Eb for guix-patches@gnu.org; Tue, 03 May 2022 07:44:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55242] [PATCH 07/10] guix: import: go: More resilience wrt network errors; add logging. Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 03 May 2022 11:44:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55242 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55242@debbugs.gnu.org Cc: Attila Lendvai Received: via spool by 55242-submit@debbugs.gnu.org id=B55242.165157821720761 (code B ref 55242); Tue, 03 May 2022 11:44:04 +0000 Received: (at 55242) by debbugs.gnu.org; 3 May 2022 11:43:37 +0000 Received: from localhost ([127.0.0.1]:38831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwI-0005OX-6f for submit@debbugs.gnu.org; Tue, 03 May 2022 07:43:37 -0400 Received: from mail-ed1-f50.google.com ([209.85.208.50]:45616) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwF-0005NB-8X for 55242@debbugs.gnu.org; Tue, 03 May 2022 07:43:31 -0400 Received: by mail-ed1-f50.google.com with SMTP id be20so19512278edb.12 for <55242@debbugs.gnu.org>; Tue, 03 May 2022 04:43:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SuK3B+RxJ2ghmZTZHTJv8kAsn1424PMUiNz8KrpJG4M=; b=A8ttGQFo4n4VYV/taagFKkrGYY5sqKLMPIveuHnanfytuV0YmGbCSUSwE+wAVYemXQ 6rs8mJZG3LIJKfBR/XJPi2ekcfecjbWPCKoYX9upfVlmuEaSRoGnH3P083Z+Gx9Oi2UI SJ7jQ6c9IsuOjmz9aPMRWi2xnwIUgiEmsYNQgySn+tmDdg7bsRwDPSzlKhBON/ZMQxC/ pxYVwT7mqz/r4m+sHlHORTkXqZuC3EkCqQDNSaY3OD/Oi0/kTBseT4FmvOgshPoF+zE5 I0Ixh0rYpPi3fA9D72qcdyIlhYGdnPCf5UKQCVREfkNbyLu58rbkx0IZ1KZwVjpz3Kjb 6mkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=SuK3B+RxJ2ghmZTZHTJv8kAsn1424PMUiNz8KrpJG4M=; b=lO+xY0bhcCKbo8JWfwCwEdCpBTiyH6sWouVPMrOuOwnB+c6d1uW4yMbc9iJpILPN/L 0w87ccbtTOImvuO3YMbapc0qBFdniTUQRtq/Ast1/CO4sQKhzcjckROfT/HJpdHlbKAL hmIzeEn/lK8VFUsqu3eeI+qZhlK2PQtpUQnTN0VtuUCNCub6MyyGevf3og31UnjQBGok 34t1ZA+YMmY4XIb/ho839+gOqsdqUb/lROP9IiKAJy1qy6Gr/DAM4edpqlKonuM0czqC soKb4p/e2QTn3j94uAqL9+HDsYwdlIyPg2NiB91VSsPrshmTqk2VosiZh5Ejk+3yyPdq w6xg== X-Gm-Message-State: AOAM5339sK/cKBwcEi2TbQQ1R0rT7boiViE8YWfLWw0TsxsAcGq26omp rxsXnCuTKbUA/Mgj0JDH1aVbVxGNnQo= X-Google-Smtp-Source: ABdhPJxJLe04AocUpwUcav0J5DP9XDhmJEq8HZevXD0vKIKCAa078b5N+/7aaSActZe9oBna8VfUZQ== X-Received: by 2002:a05:6402:35d3:b0:427:b3c7:f7f2 with SMTP id z19-20020a05640235d300b00427b3c7f7f2mr13231077edc.152.1651578205583; Tue, 03 May 2022 04:43:25 -0700 (PDT) Received: from lelap.local (catv-89-132-245-188.catv.fixed.vodafone.hu. [89.132.245.188]) by smtp.gmail.com with ESMTPSA id k13-20020a05640212cd00b0042617ba63d6sm7766964edx.96.2022.05.03.04.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 May 2022 04:43:25 -0700 (PDT) From: Attila Lendvai Date: Tue, 3 May 2022 13:42:58 +0200 Message-Id: <20220503114301.9524-7-attila@lendvai.name> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220503114301.9524-2-attila@lendvai.name> References: <20220503114301.9524-2-attila@lendvai.name> 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" X-getmail-retrieved-from-mailbox: Patches This also adds logging statements to various parts of the go importer. * guix/import/go.scm (go-module->guix-package*): Catch exceptions and retry in case of network errors. Add ability to enable printing a full backtrace when debugging. (go-module->guix-package): Tolerate the inability to fetch the synopsis and description. --- guix/import/go.scm | 104 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 86 insertions(+), 18 deletions(-) diff --git a/guix/import/go.scm b/guix/import/go.scm index a08005d090..6871132a70 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -23,7 +23,15 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . +;;; goproxy protocol: +;;; https://golang.org/ref/mod#module-proxy +;;; https://docs.gomods.io/intro/protocol/ +;;; https://roberto.selbach.ca/go-proxies/ + (define-module (guix import go) + #:use-module (git) + #:use-module (git structs) + #:use-module (git errors) #:use-module (guix build-system go) #:use-module (guix git) #:use-module (guix hash) @@ -51,6 +59,8 @@ (define-module (guix import go) #:autoload (guix build utils) (mkdir-p dump-port) #:autoload (gcrypt hash) (hash-algorithm sha256) #:use-module (ice-9 format) + #:use-module (ice-9 control) + #:use-module (ice-9 exceptions) #:use-module (ice-9 match) #:use-module (ice-9 peg) #:use-module (ice-9 rdelim) @@ -629,10 +639,14 @@ (define (go-import->module-meta content-text) (make-module-meta root-path (string->symbol vcs) (strip-.git-suffix/maybe repo-url))))) ;; - (let* ((meta-data (http-fetch* (format #f "https://~a?go-get=1" module-path))) + (let* ((url (format #f "https://~a?go-get=1" module-path)) + (meta-data (http-fetch* url #:accept-all-response-codes? #true)) (select (sxpath `(// (meta (@ (equal? (name "go-import")))) - // content)))) - (match (select (html->sxml meta-data #:strict? #t)) + // content))) + (sxml (html->sxml meta-data #:strict? #t)) + (selected (select sxml))) + (log.debug "The fetched meta-data from ~A is:~%~S" url selected) + (match selected (() #f) ;nothing selected ((('content content-text) ..1) (or @@ -809,22 +823,76 @@ (define* (go-module->guix-package module-path #:key dependencies+versions dependencies)))) -(define go-module->guix-package* - (lambda args - ;; Disable output buffering so that the following warning gets printed - ;; consistently. - (setvbuf (current-error-port) 'none) - (let ((package-name (match args ((name _ ...) name)))) - (guard (c ((http-get-error? c) - (warning (G_ "Failed to import package ~s. -reason: ~s could not be fetched: HTTP error ~a (~s). +(define (go-module->guix-package* . args) + ;; Disable output buffering so that the following warning gets printed + ;; consistently. + (setvbuf (current-error-port) 'none) + (setvbuf (current-warning-port) 'none) + (let* ((package-name (match args ((name _ ...) name))) + ;; Use report-all-errors? for debugging purposes only, because + ;; e.g. getaddrinfo is not reentrant and therefore we must unwind + ;; before retrying. + (report-all-errors? #false) + (report-network-error + (lambda (reason) + (warning (G_ "Failing to import package ~S. +reason: ~A.~%") + package-name reason)))) + (let loop ((attempts 0)) + (when (> attempts 0) + (sleep 3) + (log.info "~%Retrying, attempt ~s." attempts)) + (cond + ((> attempts 60) + (warning (G_ "Giving up on importing package ~s. This package and its dependencies won't be imported.~%") - package-name - (uri->string (http-get-error-uri c)) - (http-get-error-code c) - (http-get-error-reason c)) - (values #f '()))) - (apply go-module->guix-package args))))) + package-name) + (values #f '())) + (else + (guard (c ((http-get-error? c) + (report-network-error + (format #f "~s could not be fetched: HTTP error ~a (~s)" + (uri->string (http-get-error-uri c)) + (http-get-error-code c) + (http-get-error-reason c))) + (loop (+ 1 attempts))) + ((eq? (exception-kind c) + 'getaddrinfo-error) + (report-network-error "DNS lookup failed") + (loop (+ 1 attempts))) + ((and (eq? (exception-kind c) + 'git-error) + (eq? (git-error-class (first (exception-args c))) + GITERR_NET)) + (report-network-error "network error coming from git") + (loop (+ 1 attempts))) + (else + (let ((port (current-warning-port))) + (format port "Unexpected error, will skip ~S.~%reason: " + package-name) + ;; Printing a backtrace here is not very useful: it is + ;; cut off because GUARD unwinds. + (print-exception port (stack-ref (make-stack #t) 1) + c (exception-args c)) + (display-backtrace (make-stack #t) port)) + ;; give up on this entry + (values #f '()))) + (with-exception-handler + (lambda (c) + (when report-all-errors? + (let ((port (current-warning-port))) + (format port "*** exception while importing:~%") + (print-exception port (stack-ref (make-stack #t) 1) + c (exception-args c)) + (format port "*** printing backtrace:~%") + (display-backtrace (make-stack #t) port) + ;; DISPLAY-BACKTRACE can fail, so it's better to make its + ;; exit also visible. + (format port "*** done printing backtrace~%"))) + (raise-continuable c)) + (lambda () + (apply go-module->guix-package args)) + #:unwind? (not report-all-errors?)))))))) (define* (go-module-recursive-import package-name #:key (goproxy "https://proxy.golang.org") From patchwork Tue May 3 11:42:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 39100 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 A0A9027BBEA; Tue, 3 May 2022 12:45:59 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,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 BCDAC27BBE9 for ; Tue, 3 May 2022 12:45:58 +0100 (BST) Received: from localhost ([::1]:46980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlqyb-0004hG-VL for patchwork@mira.cbaines.net; Tue, 03 May 2022 07:45:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlqwn-0003fN-7F for guix-patches@gnu.org; Tue, 03 May 2022 07:44:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44946) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlqwm-0002Rx-US for guix-patches@gnu.org; Tue, 03 May 2022 07:44:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nlqwm-0005QY-ST for guix-patches@gnu.org; Tue, 03 May 2022 07:44:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55242] [PATCH 08/10] guix: import: go: Modules in a subdir and prefixed tags. Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 03 May 2022 11:44:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55242 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55242@debbugs.gnu.org Cc: Attila Lendvai Received: via spool by 55242-submit@debbugs.gnu.org id=B55242.165157821820768 (code B ref 55242); Tue, 03 May 2022 11:44:04 +0000 Received: (at 55242) by debbugs.gnu.org; 3 May 2022 11:43:38 +0000 Received: from localhost ([127.0.0.1]:38833 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwL-0005Oo-NN for submit@debbugs.gnu.org; Tue, 03 May 2022 07:43:38 -0400 Received: from mail-ed1-f43.google.com ([209.85.208.43]:44929) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwG-0005NE-A3 for 55242@debbugs.gnu.org; Tue, 03 May 2022 07:43:33 -0400 Received: by mail-ed1-f43.google.com with SMTP id t5so8893668edw.11 for <55242@debbugs.gnu.org>; Tue, 03 May 2022 04:43:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zHrI7aV8BUrySjI0cC7uYm3uT3HxxRJ7k7KMlhL1Ivk=; b=VVSnc/QRer0/2iQeRMOdnwNYd45+j89e8Bl4nPNXZmYza2D6nAEgGI4ogfbDYWRoSZ zVYV+0aI9n37777HFoAkaGEnsDF2VwGDBlT4/FaiVOmPPYuMWBjWGI8joh9HGJcpBjJE InWCDySn3DwFmMawBjanJPThu2dDj+D/RTcoS/a2SG8FUvQo+Y/2c56QAMIqqeP0p4O6 qkFADKDLH9Q+Hy1GkGsDc9ghUQJQUMcouZHOlaIWzX924V8pYCgbeWlwpuOA6E0hK7vb p0h4CxGdl6OdkVqae9rhaL76X/8PO0qXIIO39WWJXarYj4fiqbr0W6OneWIIMfUwPg+o 0S8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=zHrI7aV8BUrySjI0cC7uYm3uT3HxxRJ7k7KMlhL1Ivk=; b=n2dEAmHlhmSJqT3hoxIvjUpbu+Bj6PvUw5G18wulrZH+VqmBFn1xXINrVAlTAmGkrD bn2rZBBy6ZVfE8sczsJ6BNFUXy03CZjR5UkwEkkf75Nl1sOkuX4itTbcXMhPx5HxnCGI Lbv0c4szavoY16DAp0//J7t47KXXDlZL9gcztXK2yswul3wljJI884WUZS5OZHp/5lSi 7kpTs9fS4X360A6mMC4kjHQzhVX0raQ3ZrijznOFKK/ZVxxZQxjxrbn1OVeNxTJBBgKO fbVxtAJx3D76meWXB+aBVrLimWc5mrcXxgZjUeHMnkAGg0Crua7j7jCXet1GQbliQml+ 6Uzw== X-Gm-Message-State: AOAM530loxZ1MFihgFZaHM5xpKFK97sR4GzmQlHYTHOaUyNg/mjrswUm 4VBSBQOLTkEl0MRliWDP8c1C98fU1cQ= X-Google-Smtp-Source: ABdhPJwaOUjdTTXwaLEHcXHX+22GzklqhUUluRmClENkfB2bdwMPZi/cYY0M7bzkWAHfTx38TYvZUg== X-Received: by 2002:a05:6402:90e:b0:425:a4bc:db86 with SMTP id g14-20020a056402090e00b00425a4bcdb86mr221768edz.98.1651578206532; Tue, 03 May 2022 04:43:26 -0700 (PDT) Received: from lelap.local (catv-89-132-245-188.catv.fixed.vodafone.hu. [89.132.245.188]) by smtp.gmail.com with ESMTPSA id k13-20020a05640212cd00b0042617ba63d6sm7766964edx.96.2022.05.03.04.43.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 May 2022 04:43:26 -0700 (PDT) From: Attila Lendvai Date: Tue, 3 May 2022 13:42:59 +0200 Message-Id: <20220503114301.9524-8-attila@lendvai.name> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220503114301.9524-2-attila@lendvai.name> References: <20220503114301.9524-2-attila@lendvai.name> 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" X-getmail-retrieved-from-mailbox: Patches Handle golang projects that are located in a subdir relative to the repo's root directory, and whose tags are also prefixed accordingly with the relative path. An example: guix import go github.com/aws/aws-sdk-go-v2/service/route53@v1.1.1 Also be more resilient while dealing with licences. * guix/import/go.scm (go-module->guix-package): Attempt to split comma separated lists of licences, and tolerate the inability to fetch any license information. Handle go modules that are a subdirectory of a vcs repo, including the special naming of their tags (it includes the subdir as a prefix). (list->licenses): Warn when the conversion fails. (+known-vcs+): Renamed from known-vcs to use naming convention for constants. --- guix/import/go.scm | 130 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 102 insertions(+), 28 deletions(-) diff --git a/guix/import/go.scm b/guix/import/go.scm index 6871132a70..ce6463cc51 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -346,6 +346,7 @@ (define (go-package-synopsis module-name) the https://pkg.go.dev/ web site." ;; Note: Only the *module* (rather than package) page has the README title ;; used as a synopsis on the https://pkg.go.dev web site. + (log.debug "Getting synopsis for ~S" module-name) (let* ((body (pkg.go.dev-info module-name)) ;; Extract the text contained in a h2 child node of any ;; element marked with a "License" class attribute. @@ -377,7 +378,12 @@ (define (list->licenses licenses) ("GPL3" "GPL-3.0") ("NIST" "NIST-PD") (_ license))) - 'unknown-license!))) + (begin + (warning (G_ "Failed to identify license ~S.~%") + license) + ;; This will put the license there as a string that + ;; will error at compilation. + license)))) licenses)) (define (fetch-go.mod goproxy module-path version) @@ -550,7 +556,8 @@ (define-record-type (define (make-vcs prefix regexp type) (%make-vcs prefix (make-regexp regexp) type)) -(define known-vcs +;; TODO use define-constant +(define +known-vcs+ ;; See the following URL for the official Go equivalent: ;; https://github.com/golang/go/blob/846dce9d05f19a1f53465e62a304dea21b99f910/src/cmd/go/internal/vcs/vcs.go#L1026-L1087 (list @@ -587,16 +594,17 @@ (define vcs-qualifiers '(".bzr" ".fossil" ".git" ".hg" ".svn")) (define (vcs-qualified-module-path->root-repo-url module-path) (let* ((vcs-qualifiers-group (string-join vcs-qualifiers "|")) - (pattern (format #f "^(.*(~a))(/|$)" vcs-qualifiers-group)) - (m (string-match pattern module-path))) - (and=> m (cut match:substring <> 1)))) + (pattern (format #f "^(.*(~a))(/|$)" vcs-qualifiers-group))) + (and=> (string-match pattern module-path) + (cut match:substring <> 1)))) (or (and=> (find (lambda (vcs) (string-prefix? (vcs-url-prefix vcs) module-path)) - known-vcs) + +known-vcs+) (lambda (vcs) (match:substring (regexp-exec (vcs-root-regex vcs) - module-path) 1))) + module-path) + 1))) (vcs-qualified-module-path->root-repo-url module-path) module-path)) @@ -666,6 +674,7 @@ (define (module-meta-data-repo-url meta-data goproxy) (define* (git-checkout-hash url reference algorithm) "Return the ALGORITHM hash of the checkout of URL at REFERENCE, a commit or tag." + (log.info "Fetching git repo at ~S, reference ~S" url reference) (define cache (string-append (or (getenv "TMPDIR") "/tmp") "/guix-import-go-" @@ -681,6 +690,7 @@ (define cache (update-cached-checkout url #:ref `(tag-or-commit . ,reference))))) + (log.debug " hashing at checkout ~S, commit ~S, reference ~S" checkout commit reference) (file-hash* checkout #:algorithm algorithm #:recursive? #true))) (define (vcs->origin vcs-type vcs-repo-url version) @@ -688,8 +698,10 @@ (define (vcs->origin vcs-type vcs-repo-url version) 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* ((git-ref (go-version->git-ref version)) + (plain-version? (string=? version git-ref)) + (v-prefixed? (string-prefix? "v" version))) + (log.debug "Version ~S converted to git reference ~S" version git-ref) `(origin (method git-fetch) (uri (git-reference @@ -699,13 +711,12 @@ (define (vcs->origin vcs-type vcs-repo-url version) ;; stripped of any 'v' prefixed. (commit ,(if (and plain-version? v-prefixed?) '(string-append "v" version) - '(go-version->git-ref version))))) + git-ref)))) (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-checkout-hash vcs-repo-url git-ref (hash-algorithm sha256)))))))) ((hg) `(origin (method hg-fetch) @@ -768,41 +779,104 @@ (define* (go-module->guix-package module-path #:key "Return the package S-expression corresponding to MODULE-PATH at VERSION, a Go package. The meta-data is fetched from the GOPROXY server and https://pkg.go.dev/. When VERSION is unspecified, the latest version available is used." + (log.info "~%Processing go module ~A@~A" module-path version) (let* ((available-versions (go-module-available-versions goproxy module-path)) (version* (validate-version (or (and version (ensure-v-prefix version)) (go-module-version-string goproxy module-path)) ;latest available-versions module-path)) - (content (fetch-go.mod goproxy module-path version*)) - (dependencies+versions (go.mod-requirements (parse-go.mod content))) + (go.mod (fetch-go.mod goproxy module-path version*)) + (dependencies+versions (go.mod-requirements (parse-go.mod go.mod))) (dependencies (if pin-versions? dependencies+versions (map car dependencies+versions))) - (module-path-sans-suffix - (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)) + (repo-root (module-path->repository-root module-path)) ;; 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)) + (meta-data (fetch-module-meta-data repo-root)) + (module-root-path (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)) - (description (go-package-description module-path)) - (licenses (go-package-licenses module-path))) + (raw-subdir (if (< (string-length module-root-path) + (string-length module-path)) + (substring module-path + (+ 1 (string-length module-root-path))) + #false)) + (module-subdirectory raw-subdir) + (major-version (and=> + (and raw-subdir + (string-match ".*v([0-9]+)$" raw-subdir)) + (lambda (m) + (let* ((v-postfix (match:substring m 1)) + (ver (string->number v-postfix))) + (log.debug " ~A matched as having a version-postfix: ~A" + raw-subdir v-postfix) + (set! module-subdirectory + (substring raw-subdir 0 + ;; Don't go negative when + ;; raw-subdir is a simple "v2". + (max 0 + (- (string-length raw-subdir) + (string-length v-postfix) + ;; Drop two slashes. + 2)))) + (when (string-null? module-subdirectory) + (set! module-subdirectory #false)) + (unless (integer? ver) + (raise + (formatted-message (G_ "failed to parse version postfix from '~a' for package '~a'") + raw-subdir module-path))) + ;; TODO assert that major-version matches the first number in version + ;; TODO assert that only version 1.x.y is allowed without a /v[major-version] postfix + ver)))) + (vcs-tag (if module-subdirectory + (string-append module-subdirectory "/" version*) + version*)) + (synopsis (or (false-if-exception + (go-package-synopsis module-path)) + (begin + (warning (G_ "Failed to fetch synopsis for ~S.~%") + module-path) + "TODO FIXME"))) + (description (or (false-if-exception + (go-package-description module-path)) + (begin + (warning (G_ "Failed to fetch description for ~S.~%") + module-path) + "TODO FIXME"))) + (licenses (or (false-if-exception + (go-package-licenses module-path)) + (begin + (warning (G_ "Failed to fetch license for ~S.~%") + module-path) + '("unknown-license!"))))) + ;; Maybe split comma separated list of licenses in a single string + (when (and (= 1 (length licenses)) + (string? (first licenses))) + (let ((pieces (map string-trim-both + (remove! string-null? + (string-split (first licenses) #\,))))) + (when (< 1 (length pieces)) + (set! licenses pieces)))) + (log.debug " meta-data: ~S~% raw-subdir: ~S, module-subdirectory: ~S, \ +major-version: ~S" + meta-data raw-subdir module-subdirectory major-version) + (log.debug " dependencies:~%~S" dependencies+versions) (values `(package (name ,guix-name) (version ,(strip-v-prefix version*)) (source - ,(vcs->origin vcs-type vcs-repo-url version*)) + ,(vcs->origin vcs-type vcs-repo-url vcs-tag)) (build-system go-build-system) (arguments - '(#:import-path ,module-path - ,@(if (string=? module-path-sans-suffix root-module-path) - '() - `(#:unpack-path ,root-module-path)))) + '(#:tests? #false ; some packages have unrecorded dependencies needed only by their tests + #:import-path ,module-path + ,@(if module-subdirectory + `(#:unpack-path ,module-root-path) + '()))) ,@(maybe-propagated-inputs (map (match-lambda ((name version) @@ -810,7 +884,7 @@ (define* (go-module->guix-package module-path #:key (name (go-module->guix-package-name name))) dependencies)) - (home-page ,(format #f "https://~a" root-module-path)) + (home-page ,(format #f "https://~a" module-root-path)) (synopsis ,synopsis) (description ,(and=> description beautify-description)) (license ,(match (list->licenses licenses) @@ -898,7 +972,7 @@ (define* (go-module-recursive-import package-name #:key (goproxy "https://proxy.golang.org") version pin-versions?) - + (log.info "Initiating recursive import of ~a, version ~a" package-name version) (recursive-import package-name #:repo->guix-package From patchwork Tue May 3 11:43:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 39103 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 3514E27BBEA; Tue, 3 May 2022 12:51:34 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,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 E532D27BBE9 for ; Tue, 3 May 2022 12:51:33 +0100 (BST) Received: from localhost ([::1]:48878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlr41-0006Mz-4T for patchwork@mira.cbaines.net; Tue, 03 May 2022 07:51:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlqwn-0003gi-Ih for guix-patches@gnu.org; Tue, 03 May 2022 07:44:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44947) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlqwn-0002S3-AX for guix-patches@gnu.org; Tue, 03 May 2022 07:44:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nlqwn-0005Qg-8O for guix-patches@gnu.org; Tue, 03 May 2022 07:44:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55242] [PATCH 09/10] guix: import: go: module-name -> module-path to be consistent Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 03 May 2022 11:44:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55242 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55242@debbugs.gnu.org Cc: Attila Lendvai Received: via spool by 55242-submit@debbugs.gnu.org id=B55242.165157821820776 (code B ref 55242); Tue, 03 May 2022 11:44:05 +0000 Received: (at 55242) by debbugs.gnu.org; 3 May 2022 11:43:38 +0000 Received: from localhost ([127.0.0.1]:38835 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwM-0005P0-Fn for submit@debbugs.gnu.org; Tue, 03 May 2022 07:43:38 -0400 Received: from mail-ed1-f48.google.com ([209.85.208.48]:43605) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwH-0005NF-25 for 55242@debbugs.gnu.org; Tue, 03 May 2022 07:43:33 -0400 Received: by mail-ed1-f48.google.com with SMTP id b24so19525458edu.10 for <55242@debbugs.gnu.org>; Tue, 03 May 2022 04:43:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=igWptIFJy8qnLiiMWFq7RA75L0EcJyyF4H3IxTcrB8g=; b=eniw7W0cXKORDKTrW10vW965ouCXrnlkTUNFn62/ZlGsWMW2o7HAFSHiKC+EHyyQRO eEfeViZf1v1/MTz0xG5l5Jd9+CEbBX1yC3trTFrTQUOFiUgFn+pVbI2IxJK9G1uunjdf tvoEkEgOxTYSqIUbtTx0AAmHQQ03FKQ4vjoQnyYmrNREHsKv8IEtg5SyR1rdgNf1b/1Y +NsedrRhd66an3jr0W9sBUbv/bROe+4vRj4p9SkXSTvE6EnRJr1KTCSdppoK8TkbnbTe gK7sBqZdFl0SAuxut9yj9yovOqaaAHCwRlXGW8Lt6zGFfDWOn+Vvw+gXZAuuJq4ZqUK9 f+uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=igWptIFJy8qnLiiMWFq7RA75L0EcJyyF4H3IxTcrB8g=; b=59so+3D7jKHpTtiLS3Cb9rYaHrjj6unwmcLZC4a82+nUXf+WjS8/Ynma3+wjKpUvWk iFRt9ZeoNzM5WqKefeh+fT+WEsn14f5A9fIobYblUN5e4TVaGFzDgQZ7nL3LAkukXWro TEq3VNZFR5a3CMKOHZMKdSn1LjS6mfALlxkkzqSS+RZwj8F9HY5Lz+X+ufSC8xdBgv4+ wR4aufktkHcjWAZEGiW1pJX2IUVRgbKQCQD4J0MZ2UNRDXs+uEzrfq6HCrkSj1Y6plhy qVxCzDph+PSvybYC+GegI8abq8aApXBfoa9fEKPU7U/NQhTmKxwjibgi3O4SbWuiQKc5 Q/lA== X-Gm-Message-State: AOAM5338QgaZcl3z1BX8pUUFHEpMVfGEpINHOYF0MyWMKTpp3A3Sdbtp UsAXIW86iC/pNg1HYAq0Y1HC575/9nw= X-Google-Smtp-Source: ABdhPJyipntZ6Y3xE5HRKuZ1GAlpxeKZFwyCost1lqn2bwRxLUvC1VNYTqmCA0zDLBcHU/BAlH/Vjg== X-Received: by 2002:aa7:da08:0:b0:425:af3c:196a with SMTP id r8-20020aa7da08000000b00425af3c196amr17556627eds.69.1651578207493; Tue, 03 May 2022 04:43:27 -0700 (PDT) Received: from lelap.local (catv-89-132-245-188.catv.fixed.vodafone.hu. [89.132.245.188]) by smtp.gmail.com with ESMTPSA id k13-20020a05640212cd00b0042617ba63d6sm7766964edx.96.2022.05.03.04.43.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 May 2022 04:43:26 -0700 (PDT) From: Attila Lendvai Date: Tue, 3 May 2022 13:43:00 +0200 Message-Id: <20220503114301.9524-9-attila@lendvai.name> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220503114301.9524-2-attila@lendvai.name> References: <20220503114301.9524-2-attila@lendvai.name> 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" X-getmail-retrieved-from-mailbox: Patches * guix/import/go.scm (go-package-description): Renamed first parameter. --- guix/import/go.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/guix/import/go.scm b/guix/import/go.scm index ce6463cc51..25d424c1ac 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -340,14 +340,14 @@ (define (go-package-description name) ((p elements ...) (apply string-append (filter string? (map sxml->texi elements))))))) -(define (go-package-synopsis module-name) - "Retrieve a short synopsis for a Go module named MODULE-NAME, +(define (go-package-synopsis module-path) + "Retrieve a short synopsis for a Go module named MODULE-PATH, e.g. \"google.golang.org/protobuf\". The data is scraped from the https://pkg.go.dev/ web site." ;; Note: Only the *module* (rather than package) page has the README title ;; used as a synopsis on the https://pkg.go.dev web site. - (log.debug "Getting synopsis for ~S" module-name) - (let* ((body (pkg.go.dev-info module-name)) + (log.debug "Getting synopsis for ~S" module-path) + (let* ((body (pkg.go.dev-info module-path)) ;; Extract the text contained in a h2 child node of any ;; element marked with a "License" class attribute. (select-title (sxpath From patchwork Tue May 3 11:43:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 39101 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 50B8727BBEA; Tue, 3 May 2022 12:46:17 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,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 B1A9427BBE9 for ; Tue, 3 May 2022 12:46:16 +0100 (BST) Received: from localhost ([::1]:47284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlqyt-0004xj-Kg for patchwork@mira.cbaines.net; Tue, 03 May 2022 07:46:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlqwn-0003h6-Uv for guix-patches@gnu.org; Tue, 03 May 2022 07:44:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44948) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlqwn-0002S9-MH for guix-patches@gnu.org; Tue, 03 May 2022 07:44:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nlqwn-0005Qn-Kk for guix-patches@gnu.org; Tue, 03 May 2022 07:44:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55242] [PATCH 10/10] guix: import: go: Better handling of /v2 in the module path. Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 03 May 2022 11:44:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55242 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55242@debbugs.gnu.org Cc: Attila Lendvai Received: via spool by 55242-submit@debbugs.gnu.org id=B55242.165157821920782 (code B ref 55242); Tue, 03 May 2022 11:44:05 +0000 Received: (at 55242) by debbugs.gnu.org; 3 May 2022 11:43:39 +0000 Received: from localhost ([127.0.0.1]:38837 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwM-0005P3-Nu for submit@debbugs.gnu.org; Tue, 03 May 2022 07:43:39 -0400 Received: from mail-ed1-f45.google.com ([209.85.208.45]:40825) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwH-0005NR-SW for 55242@debbugs.gnu.org; Tue, 03 May 2022 07:43:34 -0400 Received: by mail-ed1-f45.google.com with SMTP id p18so19515047edr.7 for <55242@debbugs.gnu.org>; Tue, 03 May 2022 04:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WXH0lfHok3sajpelue/NTp/Aq+/ANt0daCtjJoY8NiQ=; b=lW93FENB5dut+jBVYhm9T7fnoR7nq7mtSfPdoW9+hJcD/gjRtkLpp2NIGFMgcNLhHD orTw9vgSn/odIHFSHEwDkXCFNDfZJZ1mn5YUMM1LrU8ZmaEZW8LIMf6hu+GZ8vHR5Ha7 +zdykBaLqacJkrAkDZjzY5XqV5FV13rmqVKLfTIitLvItbekuTmecjz36CXhs1axdNGD gwIjEuENysL7DT3wx+RVRUyk5YC5FKy2Ehr6xNsipX7Ijzj806ildMtSsBXTvuXaJgq2 TnkffYzKRe6S2I4Bx1rtfcoY9gsE88kHZ2ELZPLdFJYlPVRKQSfhlN9OPWOrQ1HKJqqU ho6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=WXH0lfHok3sajpelue/NTp/Aq+/ANt0daCtjJoY8NiQ=; b=Qeyqdf8joN+T5nUEZcX10Rvxu2x57XUH4OCIELpDLHsTyBU9K/2qUZG8oqqub3GsJc fqdB/jQRXPIFyyGQHYz+eCX61aRdzR4i6JW0WLDJZRhjyl+YZsBoxmEkhVWCZB7OThDy AIM2IW60oarMUku6mY/XfJf91Rb0JgFNshF0aLhC1rztyiikyTFhbWUUT/TB0nPjcYWU PLt5zOwOuDvNUYbrBSaa/sMGIrZZ8BORru77dyLwEDUMMHVrVbS85xgSlWIqoRyY2YCh FShIk7yyBeak2fCyPJVcBzoNcFKDUC9brRKthR8FhmlxTdeMXrNNdDePyDitof9zosJq 1hsg== X-Gm-Message-State: AOAM533d18uz5yS2DGt1x18iPUwRzxGb8zuGEMB1w244dUjZntWes0pH e1C+29nskizcaFnPFSr+7SCadFYUi/8= X-Google-Smtp-Source: ABdhPJxq8zJKA+q8yYqWM0U0Rq5fCAP8ieqKOiSjtlctFfQzcSQwDze9NVShvyImm3Ap/AJPcJSwXg== X-Received: by 2002:a05:6402:1f0b:b0:427:b390:2020 with SMTP id b11-20020a0564021f0b00b00427b3902020mr13306474edb.70.1651578208208; Tue, 03 May 2022 04:43:28 -0700 (PDT) Received: from lelap.local (catv-89-132-245-188.catv.fixed.vodafone.hu. [89.132.245.188]) by smtp.gmail.com with ESMTPSA id k13-20020a05640212cd00b0042617ba63d6sm7766964edx.96.2022.05.03.04.43.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 May 2022 04:43:27 -0700 (PDT) From: Attila Lendvai Date: Tue, 3 May 2022 13:43:01 +0200 Message-Id: <20220503114301.9524-10-attila@lendvai.name> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220503114301.9524-2-attila@lendvai.name> References: <20220503114301.9524-2-attila@lendvai.name> 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" X-getmail-retrieved-from-mailbox: Patches * guix/import/go.scm (module-path->repository-root): Delete version param. (*module-path->import-path*): New mapping, initialized with a small db of projects. (go-module->guix-package): Return packages with #:unpack-path when needed. --- guix/import/go.scm | 93 +++++++++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 39 deletions(-) diff --git a/guix/import/go.scm b/guix/import/go.scm index 25d424c1ac..fbed3ca88b 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -75,6 +75,7 @@ (define-module (guix import go) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) + #:use-module (srfi srfi-71) ; let* #:use-module (sxml match) #:use-module ((sxml xpath) #:renamer (lambda (s) (if (eq? 'filter s) @@ -608,19 +609,15 @@ (define (vcs-qualified-module-path->root-repo-url module-path) (vcs-qualified-module-path->root-repo-url module-path) module-path)) -(define* (go-module->guix-package-name module-path #:optional version) - "Converts a module's path to the canonical Guix format for Go packages. -Optionally include a VERSION string to append to the name." +(define* (go-module->guix-package-name module-path) + "Converts a module's path to the canonical Guix format for Go packages." ;; Map dot, slash, underscore and tilde characters to hyphens. (let ((module-path* (string-map (lambda (c) (if (member c '(#\. #\/ #\_ #\~)) #\- c)) module-path))) - (string-downcase (string-append "go-" module-path* - (if version - (string-append "-" version) - ""))))) + (string-downcase (string-append "go-" module-path*)))) (define (strip-.git-suffix/maybe repo-url) "Strip a repository URL '.git' suffix from REPO-URL if hosted at GitHub." @@ -771,6 +768,14 @@ (define (validate-version version available-versions module-path) available versions:~{ ~a~}.") (map strip-v-prefix available-versions))))))))) +(define *module-path->import-path* + ;; There's no other way to derive this information, at least that I know of. + '(("github.com/google/go-cmp" . "github.com/google/go-cmp/cmp") + ("github.com/sergi/go-diff" . "github.com/sergi/go-diff/diffmatchpatch") + ("github.com/davecgh/go-spew" . "github.com/davecgh/go-spew/spew") + ("github.com/beorn7/perks" . "github.com/beorn7/perks/quantile") + ("github.com/census-instrumentation/opencensus-proto" . + "github.com/census-instrumentation/opencensus-proto/gen-go"))) (define* (go-module->guix-package module-path #:key (goproxy "https://proxy.golang.org") @@ -864,38 +869,48 @@ (define* (go-module->guix-package module-path #:key major-version: ~S" meta-data raw-subdir module-subdirectory major-version) (log.debug " dependencies:~%~S" dependencies+versions) - (values - `(package - (name ,guix-name) - (version ,(strip-v-prefix version*)) - (source - ,(vcs->origin vcs-type vcs-repo-url vcs-tag)) - (build-system go-build-system) - (arguments - '(#:tests? #false ; some packages have unrecorded dependencies needed only by their tests - #:import-path ,module-path - ,@(if module-subdirectory - `(#:unpack-path ,module-root-path) - '()))) - ,@(maybe-propagated-inputs - (map (match-lambda - ((name version) - (go-module->guix-package-name name (strip-v-prefix version))) - (name - (go-module->guix-package-name name))) - dependencies)) - (home-page ,(format #f "https://~a" module-root-path)) - (synopsis ,synopsis) - (description ,(and=> description beautify-description)) - (license ,(match (list->licenses licenses) - (() #f) ;unknown license - ((license) ;a single license - license) - ((license ...) ;a list of licenses - `(list ,@license))))) - (if pin-versions? - dependencies+versions - dependencies)))) + (let* ((import-path unpack-path + (if module-subdirectory + (values module-path module-root-path) + (let ((import-path (assoc-ref *module-path->import-path* + module-path))) + (if import-path + (begin + (log.debug "matched as an import-path exception: ~S" import-path) + (values import-path module-path)) + (values module-path #f)))))) + (values + `(package + (name ,guix-name) + (version ,(strip-v-prefix version*)) + (source + ,(vcs->origin vcs-type vcs-repo-url vcs-tag)) + (build-system go-build-system) + (arguments + '(#:import-path ,import-path + ,@(if unpack-path + `(#:unpack-path ,unpack-path) + '()))) + ,@(maybe-propagated-inputs + (map (match-lambda + ((name version) + (list (go-module->guix-package-name name) + (strip-v-prefix version))) + (name + (go-module->guix-package-name name))) + dependencies)) + (home-page ,(format #f "https://~a" module-root-path)) + (synopsis ,synopsis) + (description ,(and=> description beautify-description)) + (license ,(match (list->licenses licenses) + (() #f) ;unknown license + ((license) ;a single license + license) + ((license ...) ;a list of licenses + `(list ,@license))))) + (if pin-versions? + dependencies+versions + dependencies))))) (define (go-module->guix-package* . args) ;; Disable output buffering so that the following warning gets printed