* [bug#37322] [PATCH v2 1/2] added versoining to crate import
[not found] <877e6j9dmj.fsf.org>
@ 2019-09-09 15:36 ` Martin Becze
2019-09-09 22:38 ` bug#37322: " Ludovic Courtès
0 siblings, 1 reply; 2+ messages in thread
From: Martin Becze @ 2019-09-09 15:36 UTC (permalink / raw)
To: 37322, ludo; +Cc: Martin Becze
---
guix/import/crate.scm | 12 +++++++++---
guix/scripts/import/crate.scm | 10 +++++++++-
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index f6057dbf8b..de56432e3c 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 David Craven <david@craven.ch>
;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2019 Martin Becze <mjbecze@riseup.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -181,8 +182,8 @@ and LICENSE."
;; This regexp matches that.
(make-regexp "^(.*) OR (.*)$"))
-(define (crate->guix-package crate-name)
- "Fetch the metadata for CRATE-NAME from crates.io, and return the
+(define (crate->guix-package crate-name version)
+ "Fetch the metadata for CRATE-NAME@VERSION from crates.io, and return the
`package' s-expression corresponding to that package, or #f on failure."
(define (string->license string)
(match (regexp-exec %dual-license-rx string)
@@ -196,10 +197,15 @@ and LICENSE."
(define crate
(lookup-crate crate-name))
+ (define crate-version-string
+ (if version
+ version
+ (crate-latest-version crate)))
+
(and crate
(let* ((version (find (lambda (version)
(string=? (crate-version-number version)
- (crate-latest-version crate)))
+ crate-version-string))
(crate-versions crate)))
(dependencies (crate-version-dependencies version))
(dep-crates (filter normal-dependency? dependencies))
diff --git a/guix/scripts/import/crate.scm b/guix/scripts/import/crate.scm
index cab9a4397b..948b90ec15 100644
--- a/guix/scripts/import/crate.scm
+++ b/guix/scripts/import/crate.scm
@@ -2,6 +2,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 David Thompson <davet@gnu.org>
;;; Copyright © 2016 David Craven <david@craven.ch>
+;;; Copyright © 2019 Martin Becze <mjbecze@riseup.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -66,6 +67,7 @@ Import and convert the crate.io package for PACKAGE-NAME.\n"))
;;;
(define (guix-import-crate . args)
+
(define (parse-options)
;; Return the alist of option values.
(args-fold* args %options
@@ -75,6 +77,7 @@ Import and convert the crate.io package for PACKAGE-NAME.\n"))
(alist-cons 'argument arg result))
%default-options))
+
(let* ((opts (parse-options))
(args (filter-map (match-lambda
(('argument . value)
@@ -83,7 +86,12 @@ Import and convert the crate.io package for PACKAGE-NAME.\n"))
(reverse opts))))
(match args
((package-name)
- (let ((sexp (crate->guix-package package-name)))
+ (define-values (name version)
+ (match (string-split package-name #\@)
+ ((name version) (values name version))
+ ((name) (values name #f))))
+
+ (let ((sexp (crate->guix-package name version)))
(unless sexp
(leave (G_ "failed to download meta-data for package '~a'~%")
package-name))
--
2.23.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#37322: [PATCH v2 1/2] added versoining to crate import
2019-09-09 15:36 ` [bug#37322] [PATCH v2 1/2] added versoining to crate import Martin Becze
@ 2019-09-09 22:38 ` Ludovic Courtès
0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2019-09-09 22:38 UTC (permalink / raw)
To: Martin Becze; +Cc: 37322-done
Hi Martin,
Martin Becze <mjbecze@riseup.net> skribis:
> ---
> guix/import/crate.scm | 12 +++++++++---
> guix/scripts/import/crate.scm | 10 +++++++++-
> 2 files changed, 18 insertions(+), 4 deletions(-)
Pushed as fd63ecbe050bf8fa7c8ff0a003d56cce97b6ded1. I tweaked quite a
few things, mostly for cosmetic reasons, and added a commit log that
follows our conventions. Please take a look!
Thank you,
Ludo’.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-09 22:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <877e6j9dmj.fsf.org>
2019-09-09 15:36 ` [bug#37322] [PATCH v2 1/2] added versoining to crate import Martin Becze
2019-09-09 22:38 ` bug#37322: " Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).