[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
17/21: import: gem: Factorize "bundler" special case for name mapping.
From: |
guix-commits |
Subject: |
17/21: import: gem: Factorize "bundler" special case for name mapping. |
Date: |
Wed, 31 May 2023 17:52:50 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit e6f82fcd5f8d8340f7f4f5ac5e476db8caaaeef1
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun May 28 23:11:03 2023 +0200
import: gem: Factorize "bundler" special case for name mapping.
* guix/import/gem.scm (ruby-package-name): Add "bundler" special case.
(gem->guix-package): Adjust accordingly.
* tests/gem.scm ("gem-recursive-import")
("gem-recursive-import with a specific version"): Remove "ruby-bundler"
from the expected packages.
---
guix/import/gem.scm | 14 ++++++--------
tests/gem.scm | 30 ------------------------------
2 files changed, 6 insertions(+), 38 deletions(-)
diff --git a/guix/import/gem.scm b/guix/import/gem.scm
index 4e2be0f5f8..87a75bdaa6 100644
--- a/guix/import/gem.scm
+++ b/guix/import/gem.scm
@@ -93,9 +93,11 @@
(define (ruby-package-name name)
"Given the NAME of a package on RubyGems, return a Guix-compliant name for
the package."
- (if (string-prefix? "ruby-" name)
- (snake-case name)
- (string-append "ruby-" (snake-case name))))
+ (if (string=? name "bundler")
+ name ;special case: no prefix
+ (if (string-prefix? "ruby-" name)
+ (snake-case name)
+ (string-append "ruby-" (snake-case name)))))
(define (make-gem-sexp name version hash home-page synopsis description
dependencies licenses)
@@ -135,11 +137,7 @@ Optionally include a VERSION string to fetch a specific
version gem."
(let* ((dependencies-names (map gem-dependency-name
(gem-dependencies-runtime
(gem-dependencies gem))))
- (dependencies (map (lambda (dep)
- (if (string=? dep "bundler")
- "bundler" ; special case, no prefix
- (ruby-package-name dep)))
- dependencies-names))
+ (dependencies (map ruby-package-name dependencies-names))
(licenses (map string->license (gem-licenses gem))))
(values (make-gem-sexp (gem-name gem) (gem-version gem)
(gem-sha256 gem) (gem-home-page gem)
diff --git a/tests/gem.scm b/tests/gem.scm
index 6aa0d279dc..023415de7b 100644
--- a/tests/gem.scm
+++ b/tests/gem.scm
@@ -181,21 +181,6 @@
('description "Another cool gem")
('home-page "https://example.com")
('license #f)) ;no licensing info
- ('package
- ('name "ruby-bundler")
- ('version "1.14.2")
- ('source
- ('origin
- ('method 'url-fetch)
- ('uri ('rubygems-uri "bundler" 'version))
- ('sha256
- ('base32
- "1446xiz7zg0bz7kgx9jv84y0s4hpsg61dj5l3qb0i00avc1kxd9v"))))
- ('build-system 'ruby-build-system)
- ('synopsis "Ruby gem bundler")
- ('description "Ruby gem bundler")
- ('home-page "https://bundler.io/")
- ('license 'license:expat))
('package
('name "ruby-foo")
('version "1.0.0")
@@ -248,21 +233,6 @@
('description "Another cool gem")
('home-page "https://example.com")
('license #f)) ;no licensing info
- ('package
- ('name "ruby-bundler")
- ('version "1.14.2")
- ('source
- ('origin
- ('method 'url-fetch)
- ('uri ('rubygems-uri "bundler" 'version))
- ('sha256
- ('base32
- "1446xiz7zg0bz7kgx9jv84y0s4hpsg61dj5l3qb0i00avc1kxd9v"))))
- ('build-system 'ruby-build-system)
- ('synopsis "Ruby gem bundler")
- ('description "Ruby gem bundler")
- ('home-page "https://bundler.io/")
- ('license 'license:expat))
('package
('name "ruby-foo")
('version "2.0.0")
- 20/21: gnu: Add updater input properties for R and Python packages., (continued)
- 20/21: gnu: Add updater input properties for R and Python packages., guix-commits, 2023/05/31
- 21/21: tests: Use quasiquoted 'match' patterns for package sexps., guix-commits, 2023/05/31
- 05/21: import: utils: 'call-with-networking-exception-handler' doesn't unwind., guix-commits, 2023/05/31
- 04/21: tests: pypi: Rewrite tests using a local HTTP server., guix-commits, 2023/05/31
- 14/21: import: cpan: Represent dependencies as <upstream-input> records., guix-commits, 2023/05/31
- 15/21: import: cpan: Updater provides input list., guix-commits, 2023/05/31
- 19/21: upstream: Honor package properties for ignored and extra inputs., guix-commits, 2023/05/31
- 13/21: import: cpan: Remove unary 'string-append' call., guix-commits, 2023/05/31
- 18/21: import: gem: Updater provides input list., guix-commits, 2023/05/31
- 03/21: tests: http: Allow responses to specify a path., guix-commits, 2023/05/31
- 17/21: import: gem: Factorize "bundler" special case for name mapping.,
guix-commits <=