summary refs log tree commit diff
path: root/tests/crate.scm
diff options
context:
space:
mode:
authorMartin Becze <mjbecze@riseup.net>2020-02-04 03:50:48 -0500
committerHartmut Goebel <h.goebel@crazy-compilers.com>2020-12-02 22:09:23 +0100
commit269c1db41bd82f93c7ae5c62a4969a423e556183 (patch)
tree7ebfc953a3a418cf5f4d41e6dd1c897b121bc1d4 /tests/crate.scm
parentbea3b17739fc591b8cf6db1f8d28a6f6c9585577 (diff)
downloadguix-269c1db41bd82f93c7ae5c62a4969a423e556183.tar.gz
import: crate: Use guile-semver to resolve module versions.
* guix/import/crate.scm: Add guile-semver as a soft dependency.
  (make-crate-sexp): Don't allow other keys. Add '#:skip-build?' to build
  system args. Pass a VERSION argument to 'cargo-inputs'.
  (crate->guix-package): Use guile-semver to resolve the correct module
  versions. Treat "build" dependencies as normal dependencies.
  (crate-name->package-name): Reuse the procedure 'guix-name' instead of
  duplicating its logic.
* guix/import/utils.scm (package-names->package-inputs): Implement
  handling of (name version) pairs.
* guix/scripts/import/crate.scm (guix-import-crate): Use
  crate-recursive-import instead of duplicate code.
* tests/crate.scm (recursive-import): Change test packages versions to be
  distinguishable. Add version data to the test. Check created symbols, too.

Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
Diffstat (limited to 'tests/crate.scm')
-rw-r--r--tests/crate.scm500
1 files changed, 308 insertions, 192 deletions
diff --git a/tests/crate.scm b/tests/crate.scm
index 61a04f986b..4465e12767 100644
--- a/tests/crate.scm
+++ b/tests/crate.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2014 David Thompson <davet@gnu.org>
 ;;; Copyright © 2016 David Craven <david@craven.ch>
 ;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -28,23 +29,67 @@
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-64))
 
+
+;; crate versions and dependencies used here
+;; foo-0.8.1
+;; foo-1.0.0
+;; foo-1.0.3
+;; 	leaf-alice 0.7.5
+;;
+;; root-1.0.0
+;; root-1.0.4
+;; 	intermediate-a  1.0.42
+;; 	intermeidate-b ^1.0.0
+;; 	leaf-alice     ^0.7
+;; 	leaf-bob     ^3
+;;
+;; intermediate-a-1.0.40
+;; intermediate-a-1.0.42
+;; intermediate-a-1.1.0-alpha.1
+;; 	intermediate-a	1.2.3
+;; 	leaf-alice	0.7.5
+;; 	leaf-bob	^3
+;;
+;; intermediate-b-1.2.3
+;; 	leaf-bob	3.0.1
+;;
+;; leaf-alice-0.7.3
+;; leaf-alice-0.7.5
+;;
+;; leaf-bob-3.0.1
+
+
 (define test-foo-crate
   "{
   \"crate\": {
-    \"max_version\": \"1.0.0\",
+    \"max_version\": \"1.0.3\",
     \"name\": \"foo\",
     \"description\": \"summary\",
     \"homepage\": \"http://example.com\",
     \"repository\": \"http://example.com\",
-    \"keywords\": [\"dummy\" \"test\"],
-    \"categories\": [\"test\"]
+    \"keywords\": [\"dummy\", \"test\"],
+    \"categories\": [\"test\"],
     \"actual_versions\": [
-      { \"id\": \"foo\",
+      { \"id\": 234210,
+        \"num\": \"0.8.1\",
+        \"license\": \"MIT OR Apache-2.0\",
+        \"links\": {
+          \"dependencies\": \"/api/v1/crates/foo/0.8.1/dependencies\"
+        }
+      },
+      { \"id\": 234212,
         \"num\": \"1.0.0\",
         \"license\": \"MIT OR Apache-2.0\",
         \"links\": {
           \"dependencies\": \"/api/v1/crates/foo/1.0.0/dependencies\"
         }
+      },
+      { \"id\": 234214,
+        \"num\": \"1.0.3\",
+        \"license\": \"MIT OR Apache-2.0\",
+        \"links\": {
+          \"dependencies\": \"/api/v1/crates/foo/1.0.3/dependencies\"
+        }
       }
     ]
   }
@@ -54,8 +99,9 @@
   "{
   \"dependencies\": [
      {
-       \"crate_id\": \"bar\",
-       \"kind\": \"normal\"
+       \"crate_id\": \"leaf-alice\",
+       \"kind\": \"normal\",
+       \"req\": \"0.7.5\"
      }
   ]
 }")
@@ -63,20 +109,27 @@
 (define test-root-crate
   "{
   \"crate\": {
-    \"max_version\": \"1.0.0\",
+    \"max_version\": \"1.0.4\",
     \"name\": \"root\",
     \"description\": \"summary\",
     \"homepage\": \"http://example.com\",
     \"repository\": \"http://example.com\",
-    \"keywords\": [\"dummy\" \"test\"],
-    \"categories\": [\"test\"]
+    \"keywords\": [\"dummy\", \"test\"],
+    \"categories\": [\"test\"],
     \"actual_versions\": [
-      { \"id\": \"foo\",
+      { \"id\": 234240,
         \"num\": \"1.0.0\",
         \"license\": \"MIT OR Apache-2.0\",
         \"links\": {
           \"dependencies\": \"/api/v1/crates/root/1.0.0/dependencies\"
         }
+      },
+      { \"id\": 234242,
+        \"num\": \"1.0.4\",
+        \"license\": \"MIT OR Apache-2.0\",
+        \"links\": {
+          \"dependencies\": \"/api/v1/crates/root/1.0.4/dependencies\"
+        }
       }
     ]
   }
@@ -86,92 +139,114 @@
   "{
   \"dependencies\": [
      {
-       \"crate_id\": \"intermediate-1\",
-       \"kind\": \"normal\"
+       \"crate_id\": \"intermediate-a\",
+       \"kind\": \"normal\",
+       \"req\": \"1.0.42\"
      },
      {
-       \"crate_id\": \"intermediate-2\",
-       \"kind\": \"normal\"
+       \"crate_id\": \"intermediate-b\",
+       \"kind\": \"normal\",
+       \"req\": \"^1.0.0\"
      }
      {
        \"crate_id\": \"leaf-alice\",
-       \"kind\": \"normal\"
+       \"kind\": \"normal\",
+       \"req\": \"^0.7\"
      },
      {
        \"crate_id\": \"leaf-bob\",
-       \"kind\": \"normal\"
+       \"kind\": \"normal\",
+       \"req\": \"^3\"
      }
   ]
 }")
 
-(define test-intermediate-1-crate
+(define test-intermediate-a-crate
   "{
   \"crate\": {
-    \"max_version\": \"1.0.0\",
-    \"name\": \"intermediate-1\",
+    \"max_version\": \"1.1.0-alpha.1\",
+    \"name\": \"intermediate-a\",
     \"description\": \"summary\",
     \"homepage\": \"http://example.com\",
     \"repository\": \"http://example.com\",
-    \"keywords\": [\"dummy\" \"test\"],
-    \"categories\": [\"test\"]
+    \"keywords\": [\"dummy\", \"test\"],
+    \"categories\": [\"test\"],
     \"actual_versions\": [
-      { \"id\": \"intermediate-1\",
-        \"num\": \"1.0.0\",
+      { \"id\": 234251,
+        \"num\": \"1.0.40\",
+        \"license\": \"MIT OR Apache-2.0\",
+        \"links\": {
+          \"dependencies\": \"/api/v1/crates/intermediate-a/1.0.40/dependencies\"
+        }
+      },
+      { \"id\": 234250,
+        \"num\": \"1.0.42\",
+        \"license\": \"MIT OR Apache-2.0\",
+        \"links\": {
+          \"dependencies\": \"/api/v1/crates/intermediate-a/1.0.42/dependencies\"
+        }
+      },
+      { \"id\": 234252,
+        \"num\": \"1.1.0-alpha.1\",
         \"license\": \"MIT OR Apache-2.0\",
         \"links\": {
-          \"dependencies\": \"/api/v1/crates/intermediate-1/1.0.0/dependencies\"
+          \"dependencies\": \"/api/v1/crates/intermediate-a/1.1.0-alpha.1/dependencies\"
         }
       }
     ]
   }
 }")
 
-(define test-intermediate-1-dependencies
+(define test-intermediate-a-dependencies
   "{
   \"dependencies\": [
      {
-       \"crate_id\": \"intermediate-2\",
-       \"kind\": \"normal\"
+       \"crate_id\": \"intermediate-b\",
+       \"kind\": \"normal\",
+       \"req\": \"1.2.3\"
      },
      {
        \"crate_id\": \"leaf-alice\",
-       \"kind\": \"normal\"
+       \"kind\": \"normal\",
+       \"req\": \"0.7.5\"
      },
      {
        \"crate_id\": \"leaf-bob\",
-       \"kind\": \"normal\"
+       \"kind\": \"normal\",
+       \"req\": \"^3\"
      }
   ]
 }")
 
-(define test-intermediate-2-crate
+(define test-intermediate-b-crate
   "{
   \"crate\": {
-    \"max_version\": \"1.0.0\",
-    \"name\": \"intermediate-2\",
+    \"max_version\": \"1.2.3\",
+    \"name\": \"intermediate-b\",
     \"description\": \"summary\",
     \"homepage\": \"http://example.com\",
     \"repository\": \"http://example.com\",
-    \"keywords\": [\"dummy\" \"test\"],
-    \"categories\": [\"test\"]
+    \"keywords\": [\"dummy\", \"test\"],
+    \"categories\": [\"test\"],
     \"actual_versions\": [
-      { \"id\": \"intermediate-2\",
-        \"num\": \"1.0.0\",
+      { \"id\": 234260,
+        \"num\": \"1.2.3\",
         \"license\": \"MIT OR Apache-2.0\",
         \"links\": {
-          \"dependencies\": \"/api/v1/crates/intermediate-2/1.0.0/dependencies\"
+          \"dependencies\": \"/api/v1/crates/intermediate-b/1.2.3/dependencies\"
         }
       }
     ]
   }
 }")
 
-(define test-intermediate-2-dependencies
+(define test-intermediate-b-dependencies
   "{
   \"dependencies\": [
      {
        \"crate_id\": \"leaf-bob\",
-       \"kind\": \"normal\"
+       \"kind\": \"normal\",
+       \"req\": \"3.0.1\"
      }
   ]
 }")
@@ -179,19 +254,26 @@
 (define test-leaf-alice-crate
   "{
   \"crate\": {
-    \"max_version\": \"1.0.0\",
+    \"max_version\": \"0.7.5\",
     \"name\": \"leaf-alice\",
     \"description\": \"summary\",
     \"homepage\": \"http://example.com\",
     \"repository\": \"http://example.com\",
-    \"keywords\": [\"dummy\" \"test\"],
-    \"categories\": [\"test\"]
+    \"keywords\": [\"dummy\", \"test\"],
+    \"categories\": [\"test\"],
     \"actual_versions\": [
-      { \"id\": \"leaf-alice\",
-        \"num\": \"1.0.0\",
+      { \"id\": 234270,
+        \"num\": \"0.7.3\",
         \"license\": \"MIT OR Apache-2.0\",
         \"links\": {
-          \"dependencies\": \"/api/v1/crates/leaf-alice/1.0.0/dependencies\"
+          \"dependencies\": \"/api/v1/crates/leaf-alice/0.7.3/dependencies\"
+        }
+      },
+      { \"id\": 234272,
+        \"num\": \"0.7.5\",
+        \"license\": \"MIT OR Apache-2.0\",
+        \"links\": {
+          \"dependencies\": \"/api/v1/crates/leaf-alice/0.7.5/dependencies\"
         }
       }
     ]
@@ -206,19 +288,19 @@
 (define test-leaf-bob-crate
   "{
   \"crate\": {
-    \"max_version\": \"1.0.0\",
+    \"max_version\": \"3.0.1\",
     \"name\": \"leaf-bob\",
     \"description\": \"summary\",
     \"homepage\": \"http://example.com\",
     \"repository\": \"http://example.com\",
-    \"keywords\": [\"dummy\" \"test\"],
+    \"keywords\": [\"dummy\", \"test\"],
     \"categories\": [\"test\"]
     \"actual_versions\": [
-      { \"id\": \"leaf-bob\",
-        \"num\": \"1.0.0\",
+      { \"id\": 234280,
+        \"num\": \"3.0.1\",
         \"license\": \"MIT OR Apache-2.0\",
         \"links\": {
-          \"dependencies\": \"/api/v1/crates/leaf-bob/1.0.0/dependencies\"
+          \"dependencies\": \"/api/v1/crates/leaf-bob/3.0.1/dependencies\"
         }
       }
     ]
@@ -251,36 +333,51 @@
            (match url
              ("https://crates.io/api/v1/crates/foo"
               (open-input-string test-foo-crate))
-             ("https://crates.io/api/v1/crates/foo/1.0.0/download"
+             ("https://crates.io/api/v1/crates/foo/1.0.3/download"
               (set! test-source-hash
-                (bytevector->nix-base32-string
-                 (sha256 (string->bytevector "empty file\n" "utf-8"))))
+                    (bytevector->nix-base32-string
+                     (sha256 (string->bytevector "empty file\n" "utf-8"))))
               (open-input-string "empty file\n"))
-             ("https://crates.io/api/v1/crates/foo/1.0.0/dependencies"
+             ("https://crates.io/api/v1/crates/foo/1.0.3/dependencies"
               (open-input-string test-foo-dependencies))
+             ("https://crates.io/api/v1/crates/leaf-alice"
+              (open-input-string test-leaf-alice-crate))
+             ("https://crates.io/api/v1/crates/leaf-alice/0.7.5/download"
+              (set! test-source-hash
+                    (bytevector->nix-base32-string
+                     (sha256 (string->bytevector "empty file\n" "utf-8"))))
+              (open-input-string "empty file\n"))
+             ("https://crates.io/api/v1/crates/leaf-alice/0.7.5/dependencies"
+              (open-input-string test-leaf-alice-dependencies))
              (_ (error "Unexpected URL: " url)))))
-    (match (crate->guix-package "foo")
-      (('package
-         ('name "rust-foo")
-         ('version "1.0.0")
-         ('source ('origin
-                    ('method 'url-fetch)
-                    ('uri ('crate-uri "foo" 'version))
-                    ('file-name ('string-append 'name "-" 'version ".tar.gz"))
-                    ('sha256
-                     ('base32
-                      (? string? hash)))))
-         ('build-system 'cargo-build-system)
-         ('arguments
-          ('quasiquote
-           ('#:cargo-inputs (("rust-bar" ('unquote rust-bar))))))
-         ('home-page "http://example.com")
-         ('synopsis "summary")
-         ('description "summary")
-         ('license ('list 'license:expat 'license:asl2.0)))
-       (string=? test-source-hash hash))
-      (x
-       (pk 'fail x #f)))))
+
+        (match (crate->guix-package "foo")
+          ((define-public 'rust-foo-1.0.3
+             (package (name "rust-foo")
+                      (version "1.0.3")
+                      (source
+                       (origin
+                         (method url-fetch)
+                         (uri (crate-uri "foo" 'version))
+                         (file-name (string-append name "-" version ".tar.gz"))
+                         (sha256
+                          (base32
+                           (?  string? hash)))))
+                      (build-system 'cargo-build-system)
+                      (arguments
+                       ('quasiquote
+                        (#:skip-build? #t
+                         #:cargo-inputs
+                         (("rust-leaf-alice"
+                           ('unquote 'rust-leaf-alice-0.7.5))))))
+                      (home-page "http://example.com")
+                      (synopsis "summary")
+                      (description "summary")
+                      (license (list license:expat license:asl2.0))))
+
+           (string=? test-source-hash hash))
+          (x
+           (pk 'fail x #f)))))
 
 (test-assert "cargo-recursive-import"
   ;; Replace network resources with sample data.
@@ -289,151 +386,170 @@
            (match url
              ("https://crates.io/api/v1/crates/root"
               (open-input-string test-root-crate))
-             ("https://crates.io/api/v1/crates/root/1.0.0/download"
+             ("https://crates.io/api/v1/crates/root/1.0.4/download"
               (set! test-source-hash
                     (bytevector->nix-base32-string
                      (sha256 (string->bytevector "empty file\n" "utf-8"))))
               (open-input-string "empty file\n"))
-             ("https://crates.io/api/v1/crates/root/1.0.0/dependencies"
+             ("https://crates.io/api/v1/crates/root/1.0.4/dependencies"
               (open-input-string test-root-dependencies))
-             ("https://crates.io/api/v1/crates/intermediate-1"
-              (open-input-string test-intermediate-1-crate))
-             ("https://crates.io/api/v1/crates/intermediate-1/1.0.0/download"
+             ("https://crates.io/api/v1/crates/intermediate-a"
+              (open-input-string test-intermediate-a-crate))
+             ("https://crates.io/api/v1/crates/intermediate-a/1.0.42/download"
               (set! test-source-hash
                     (bytevector->nix-base32-string
                      (sha256 (string->bytevector "empty file\n" "utf-8"))))
               (open-input-string "empty file\n"))
-             ("https://crates.io/api/v1/crates/intermediate-1/1.0.0/dependencies"
-              (open-input-string test-intermediate-1-dependencies))
-             ("https://crates.io/api/v1/crates/intermediate-2"
-              (open-input-string test-intermediate-2-crate))
-             ("https://crates.io/api/v1/crates/intermediate-2/1.0.0/download"
+             ("https://crates.io/api/v1/crates/intermediate-a/1.0.42/dependencies"
+              (open-input-string test-intermediate-a-dependencies))
+             ("https://crates.io/api/v1/crates/intermediate-b"
+              (open-input-string test-intermediate-b-crate))
+             ("https://crates.io/api/v1/crates/intermediate-b/1.2.3/download"
               (set! test-source-hash
                     (bytevector->nix-base32-string
                      (sha256 (string->bytevector "empty file\n" "utf-8"))))
               (open-input-string "empty file\n"))
-             ("https://crates.io/api/v1/crates/intermediate-2/1.0.0/dependencies"
-              (open-input-string test-intermediate-2-dependencies))
+             ("https://crates.io/api/v1/crates/intermediate-b/1.2.3/dependencies"
+              (open-input-string test-intermediate-b-dependencies))
              ("https://crates.io/api/v1/crates/leaf-alice"
               (open-input-string test-leaf-alice-crate))
-             ("https://crates.io/api/v1/crates/leaf-alice/1.0.0/download"
+             ("https://crates.io/api/v1/crates/leaf-alice/0.7.5/download"
               (set! test-source-hash
                     (bytevector->nix-base32-string
                      (sha256 (string->bytevector "empty file\n" "utf-8"))))
               (open-input-string "empty file\n"))
-             ("https://crates.io/api/v1/crates/leaf-alice/1.0.0/dependencies"
+             ("https://crates.io/api/v1/crates/leaf-alice/0.7.5/dependencies"
               (open-input-string test-leaf-alice-dependencies))
              ("https://crates.io/api/v1/crates/leaf-bob"
               (open-input-string test-leaf-bob-crate))
-             ("https://crates.io/api/v1/crates/leaf-bob/1.0.0/download"
+             ("https://crates.io/api/v1/crates/leaf-bob/3.0.1/download"
               (set! test-source-hash
                     (bytevector->nix-base32-string
                      (sha256 (string->bytevector "empty file\n" "utf-8"))))
               (open-input-string "empty file\n"))
-             ("https://crates.io/api/v1/crates/leaf-bob/1.0.0/dependencies"
+             ("https://crates.io/api/v1/crates/leaf-bob/3.0.1/dependencies"
               (open-input-string test-leaf-bob-dependencies))
              (_ (error "Unexpected URL: " url)))))
         (match (crate-recursive-import "root")
-          ;; rust-intermediate-2 has no dependency on the rust-leaf-alice package, so this is a valid ordering
-          ((('package
-              ('name "rust-leaf-alice")
-              ('version (? string? ver))
-              ('source
-               ('origin
-                 ('method 'url-fetch)
-                 ('uri ('crate-uri "leaf-alice" 'version))
-                 ('file-name
-                  ('string-append 'name "-" 'version ".tar.gz"))
-                 ('sha256
-                  ('base32
-                   (? string? hash)))))
-              ('build-system 'cargo-build-system)
-              ('home-page "http://example.com")
-              ('synopsis "summary")
-              ('description "summary")
-              ('license ('list 'license:expat 'license:asl2.0)))
-            ('package
-              ('name "rust-leaf-bob")
-              ('version (? string? ver))
-              ('source
-               ('origin
-                 ('method 'url-fetch)
-                 ('uri ('crate-uri "leaf-bob" 'version))
-                 ('file-name
-                  ('string-append 'name "-" 'version ".tar.gz"))
-                 ('sha256
-                  ('base32
-                   (? string? hash)))))
-              ('build-system 'cargo-build-system)
-              ('home-page "http://example.com")
-              ('synopsis "summary")
-              ('description "summary")
-              ('license ('list 'license:expat 'license:asl2.0)))
-            ('package
-              ('name "rust-intermediate-2")
-              ('version (? string? ver))
-              ('source
-               ('origin
-                 ('method 'url-fetch)
-                 ('uri ('crate-uri "intermediate-2" 'version))
-                 ('file-name
-                  ('string-append 'name "-" 'version ".tar.gz"))
-                 ('sha256
-                  ('base32
-                   (? string? hash)))))
-              ('build-system 'cargo-build-system)
-              ('arguments
-               ('quasiquote
-                ('#:cargo-inputs (("rust-leaf-bob" ('unquote rust-leaf-bob))))))
-              ('home-page "http://example.com")
-              ('synopsis "summary")
-              ('description "summary")
-              ('license ('list 'license:expat 'license:asl2.0)))
-            ('package
-              ('name "rust-intermediate-1")
-              ('version (? string? ver))
-              ('source
-               ('origin
-                 ('method 'url-fetch)
-                 ('uri ('crate-uri "intermediate-1" 'version))
-                 ('file-name
-                  ('string-append 'name "-" 'version ".tar.gz"))
-                 ('sha256
-                  ('base32
-                   (? string? hash)))))
-              ('build-system 'cargo-build-system)
-              ('arguments
-               ('quasiquote
-                ('#:cargo-inputs (("rust-intermediate-2" ('unquote rust-intermediate-2))
-                                  ("rust-leaf-alice" ('unquote rust-leaf-alice))
-                                  ("rust-leaf-bob" ('unquote rust-leaf-bob))))))
-              ('home-page "http://example.com")
-              ('synopsis "summary")
-              ('description "summary")
-              ('license ('list 'license:expat 'license:asl2.0)))
-            ('package
-              ('name "rust-root")
-              ('version (? string? ver))
-              ('source
-               ('origin
-                 ('method 'url-fetch)
-                 ('uri ('crate-uri "root" 'version))
-                 ('file-name
-                  ('string-append 'name "-" 'version ".tar.gz"))
-                 ('sha256
-                  ('base32
-                   (? string? hash)))))
-              ('build-system 'cargo-build-system)
-              ('arguments
-               ('quasiquote
-                ('#:cargo-inputs (("rust-intermediate-1" ('unquote rust-intermediate-1))
-                                  ("rust-intermediate-2" ('unquote rust-intermediate-2))
-                                  ("rust-leaf-alice" ('unquote rust-leaf-alice))
-                                  ("rust-leaf-bob" ('unquote rust-leaf-bob))))))
-              ('home-page "http://example.com")
-              ('synopsis "summary")
-              ('description "summary")
-              ('license ('list 'license:expat 'license:asl2.0))))
+          ;; rust-intermediate-b has no dependency on the rust-leaf-alice
+          ;; package, so this is a valid ordering
+          (((define-public 'rust-leaf-alice-0.7.5
+              (package
+                (name "rust-leaf-alice")
+                (version "0.7.5")
+                (source
+                 (origin
+                   (method url-fetch)
+                   (uri (crate-uri "leaf-alice" version))
+                   (file-name
+                    (string-append name "-" version ".tar.gz"))
+                   (sha256
+                    (base32
+                     (?  string? hash)))))
+                (build-system cargo-build-system)
+                (arguments ('quasiquote (#:skip-build? #t)))
+                (home-page "http://example.com")
+                (synopsis "summary")
+                (description "summary")
+                (license (list license:expat license:asl2.0))))
+            (define-public 'rust-leaf-bob-3.0.1
+              (package
+                (name "rust-leaf-bob")
+                (version "3.0.1")
+                (source
+                 (origin
+                   (method url-fetch)
+                   (uri (crate-uri "leaf-bob" version))
+                   (file-name
+                    (string-append name "-" version ".tar.gz"))
+                   (sha256
+                    (base32
+                     (?  string? hash)))))
+                (build-system cargo-build-system)
+                (arguments ('quasiquote (#:skip-build? #t)))
+                (home-page "http://example.com")
+                (synopsis "summary")
+                (description "summary")
+                (license (list license:expat license:asl2.0))))
+            (define-public 'rust-intermediate-b-1.2.3
+              (package
+                (name "rust-intermediate-b")
+                (version "1.2.3")
+                (source
+                 (origin
+                   (method url-fetch)
+                   (uri (crate-uri "intermediate-b" version))
+                   (file-name
+                    (string-append name "-" version ".tar.gz"))
+                   (sha256
+                    (base32
+                     (?  string? hash)))))
+                (build-system cargo-build-system)
+                (arguments
+                 ('quasiquote (#:skip-build? #t
+                               #:cargo-inputs
+                               (("rust-leaf-bob"
+                                 ('unquote 'rust-leaf-bob-3.0.1))))))
+                (home-page "http://example.com")
+                (synopsis "summary")
+                (description "summary")
+                (license (list license:expat license:asl2.0))))
+            (define-public 'rust-intermediate-a-1.0.42
+              (package
+                (name "rust-intermediate-a")
+                (version "1.0.42")
+                (source
+                 (origin
+                   (method url-fetch)
+                   (uri (crate-uri "intermediate-a" version))
+                   (file-name
+                    (string-append name "-" version ".tar.gz"))
+                   (sha256
+                    (base32
+                     (?  string? hash)))))
+                (build-system cargo-build-system)
+                (arguments
+                 ('quasiquote (#:skip-build? #t
+                               #:cargo-inputs
+                               (("rust-intermediate-b"
+                                 ('unquote 'rust-intermediate-b-1.2.3))
+                                ("rust-leaf-alice"
+                                 ('unquote 'rust-leaf-alice-0.7.5))
+                                ("rust-leaf-bob"
+                                 ('unquote 'rust-leaf-bob-3.0.1))))))
+                (home-page "http://example.com")
+                (synopsis "summary")
+                (description "summary")
+                (license (list license:expat license:asl2.0))))
+            (define-public 'rust-root-1.0.4
+              (package
+                (name "rust-root")
+                (version "1.0.4")
+                (source
+                 (origin
+                   (method url-fetch)
+                   (uri (crate-uri "root" version))
+                   (file-name
+                    (string-append name "-" version ".tar.gz"))
+                   (sha256
+                    (base32
+                     (?  string? hash)))))
+                (build-system cargo-build-system)
+                (arguments
+                 ('quasiquote (#:skip-build? #t
+                               #:cargo-inputs
+                               (("rust-intermediate-a"
+                                 ('unquote 'rust-intermediate-a-1.0.42))
+                                ("rust-intermediate-b"
+                                 ('unquote 'rust-intermediate-b-1.2.3))
+                                ("rust-leaf-alice"
+                                 ('unquote 'rust-leaf-alice-0.7.5))
+                                ("rust-leaf-bob"
+                                 ('unquote 'rust-leaf-bob-3.0.1))))))
+                (home-page "http://example.com")
+                (synopsis "summary")
+                (description "summary")
+                (license (list license:expat license:asl2.0)))))
            #t)
           (x
            (pk 'fail x #f)))))