Re: Importers as independent packages?

2020-01-25 Thread Martin Becze

Thank you Ludo,
I added guile-semver to guix in the attached patch set, and I tested it 
by running ./pre-inst-env guix environment guix, which installed the 
guile-semver.



and Makefile.am may have to check whether guile-semver is available.)


I didn't see anything in the Makefile.am that looks to check for guile 
modules. Let me know if anything needs fixing!


=Martin
>From e4b022ce72582691dadae1b9f31ad6243914a5db Mon Sep 17 00:00:00 2001
From: Martin Becze 
Date: Sat, 18 Jan 2020 05:05:03 -0500
Subject: [PATCH v7 1/3] guix: import: (recursive-import) Allow for version
 numbers

* guix/import/utils.scm (package->definition) [arguments] added optional `append-version?`
* guix/import/utils.scm (recursive-import) [arguments] added key `version` and
  moved `repo` to be a key
* tests/import-utils.scm

* guix/import/cran.scm (cran->guix-package) [argument]: change `repo` to a key
* guix/import/cran.scm (cran-recursive-import) [argument]: change `repo` to a key
* guix/scripts/import/cran.scm: change `repo` to a key
* guix/import/elpa.scm (elpa->guix-pakcage) [argumnets]: change `repo` to a key
* guix/import/elpa.scm (elpa-recursive-import) [argumnets]: change `repo` to a key
* guix/scripts/import/elpa.scm: change `repo` to a key
* guix/import/gem.scm (gem->guix-package) [arguments]: change `repo` to a key
* guix/import/gem.scm (recursive-import) [arguments]: change `repo` to a key
* guix/import/opam.scm (opam-recurive-import) [arguments]: change `repo` to a key
* guix/import/pypi.scm (pypi-recursive-import) [arguments]: change `repo` to a key
* guix/import/stackage.scm (stackage-recursive-import) [arguments]: change `repo` to a key
---
 guix/import/cran.scm |  8 +++--
 guix/import/elpa.scm |  6 ++--
 guix/import/gem.scm  |  6 ++--
 guix/import/opam.scm |  5 ++--
 guix/import/pypi.scm |  5 ++--
 guix/import/stackage.scm |  5 ++--
 guix/import/utils.scm| 57 +++-
 guix/scripts/import/cran.scm |  5 ++--
 guix/scripts/import/elpa.scm |  4 ++-
 tests/import-utils.scm   |  8 +++--
 10 files changed, 69 insertions(+), 40 deletions(-)

diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index bcb37ed250..9e05dfcba8 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ricardo Wurmus 
 ;;; Copyright © 2015, 2016, 2017, 2019, 2020 Ludovic Courtès 
 ;;; Copyright © 2017 Mathieu Othacehe 
+;;; Copyright © 2020 Martin Becze 
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -506,7 +507,7 @@ from the alist META, which was derived from the R package's DESCRIPTION file."
 
 (define cran->guix-package
   (memoize
-   (lambda* (package-name #:optional (repo 'cran))
+   (lambda* (package-name #:key (repo 'cran) #:allow-other-keys)
  "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)))
@@ -521,8 +522,9 @@ s-expression corresponding to that package, or #f on failure."
   (cran->guix-package package-name 'cran))
  (else (values #f '()
 
-(define* (cran-recursive-import package-name #:optional (repo 'cran))
-  (recursive-import package-name repo
+(define* (cran-recursive-import package-name #:key (repo 'cran))
+  (recursive-import package-name
+#:repo repo
 #:repo->guix-package cran->guix-package
 #:guix-name cran-guix-name))
 
diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index 2d4487dba0..9140bcdc34 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2015 Federico Beffa 
 ;;; Copyright © 2015, 2016, 2017, 2018, 2020 Ludovic Courtès 
 ;;; Copyright © 2018 Oleg Pykhalov 
+;;; Copyright © 2020 Martin Becze 
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -245,7 +246,7 @@ type ''."
 (license ,license))
  dependencies-names)))
 
-(define* (elpa->guix-package name #:optional (repo 'gnu))
+(define* (elpa->guix-package name #:key (repo 'gnu) #:allow-other-keys)
   "Fetch the package NAME from REPO and produce a Guix package S-expression."
   (match (fetch-elpa-package name repo)
 (#f #f)
@@ -301,7 +302,8 @@ type ''."
 (define elpa-guix-name (cut guix-name "emacs-" <>))
 
 (define* (elpa-recursive-import package-name #:optional (repo 'gnu))
-  (recursive-import package-name repo
+  (recursive-import package-name
+#:repo repo
 #:repo->guix-package elpa->guix-package
 #:guix-name elpa-guix-name))
 
diff --git a/guix/import/gem.scm b/guix/import/gem.scm
index 0bf9ff2552..e744d9e69d 100644
--- a/guix/import/gem.scm
+++ b/guix/import/gem.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2015 David Thompson 
 ;;; Copyright © 2016 Ben Woodcroft 
 ;;; Copyright © 2018 Oleg Pykhalov 
+;;; Copyright © 2020 Martin Becze 
 ;;;
 ;;; 

Re: Importers as independent packages?

2019-12-27 Thread Ludovic Courtès
Hi Martin,

Martin Becze  skribis:

> I have been working on a recursive importer that uses semantic
> versioning over on #38408. It relies on guile-semver. I'm not exactly
> sure how to add guile-semver as a dependency to guix. But I'm also not
> sure that I should. Importers will probably not be used by the majority
> of end users so would it make sense to put the importers in their own
> package? This would also nicely solve recursive-import-semver's problem
> of being dependent on guile-semver. 
>
> Also in the future it would be nice if the crate import could read from
> a Cargo.toml directly (this will make importing things like alacritty
> much easier since it is not crates.io), which would probably mean have
> yet another dependency (guile-toml). What do you think about this Guix?

Good question.  In the end, ‘guix pull’ takes care of providing the
right dependency: guile-gcrypt, guile-json, guile-git, etc.  So here it
would just be a matter of telling (guix self) that the importer modules
depend on guile-semver in addition to the rest.  (Likewise, configure.ac
and Makefile.am may have to check whether guile-semver is available.)

IOW, it seems that we’re already set up to handle such things, as in
“guix pull” will do the right thing.

If, in the future, we end up having too many dependencies for developer
tools like importers, we might need to consider changing “guix pull” so
that it no longer pulls them in by default.  I think we’re not there
yet, though.

Thanks,
Ludo’.



Re: Importers as independent packages?

2019-12-17 Thread Martin Becze
On 2019-12-17 04:37, Martin Becze wrote:
> Hello Guix,
> I have been working on a recursive importer that uses semantic
> versioning over on #38408. It relies on guile-semver. I'm not exactly
> sure how to add guile-semver as a dependency to guix. But I'm also not
> sure that I should. Importers will probably not be used by the majority
> of end users so would it make sense to put the importers in their own
> package? This would also nicely solve recursive-import-semver's problem
> of being dependent on guile-semver. 
> 
> Also in the future it would be nice if the crate import could read from
> a Cargo.toml directly (this will make importing things like alacritty
> much easier since it is not crates.io), which would probably mean have
> yet another dependency (guile-toml). What do you think about this Guix?
> 
> Thanks,
> -Martin Becze

So I should say that I meant one package for all importers. Not one
package per-importer, since they share several common files.