From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id QJBBNLDDT2MiPQEAbAwnHQ (envelope-from ) for ; Wed, 19 Oct 2022 11:30:24 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id oJBoNLDDT2PTrwAA9RJhRA (envelope-from ) for ; Wed, 19 Oct 2022 11:30:24 +0200 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 7E252DF44 for ; Wed, 19 Oct 2022 11:30:24 +0200 (CEST) Received: from localhost ([::1]:57670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ol5P5-0003Js-9s for larch@yhetil.org; Wed, 19 Oct 2022 05:30:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ol5Om-0003IF-0Z for guix-patches@gnu.org; Wed, 19 Oct 2022 05:30:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56750) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ol5Ok-0002Qm-SD; Wed, 19 Oct 2022 05:30:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ol5Ok-0002Ct-FI; Wed, 19 Oct 2022 05:30:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58623] [PATCH 0/3] import/cran: Parameterize for guix-cran. Resent-From: Lars-Dominik Braun Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, guix-patches@gnu.org Resent-Date: Wed, 19 Oct 2022 09:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58623 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58623@debbugs.gnu.org Cc: ludo@gnu.org X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: ludo@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16661717648415 (code B ref -1); Wed, 19 Oct 2022 09:30:02 +0000 Received: (at submit) by debbugs.gnu.org; 19 Oct 2022 09:29:24 +0000 Received: from localhost ([127.0.0.1]:55828 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ol5O4-0002Bb-PY for submit@debbugs.gnu.org; Wed, 19 Oct 2022 05:29:24 -0400 Received: from lists.gnu.org ([209.51.188.17]:57842) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ol5O0-0002BS-K6 for submit@debbugs.gnu.org; Wed, 19 Oct 2022 05:29:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ol5O0-0002i3-ET for guix-patches@gnu.org; Wed, 19 Oct 2022 05:29:16 -0400 Received: from mout-p-202.mailbox.org ([2001:67c:2050:0:465::202]:47726) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1ol5Nv-0002ME-1P for guix-patches@gnu.org; Wed, 19 Oct 2022 05:29:16 -0400 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4Mslm66ptPz9sRK for ; Wed, 19 Oct 2022 11:28:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6xq.net; s=MBO0001; t=1666171734; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=IY97NhsoWi9hmGUYa+SiV/6gKD8n3vPyRyINtcyMcvA=; b=dJymWNasCEcBShVHgHdIh8l7Cl2i5GZDxIVIC9bxHZe12Z1D8jZQsl2uCmS6evwGnKvrjr nwNaXgeuJgxtGSz7MlhDgcuz+M4u5ZW3PkRuwX2NmNrXFTqk0lZKsQpPV7rEU7n7/xvnVz z4kKBjIeNCDyQHirpiBAiibTWxccThQf02MLwKDDz6oNuffBcJmSnRcLqmjZjFxQAjfU20 63CrmSsnzyTzp01N3Sw2i4NWwvT56z4DTdC2liMNZd/iEWBoCXIjvJjkxMBr7qkZqEP1wU Q0lX1Rr4kV9eEBQC5DhQP8Yfme7tBe7GbetuYnXXGWJ4of7zXgAi2EUyGDpUoQ== Date: Wed, 19 Oct 2022 11:28:53 +0200 From: Lars-Dominik Braun Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="jRC6WZhafm+9bWxP" Content-Disposition: inline X-Rspamd-Queue-Id: 4Mslm66ptPz9sRK Received-SPF: pass client-ip=2001:67c:2050:0:465::202; envelope-from=lars@6xq.net; helo=mout-p-202.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1666171824; 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:resent-cc:resent-from:resent-sender: resent-message-id:list-id:list-help:list-unsubscribe:list-subscribe: list-post:dkim-signature; bh=IY97NhsoWi9hmGUYa+SiV/6gKD8n3vPyRyINtcyMcvA=; b=PJFwMZgMHBeQO4Rvtgh3fzNGYZ+Op770IJ7FKJn+yp1lO/1m4dNPGfddWsJNxwvlb+Esh6 Fw0ZXLjHCkbFF1x857iISJEDZZYSD8cfudqrwSeVxonPC5HJsIetw6wnXhwOCVnCaLWRWu FT6ADxU3M2/eXjBrD1GbvBLMBsdV6j9KHuG73u+q4MeLBmsjmroDNVhN8PR7XYko4ttSlf 5WCCkXzDtE9lYKknsAAYMYA8g+16ImQNazdlf/lynmrUcIfHR+sh9LQZP45AD9miP27ygJ p09Ii/bRxaZO5ae6wvLlN6DQ7y+x7gzEYAGUjUCPCm5PqgaVDxFoXaUyBbaylw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1666171824; a=rsa-sha256; cv=none; b=uc8+eYpPkpxdHcxRFFCoJZttc06y7UBH71HksuH3ie67AEP8g6KF1pWCDTvPuZBIbN5okh i9L1hBYS2u2aAN1D4MlT7MU+58l/WMYaH4d/i2OpqJSX8pS8EGgPPe76nsl/5Kb+fzD+dB maMHYOL7q6FDbuTECQUMLrXn9ON/sAZczyM8q6+DtCJbmtjFjVYwlliGXFIpXPQvx/MdMx xm+3n9bC34vVH/aJwys2LW/RaZ7WR7lSGGXYCogMJqQ3xPsB7ALDXMEdc8XoTM944h9301 pRJbZDH8y22lgOLj15J59M2uEudcvTYSkNX50NfKvL+KVpGkvUVZHsKnQM/jLQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=6xq.net header.s=MBO0001 header.b=dJymWNas; dmarc=fail reason="SPF not aligned (relaxed)" header.from=6xq.net (policy=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" X-Migadu-Spam-Score: 7.18 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=6xq.net header.s=MBO0001 header.b=dJymWNas; dmarc=fail reason="SPF not aligned (relaxed)" header.from=6xq.net (policy=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" X-Migadu-Queue-Id: 7E252DF44 X-Spam-Score: 7.18 X-Migadu-Scanner: scn1.migadu.com X-TUID: alzuyuCfBczp --jRC6WZhafm+9bWxP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, the attached patches are required for guix-cran (https://github.com/guix-science/guix-cran). import/cran already has the ability to add a prefix to licenses, but it was not exposed. Additionally I need to parameterize fetch/download functions, so I can cache the tarballs/DESCRIPTION files. Cheers, Lars Lars-Dominik Braun (3): import/cran: Allow custom license prefix. import/cran: Allow overriding description fetch function. import/cran: Allow overriding tarball download. guix/import/cran.scm | 30 +++++++++++++++++++++--------- guix/scripts/import/cran.scm | 18 ++++++++++++++++-- 2 files changed, 37 insertions(+), 11 deletions(-) -- 2.37.3 --jRC6WZhafm+9bWxP Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-import-cran-Allow-custom-license-prefix.patch" >From 758a4f70fda5758449747e14db1991f6243174b1 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 18 Oct 2022 12:45:15 +0200 Subject: [PATCH 1/3] import/cran: Allow custom license prefix. X-Debbugs-Cc: zimon.toutoune@gmail.com X-Debbugs-Cc: dev@jpoiret.xyz X-Debbugs-Cc: mail@cbaines.net X-Debbugs-Cc: rekado@elephly.net X-Debbugs-Cc: othacehe@gnu.org X-Debbugs-Cc: ludo@gnu.org * guix/import/cran.scm (%license-prefix): New parameter. (string->license): Use it. * guix/scripts/import/cran.scm (%options): Add new parameter -p/--license-prefix. (show-help): Document it. (parse-options): Pass it as a parameter to importer. --- guix/import/cran.scm | 10 +++++++--- guix/scripts/import/cran.scm | 18 ++++++++++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/guix/import/cran.scm b/guix/import/cran.scm index 17e33d5f52..d13231f633 100644 --- a/guix/import/cran.scm +++ b/guix/import/cran.scm @@ -55,6 +55,7 @@ (define-module (guix import cran) #:use-module (guix packages) #:use-module (gnu packages) #:export (%input-style + %license-prefix cran->guix-package bioconductor->guix-package @@ -82,6 +83,9 @@ (define-module (guix import cran) (define %input-style (make-parameter 'variable)) ; or 'specification +(define %license-prefix + (make-parameter identity)) + (define (string->licenses license-string) (let ((licenses (map string-trim-both @@ -89,9 +93,9 @@ (define (string->licenses license-string) (char-set-complement (char-set #\|)))))) (string->license licenses))) -(define string->license - (let ((prefix identity)) - (match-lambda +(define (string->license license-string) + (let ((prefix (%license-prefix))) + (match license-string ("AGPL-3" (prefix 'agpl3)) ("AGPL (>= 3)" (prefix 'agpl3+)) ("Artistic-2.0" (prefix 'artistic2.0)) diff --git a/guix/scripts/import/cran.scm b/guix/scripts/import/cran.scm index 2934d4300a..3186bf9248 100644 --- a/guix/scripts/import/cran.scm +++ b/guix/scripts/import/cran.scm @@ -53,6 +53,9 @@ (define (show-help) (display (G_ " -s, --style=STYLE choose output style, either specification or variable")) (display (G_ " + -p, --license-prefix=PREFIX + add custom prefix to licenses, useful for prefixed import of (guix licenses)")) + (display (G_ " -V, --version display version information and exit")) (newline) (show-bug-report-information)) @@ -74,6 +77,10 @@ (define %options (lambda (opt name arg result) (alist-cons 'style (string->symbol arg) (alist-delete 'style result)))) + (option '(#\p "license-prefix") #t #f + (lambda (opt name arg result) + (alist-cons 'license-prefix arg + (alist-delete 'license-prefix result)))) (option '(#\r "recursive") #f #f (lambda (opt name arg result) (alist-cons 'recursive #t result))) @@ -95,8 +102,15 @@ (define (parse-options) (('argument . value) value) (_ #f)) - (reverse opts)))) - (parameterize ((%input-style (assoc-ref opts 'style))) + (reverse opts))) + (prefix (assoc-ref opts 'license-prefix)) + (prefix-proc (if (string? prefix) + (lambda (symbol) + (string->symbol + (string-append prefix (symbol->string symbol)))) + identity))) + (parameterize ((%input-style (assoc-ref opts 'style)) + (%license-prefix prefix-proc)) (match args ((spec) (let ((name version (package-name->name+version spec))) -- 2.37.3 --jRC6WZhafm+9bWxP Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0002-import-cran-Allow-overriding-description-fetch-funct.patch" >From 19b0e079f409b90a51620454a1d3026d379c3fb1 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 18 Oct 2022 12:45:45 +0200 Subject: [PATCH 2/3] import/cran: Allow overriding description fetch function. X-Debbugs-Cc: zimon.toutoune@gmail.com X-Debbugs-Cc: dev@jpoiret.xyz X-Debbugs-Cc: mail@cbaines.net X-Debbugs-Cc: rekado@elephly.net X-Debbugs-Cc: othacehe@gnu.org X-Debbugs-Cc: ludo@gnu.org * guix/import/cran.scm (%fetch-description): New parameter. (cran->guix-package): Use it. (upstream-name): Use it. --- guix/import/cran.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/guix/import/cran.scm b/guix/import/cran.scm index d13231f633..05374b5317 100644 --- a/guix/import/cran.scm +++ b/guix/import/cran.scm @@ -56,6 +56,7 @@ (define-module (guix import cran) #:use-module (gnu packages) #:export (%input-style %license-prefix + %fetch-description cran->guix-package bioconductor->guix-package @@ -350,6 +351,9 @@ (define* (fetch-description repository name #:optional version) `(hg-changeset . ,changeset) meta))))))))) +(define %fetch-description + (make-parameter fetch-description)) + (define (listify meta field) "Look up FIELD in the alist META. If FIELD contains a comma-separated string, turn it into a list and strip off parenthetic expressions. Return the @@ -640,7 +644,7 @@ (define cran->guix-package (lambda* (package-name #:key (repo 'cran) version) "Fetch the metadata for PACKAGE-NAME from REPO and return the `package' s-expression corresponding to that package, or #f on failure." - (let ((description (fetch-description repo package-name version))) + (let ((description ((%fetch-description) repo package-name version))) (if description (description->package repo description) (case repo @@ -694,7 +698,7 @@ (define upstream-name (package->upstream-name pkg)) (define meta - (fetch-description 'cran upstream-name)) + ((%fetch-description) 'cran upstream-name)) (and meta (let ((version (assoc-ref meta "Version"))) -- 2.37.3 --jRC6WZhafm+9bWxP Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0003-import-cran-Allow-overriding-tarball-download.patch" >From 89e46f83c2a39a63326bb4faedf36fb678c03a03 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 18 Oct 2022 12:45:56 +0200 Subject: [PATCH 3/3] import/cran: Allow overriding tarball download. X-Debbugs-Cc: zimon.toutoune@gmail.com X-Debbugs-Cc: dev@jpoiret.xyz X-Debbugs-Cc: mail@cbaines.net X-Debbugs-Cc: rekado@elephly.net X-Debbugs-Cc: othacehe@gnu.org X-Debbugs-Cc: ludo@gnu.org * guix/import/cran.scm (%download-source): New parameter. (description->package): Use it. --- guix/import/cran.scm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/guix/import/cran.scm b/guix/import/cran.scm index 05374b5317..2a12963532 100644 --- a/guix/import/cran.scm +++ b/guix/import/cran.scm @@ -57,6 +57,7 @@ (define-module (guix import cran) #:export (%input-style %license-prefix %fetch-description + %download-source cran->guix-package bioconductor->guix-package @@ -265,6 +266,9 @@ (define download ;; of the URLs is the /Archive CRAN URL. (any (cut download-to-store store <>) urls))))))))) +(define %download-source + (make-parameter download)) + (define (fetch-description-from-tarball url) "Fetch the tarball at URL, extra its 'DESCRIPTION' file, parse it, and return the resulting alist." @@ -547,10 +551,10 @@ (define (description->package repository meta) (_ #f))))) (git? (if (assoc-ref meta 'git) #true #false)) (hg? (if (assoc-ref meta 'hg) #true #false)) - (source (download source-url #:method (cond - (git? 'git) - (hg? 'hg) - (else #f)))) + (source ((%download-source) source-url #:method (cond + (git? 'git) + (hg? 'hg) + (else #f)))) (sysdepends (append (if (needs-zlib? source (not (or git? hg?))) '("zlib") '()) (filter (lambda (name) -- 2.37.3 --jRC6WZhafm+9bWxP--