From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 19 05:29:24 2022 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 To: guix-patches@gnu.org Subject: [PATCH 0/3] import/cran: Parameterize for guix-cran. Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="jRC6WZhafm+9bWxP" Content-Disposition: inline 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 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-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --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--