GNU bug report logs - #68358
[PATCH] guix: import: cpan: add recursive

Previous Next

Package: guix-patches;

Reported by: "zero <at> fedora" <shinyzero0 <at> tilde.club>

Date: Wed, 10 Jan 2024 00:44:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #13 received at 68358-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "zero <at> fedora" <shinyzero0 <at> tilde.club>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, 68358-done <at> debbugs.gnu.org,
 Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Tobias Geerinckx-Rice <me <at> tobias.gr>, Ricardo Wurmus <rekado <at> elephly.net>,
 Christopher Baines <guix <at> cbaines.net>
Subject: Re: [bug#68358] [PATCH] guix: import: cpan: add recursive
Date: Sat, 23 Nov 2024 16:22:57 +0100
[Message part 1 (text/plain, inline)]
Hi,

"zero <at> fedora" <shinyzero0 <at> tilde.club> skribis:

> * guix/import/cpan.scm: new function, some changes to make recursive import possible
> * guix/scripts/import/cpan.scm: add recursive import
>
> Change-Id: Id167c7ddd079f4e04650ce7cc1692a9de36cd8fe

Applied with the cosmetic changes below and tweaks to the commit log.

Thank you, and apologies for the long delay!

Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/doc/guix.texi b/doc/guix.texi
index 454dd66c18..8297ad2ca6 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -14207,6 +14207,17 @@ Invoking guix import
 guix import cpan Acme::Boolean
 @end example
 
+Like many other importers, the @code{cpan} importer supports recursive
+imports:
+
+@table @code
+@item --recursive
+@itemx -r
+Traverse the dependency graph of the given upstream package recursively
+and generate package expressions for all those packages that are not yet
+in Guix.
+@end table
+
 @item cran
 @cindex CRAN
 @cindex Bioconductor
diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index 2090da275d..85e5e69098 100644
--- a/guix/import/cpan.scm
+++ b/guix/import/cpan.scm
@@ -37,7 +37,8 @@ (define-module (guix import cpan)
   #:use-module (guix utils)
   #:use-module (guix base32)
   #:use-module ((guix download) #:select (download-to-store url-fetch))
-  #:use-module (guix import utils)
+  #:use-module ((guix import utils)
+                #:select (factorize-uri recursive-import))
   #:use-module (guix import json)
   #:use-module (guix packages)
   #:use-module (guix upstream)
@@ -309,18 +310,15 @@ (define (cpan-module->sexp release)
               (synopsis ,(cpan-release-abstract release))
               (description fill-in-yourself!)
               (license ,(string->license (cpan-release-license release))))))
-    (values
-      sexp
-      (map upstream-input-name inputs))
-    ))
+    (values sexp (map upstream-input-name inputs))))
 
 (define* (cpan->guix-package module-name #:key version #:allow-other-keys)
   "Fetch the metadata for PACKAGE-NAME from metacpan.org, and return the
 `package' s-expression corresponding to that package, or #f on failure."
   (let ((release (cpan-fetch (module->name module-name))))
     (if release
-      (cpan-module->sexp release)
-      (values #f '()))))
+        (cpan-module->sexp release)
+        (values #f '()))))
 
 (define cpan-package?
   (let ((cpan-rx (make-regexp (string-append "("
diff --git a/guix/scripts/import/cpan.scm b/guix/scripts/import/cpan.scm
index cab6424068..4ddd85ee57 100644
--- a/guix/scripts/import/cpan.scm
+++ b/guix/scripts/import/cpan.scm
@@ -44,8 +44,7 @@ (define (show-help)
   (display (G_ "
   -h, --help             display this help and exit"))
   (display (G_ "
-  -r, --recursive        generate package expressions for all Gem packages\
- that are not yet in Guix"))
+  -r, --recursive        import missing packages recursively"))
   (display (G_ "
   -V, --version          display version information and exit"))
   (newline)

This bug report was last modified 178 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.