From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id KJzVKUW5N2cPTgAAe85BDQ:P1 (envelope-from ) for ; Fri, 15 Nov 2024 21:12:37 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id KJzVKUW5N2cPTgAAe85BDQ (envelope-from ) for ; Fri, 15 Nov 2024 22:12:37 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=NwQgVFZU; dkim=fail ("headers rsa verify failed") header.d=kolabnow.com header.s=dkim20240523 header.b=nwUM5Gb+; 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"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1731705157; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: 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=YaH4k+uq5KG+RAgyIBwT+Nc4HUwgRX/GbVCcqH+6cO4=; b=SVkmZP1D6VsdE16yump3rWkicK1Brk0qzWy1dvT9u8CPKe2usRbIWzDahrY2/UaW0pNJIE rliKy4kNsefZqZ2XoRHnZMjk3M8zYWSD1T+VrMJioP8QgIMPxCnXInthbaqBJ2dllWUgO5 qc0GszbpLr2PFRgpPEFjl5UgbR/aIImoqlMXMb229ozr5UcSx+SBc86eIDXZ07Vnd5FI/G mg8gzyotZagLtOZI100j2bHM2xjEkyfzcPtr8MqopBOyhSZWynmwYfGCyQkdPA4jt2QMkj PBUaRb/N82cehGxiSHzxLLamOO1fW9QzCJPYURDZ2vsLpAnPw4Pk61vsauzm+w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=NwQgVFZU; dkim=fail ("headers rsa verify failed") header.d=kolabnow.com header.s=dkim20240523 header.b=nwUM5Gb+; 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"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1731705157; a=rsa-sha256; cv=none; b=dBY9XDXF6becaTnp9sU45Ye+v7Vp03zzg+iu7R2iIDHNkIvZDa98cqlOJuS4H63sNzGga+ uoCY5x9yLZVFJ++ASymP663AYQKiCbQednj8P7vxFHq2kJxV5/3naCt04lSLG7tZCz7OFt IyquKrJ5D4HrBayuKkWjwRFFgu2Ezf8WXKdpqFRchH2FGe0zaVu2QUmPhRquHS3yv4AcSO kO8ACdEDrlDSjh+W5EKjyzmK+K0Quy86nCH/JauRlWIL67EIAS11WE8zUciUrYO4uM42L8 buLEF0wE5tJ1st3wsBkkVUr4iY2bNS7L9fAUyMTQNQfE/RuW5cEtkw4sbteVFg== 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 1A3384334E for ; Fri, 15 Nov 2024 22:12:37 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tC3bp-0002Dy-0R; Fri, 15 Nov 2024 16:12:05 -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 1tC3bn-0002Df-Ae for guix-patches@gnu.org; Fri, 15 Nov 2024 16:12:03 -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 1tC3bn-00069Q-1z for guix-patches@gnu.org; Fri, 15 Nov 2024 16:12:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=YaH4k+uq5KG+RAgyIBwT+Nc4HUwgRX/GbVCcqH+6cO4=; b=NwQgVFZU+t/XSccXu04oJC1Qj5uiJTqyxRFsXHdEJuQxzTQtau8W0Y1snEGf3+D7LqyPKPfiAieZRmzmgMDUBsbkWqj2tENaU/OntvA3MF6WI0SqE7B9CEScL6XC+CL51heI8TvqRsSK5wqEd2LzB8jWwGL+R8wZqxRBLzbofVCpYnoQudR0OB+kR7hecXBp5tVDR14YOjfLKb2orEjfbzaqyNpQXZVOg5ikFxXcHJZBUyccusTxK/q3Xq1yzy6/2GNt9O/2y6ekGt5cWe8R6kVW2kYASZhzaPqwZXHFld2k62DnnDsbBSIGZFM3H3z5IbqcFAArigXkKg7+Y5AgNA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tC3bm-0000G7-S2 for guix-patches@gnu.org; Fri, 15 Nov 2024 16:12:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74371] [PATCH 3/4] guix: Add module aware 'guix import go' Resent-From: =?UTF-8?Q?J=C3=B8rgen?= Kvalsvik Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 15 Nov 2024 21:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74371 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74371@debbugs.gnu.org Cc: =?UTF-8?Q?J=C3=B8rgen?= Kvalsvik X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.1731705104912 (code B ref -1); Fri, 15 Nov 2024 21:12:02 +0000 Received: (at submit) by debbugs.gnu.org; 15 Nov 2024 21:11:44 +0000 Received: from localhost ([127.0.0.1]:51074 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tC3bS-0000EP-O3 for submit@debbugs.gnu.org; Fri, 15 Nov 2024 16:11:43 -0500 Received: from lists.gnu.org ([209.51.188.17]:48698) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tC3bQ-0000Du-7I for submit@debbugs.gnu.org; Fri, 15 Nov 2024 16:11:40 -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 1tC3bN-0002Bq-Sr for guix-patches@gnu.org; Fri, 15 Nov 2024 16:11:37 -0500 Received: from mx.kolabnow.com ([212.103.80.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tC3bD-00066X-V5 for guix-patches@gnu.org; Fri, 15 Nov 2024 16:11:32 -0500 Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id 4F5653069A98 for ; Fri, 15 Nov 2024 22:11:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:date:subject:subject:from:from:received :received:received; s=dkim20240523; t=1731705075; x=1733519476; bh=YaH4k+uq5KG+RAgyIBwT+Nc4HUwgRX/GbVCcqH+6cO4=; b=nwUM5Gb+Q3O2 OFgQNulbdmbi5Kt7KXG3Tftna1cLWmx7AN0+AujHRKl+qmMH9wZG3Lv3rK2JPqAy jn2FMLYK1EdZUEDlDQve2rDGD4Y9co4lgRlu+T/61oCnoIZeob7mPG45yFLiE/8g Y1tWiJPJ2AQwHKUjZ6LMAozTwy2cOA12OSj1bPvlFfh2yla4DvZQLPk8/WkdRgMt MD4aAKe2bgsr7QV+yHiVvh85Z5YNSoAHp2z+A84T54rYGVAbpJOEqEjKgGxKFSxE EVrHv7BWTM8DhbK5/V57hz1jMNB7LWp4V9ZALpIiZ1tPK3VgBVV4BYeVPsSfJvvf 0GNnZbxIHA== X-Virus-Scanned: amavis at mykolab.com Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out013.mykolab.com [127.0.0.1]) (amavis, port 10024) with ESMTP id MNYmo643scnZ for ; Fri, 15 Nov 2024 22:11:15 +0100 (CET) Received: from int-mx009.mykolab.com (unknown [10.9.13.9]) by mx.kolabnow.com (Postfix) with ESMTPS id BD0103069A9C for ; Fri, 15 Nov 2024 22:11:15 +0100 (CET) Received: from ext-subm010.mykolab.com (unknown [10.9.6.10]) by int-mx009.mykolab.com (Postfix) with ESMTPS id 762582097185 for ; Fri, 15 Nov 2024 22:11:15 +0100 (CET) From: =?UTF-8?Q?J=C3=B8rgen?= Kvalsvik Date: Fri, 15 Nov 2024 22:11:05 +0100 Message-Id: <20241115211106.2759121-4-j@lambda.is> In-Reply-To: <20241115211106.2759121-1-j@lambda.is> References: <20241115211106.2759121-1-j@lambda.is> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=212.103.80.155; envelope-from=j@lambda.is; helo=mx.kolabnow.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: -3.08 X-Spam-Score: -3.08 X-Migadu-Queue-Id: 1A3384334E X-TUID: mo9iwqvygHyi Emit module aware package go packages. It does not compute the hash of the full module yet, and only supports git, but goes a long way towards making it easy to package new go programs using the module-aware build system. * guix/import/go.scm (go-module->guix-package): Add go.mod awareness * guix/scripts/import/go.scm (show-help): Document -m, --mod (%options): Accept them. Change-Id: I4efd7260d69276279940e21698ecc7eb57232a67 --- guix/import/go.scm | 88 ++++++++++++++++++++++++-------------- guix/scripts/import/go.scm | 6 +++ 2 files changed, 61 insertions(+), 33 deletions(-) diff --git a/guix/import/go.scm b/guix/import/go.scm index dd9298808d..967aa54d58 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -615,6 +615,7 @@ (define (validate-version version available-versions module-path) (define* (go-module->guix-package module-path #:key (goproxy "https://proxy.golang.org") version + go-mod? pin-versions? #:allow-other-keys) "Return the package S-expression corresponding to MODULE-PATH at VERSION, a Go package. @@ -641,43 +642,62 @@ (define* (go-module->guix-package module-path #:key (meta-data (fetch-module-meta-data root-module-path)) (vcs-type (module-meta-vcs meta-data)) (vcs-repo-url (module-meta-data-repo-url meta-data goproxy)) + (home-page (format #f "https://~a" root-module-path)) (synopsis (go-package-synopsis module-path)) - (description (go-package-description module-path)) - (licenses (go-package-licenses module-path))) - (values - `(package - (name ,guix-name) - (version ,(strip-v-prefix version*)) - (source - ,(vcs->origin vcs-type vcs-repo-url version*)) - (build-system go-build-system) - (arguments - (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) - (go-module->guix-package-name name (strip-v-prefix version))) - (name - (go-module->guix-package-name name))) - dependencies)) - (home-page ,(format #f "https://~a" root-module-path)) - (synopsis ,synopsis) - (description ,(and=> description beautify-description)) - (license ,(match (list->licenses licenses) + (description (and=> (go-package-description module-path) beautify-description)) + (licenses (go-package-licenses module-path)) + (license (match (list->licenses licenses) (() #f) ;unknown license - ((license) ;a single license - license) + ((license) license) ;a single license ((license ...) ;a list of licenses `(list ,@license))))) - (if pin-versions? - dependencies+versions - dependencies)))) + (if go-mod? + (values + `(package + (name ,guix-name) + (version ,(strip-v-prefix version*)) + (source + (origin + (method go-mod-fetch) + (uri (go-mod-reference + (source ,(vcs->origin vcs-type vcs-repo-url version*)))) + (sha256 + (base32 + ;; FIXME: fetch & compute checksum + "0000000000000000000000000000000000000000000000000000")))) + (build-system go-mod-build-system) + (home-page ,home-page) + (synopsis ,synopsis) + (description ,description) + (license ,license))) + (values + `(package + (name ,guix-name) + (version ,(strip-v-prefix version*)) + (source ,(vcs->origin vcs-type vcs-repo-url version*)) + (build-system go-build-system) + (arguments + (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) + (go-module->guix-package-name name (strip-v-prefix version))) + (name + (go-module->guix-package-name name))) + dependencies)) + (home-page ,home-page) + (synopsis ,synopsis) + (description ,description) + (license ,license) + (if pin-versions? + dependencies+versions + dependencies)))))) (define go-module->guix-package* (lambda args @@ -699,6 +719,7 @@ (define go-module->guix-package* (define* (go-module-recursive-import package-name #:key (goproxy "https://proxy.golang.org") version + go-mod? pin-versions?) (recursive-import @@ -709,6 +730,7 @@ (define* (go-module-recursive-import package-name (receive (package-sexp dependencies) (go-module->guix-package* name #:goproxy goproxy #:version version + #:go-mod? go-mod? #:pin-versions? pin-versions?) (values package-sexp dependencies)))) #:guix-name go-module->guix-package-name diff --git a/guix/scripts/import/go.scm b/guix/scripts/import/go.scm index b90c6ac72f..a12c3a9b2f 100644 --- a/guix/scripts/import/go.scm +++ b/guix/scripts/import/go.scm @@ -50,6 +50,8 @@ (define (show-help) (display (G_ " -h, --help display this help and exit")) (display (G_ " + -m, --mod generate go-module based packages")) + (display (G_ " -r, --recursive generate package expressions for all Go modules that are not yet in Guix")) (display (G_ " @@ -65,6 +67,9 @@ (define %options (lambda args (show-help) (exit 0))) + (option '(#\m "mod") #f #f + (lambda (opt name arg result) + (alist-cons 'go-mod? #t result))) (option '(#\r "recursive") #f #f (lambda (opt name arg result) (alist-cons 'recursive #t result))) @@ -106,6 +111,7 @@ (define (parse-options) (let ((arguments (list name #:goproxy (assoc-ref opts 'goproxy) #:version version + #:go-mod? (assoc-ref opts 'go-mod?) #:pin-versions? (assoc-ref opts 'pin-versions?)))) (if (assoc-ref opts 'recursive) -- 2.39.5