From: Ivan Petkov <ivanppetkov@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 35318@debbugs.gnu.org, Chris Marusich <cmmarusich@gmail.com>
Subject: [bug#35318] [PATCH] Update cargo-build-system to expand package inputs
Date: Sun, 19 May 2019 18:00:01 -0700 [thread overview]
Message-ID: <6A0A0108-A722-4D73-85B7-E61AB8230026@gmail.com> (raw)
In-Reply-To: <87pnojvqdu.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 2345 bytes --]
Hi everyone!
I’ve updated this patch series. The cargo-build-system will now expect any
crate dependencies to be listed as arguments. Specifically, regular cargo
dependencies should be specified via the #:cargo-deps parameter, and any cargo
dev-dependnecies should be specified via the #:cargo-dev-deps parameter.
The cargo-build-system will traverse any inputs specified in those parameters,
and any inputs they may have in their #:cargo-deps parameter as well,
extracting their package sources and adding them as native-inputs to the
current bag being built. This avoids having to define new semantics for package
inputs/native-inputs for expanding all transitive sources.
There are several implications of this decision:
* Building a package definition does not require actually building/checking
any dependent crates. This can be a benefits:
- For example, sometimes a crate may have an optional dependency on some OS
specific package which cannot be built or run on the current system. This
approach means that the build will not fail if cargo ends up internally ignoring
the dependency.
- It avoids waiting for quadratic builds from source: cargo always builds
dependencies within the current workspace. This is largely due to Rust not
having a stable ABI and other resolutions that cargo applies. This means that
if we have a depencency chain of X -> Y -> Z and we build each definition
independently the following will happen:
* Cargo will build and test crate Z
* Cargo will build crate Z in Y's workspace, then build and test Y
* Cargo will build crates Y and Z in X's workspace, then build and test X
* But there are also some downsides with this approach:
- If a dependent crate is subtly broken on the system (i.e. it builds but its
tests fail) the consuming crates may build and test successfully but
actually fail during normal usage (however, the CI will still build all
packages which will give visibility in case packages suddenly break).
- Because crates aren't declared as regular inputs, other Guix facilities
such as tracking package graphs may not work by default (however, this is
something that can always be extended or reworked in the future).
Please let me know if anything is unclear, I’m happy to elaborate if needed!
Thanks,
—Ivan
[-- Attachment #2: 0001-build-system-cargo-expand-transitive-crate-sources.patch --]
[-- Type: application/octet-stream, Size: 7547 bytes --]
From 5457f60036ce1354b4b89b9c3c423cca14e3a777 Mon Sep 17 00:00:00 2001
From: Ivan Petkov <ivanppetkov@gmail.com>
Date: Tue, 16 Apr 2019 03:37:44 -0700
Subject: [PATCH 1/8] build-system/cargo: expand transitive crate sources
* guix/build/cargo: (package-cargo-deps): Add it.
(package-cargo-dev-deps): Add it.
(cargo-transitive-deps): Add it.
(expand-crate-sources): Add it.
(lower): New cargo-deps nd cargo-dev-deps keywords.
Use expand-crate-sources.
(private-keywords): Add new keywords.
---
guix/build-system/cargo.scm | 115 +++++++++++++++++++++++++++++++++++-
1 file changed, 114 insertions(+), 1 deletion(-)
diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
index dc137421e9..c1bfd13b2f 100644
--- a/guix/build-system/cargo.scm
+++ b/guix/build-system/cargo.scm
@@ -29,6 +29,8 @@
#:use-module (guix build-system)
#:use-module (guix build-system gnu)
#:use-module (ice-9 match)
+ #:use-module (ice-9 vlist)
+ #:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (%cargo-build-system-modules
%cargo-utils-modules
@@ -121,15 +123,125 @@ to NAME and VERSION."
#:outputs (cons "src" outputs)
#:guile-for-build guile-for-build))
+(define (package-cargo-deps p)
+ (apply
+ (lambda* (#:key (cargo-deps '()) #:allow-other-keys)
+ cargo-deps)
+ (package-arguments p)))
+
+(define (package-cargo-dev-deps p)
+ (apply
+ (lambda* (#:key (cargo-dev-deps '()) #:allow-other-keys)
+ cargo-dev-deps)
+ (package-arguments p)))
+
+(define (crate-transitive-deps inputs)
+ "Return the closure of INPUTS when considering the 'cargo-deps' and
+'cargod-dev-deps' edges. Omit duplicate inputs, except for those
+already present in INPUTS itself.
+
+This is implemented as a breadth-first traversal such that INPUTS is
+preserved, and only duplicate extracted inputs are removed.
+
+Forked from ((guix packages) transitive-inputs) since this extraction
+uses slightly different rules compared to the rest of Guix (i.e. we
+do not extract the conventional inputs)."
+ (define (seen? seen item)
+ ;; FIXME: We're using pointer identity here, which is extremely sensitive
+ ;; to memoization in package-producing procedures; see
+ ;; <https://bugs.gnu.org/30155>.
+ (vhash-assq item seen))
+
+ (let loop ((inputs inputs)
+ (result '())
+ (propagated '())
+ (first? #t)
+ (seen vlist-null))
+ (match inputs
+ (()
+ (if (null? propagated)
+ (reverse result)
+ (loop (reverse (concatenate propagated)) result '() #f seen)))
+ (((and input (label (? package? package))) rest ...)
+ (if (and (not first?) (seen? seen package))
+ (loop rest result propagated first? seen)
+ (loop rest
+ (cons input result)
+ (cons (package-cargo-deps package)
+ propagated)
+ first?
+ (vhash-consq package package seen))))
+ ((input rest ...)
+ (loop rest (cons input result) propagated first? seen)))))
+
+(define (expand-crate-sources cargo-deps cargo-dev-deps)
+ "Extract all transitive sources for CARGO-DEPS and CARGO-DEV-DEPS along their
+'cargo-deps' edges.
+
+Cargo requires all transitive crate dependencies' sources to be available
+in its index, even if they are optional (this is so it can generate
+deterministic Cargo.lock files regardless of the target platform or enabled
+features). Thus we need all transitive crate dependencies for any cargo
+dev-dependencies, but this is only needed when building/testing a crate directly
+(i.e. we will never need transitive dev-dependencies for any dependency crates).
+
+Another complication arises due potential dependency cycles from Guix's
+perspective: Although cargo does not permit cyclic dependencies between crates,
+however, it permits cycles to occur via dev-dependencies. For example, if crate
+X depends on crate Y, crate Y's tests could pull in crate X to to verify
+everything builds properly (this is a rare scenario, but it it happens for
+example with the `proc-macro2` and `quote` crates). This is allowed by cargo
+because tests are built as a pseudo-crate which happens to depend on the
+X and Y crates, forming an acyclic graph.
+
+We can side step this problem by only considering regular cargo dependencies
+since they are guaranteed to not have cycles. We can further resolve any
+potential dev-dependency cycles by extracting package sources (which never have
+any dependencies and thus no cycles can exist).
+
+There are several implications of this decision:
+* Building a package definition does not require actually building/checking
+any dependent crates. This can be a benefits:
+ - For example, sometimes a crate may have an optional dependency on some OS
+ specific package which cannot be built or run on the current system. This
+ approach means that the build will not fail if cargo ends up internally ignoring
+ the dependency.
+ - It avoids waiting for quadratic builds from source: cargo always builds
+ dependencies within the current workspace. This is largely due to Rust not
+ having a stable ABI and other resolutions that cargo applies. This means that
+ if we have a depencency chain of X -> Y -> Z and we build each definition
+ independently the following will happen:
+ * Cargo will build and test crate Z
+ * Cargo will build crate Z in Y's workspace, then build and test Y
+ * Cargo will build crates Y and Z in X's workspace, then build and test X
+* But there are also some downsides with this approach:
+ - If a dependent crate is subtly broken on the system (i.e. it builds but its
+ tests fail) the consuming crates may build and test successfully but
+ actually fail during normal usage (however, the CI will still build all
+ packages which will give visibility in case packages suddenly break).
+ - Because crates aren't declared as regular inputs, other Guix facilities
+ such as tracking package graphs may not work by default (however, this is
+ something that can always be extended or reworked in the future)."
+ (filter-map
+ (match-lambda
+ ((label (? package? p))
+ (list label (package-source p)))
+ ((label input)
+ (list label input)))
+ (crate-transitive-deps (append cargo-deps cargo-dev-deps))))
+
(define* (lower name
#:key source inputs native-inputs outputs system target
(rust (default-rust))
+ (cargo-deps '())
+ (cargo-dev-deps '())
#:allow-other-keys
#:rest arguments)
"Return a bag for NAME."
(define private-keywords
- '(#:source #:target #:rust #:inputs #:native-inputs #:outputs))
+ '(#:source #:target #:rust #:inputs #:native-inputs #:outputs
+ #:cargo-deps #:cargo-dev-deps))
(and (not target) ;; TODO: support cross-compilation
(bag
@@ -145,6 +257,7 @@ to NAME and VERSION."
,@(standard-packages)))
(build-inputs `(("cargo" ,rust "cargo")
("rustc" ,rust)
+ ,@(expand-crate-sources cargo-deps cargo-dev-deps)
,@native-inputs))
(outputs outputs)
(build cargo-build)
--
2.21.0
[-- Attachment #3: 0002-build-system-cargo-use-sources-from-package-sources.patch --]
[-- Type: application/octet-stream, Size: 2029 bytes --]
From 3aa329c44b7ebff26dd98276ab268ee120cf9bba Mon Sep 17 00:00:00 2001
From: Ivan Petkov <ivanppetkov@gmail.com>
Date: Thu, 16 May 2019 23:02:12 -0700
Subject: [PATCH 2/8] build-system/cargo: use sources from package sources
* guix/build/cargo-build-system: (configure): Expand crate tarballs in
vendor directory.
---
guix/build/cargo-build-system.scm | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm
index 9f44bd6ee9..44ad9744ce 100644
--- a/guix/build/cargo-build-system.scm
+++ b/guix/build/cargo-build-system.scm
@@ -67,14 +67,21 @@
(for-each
(match-lambda
((name . path)
- (let* ((rust-share (string-append path "/share/rust-source"))
- (basepath (basename path))
- (link-dir (string-append vendor-dir "/" basepath)))
- (and (file-exists? rust-share)
+ (let* ((basepath (basename path))
+ (crate-dir (string-append vendor-dir "/" basepath)))
+ (and (string-suffix? ".crate" path)
;; Gracefully handle duplicate inputs
- (not (file-exists? link-dir))
- (symlink rust-share link-dir)))))
+ (not (file-exists? crate-dir))
+ (mkdir-p crate-dir)
+ ;; Cargo crates are simply gzipped tarballs but with a .crate
+ ;; extension. We expand the source to a directory name we control
+ ;; so that we can generate any cargo checksums.
+ ;; The --strip-components argument is needed to prevent creating
+ ;; an extra directory within `crate-dir`.
+ (invoke "tar" "xvf" path "-C" crate-dir "--strip-components" "1")
+ (generate-checksums crate-dir "/dev/null")))))
inputs)
+
;; Configure cargo to actually use this new directory.
(mkdir-p ".cargo")
(let ((port (open-file ".cargo/config" "w" #:encoding "utf-8")))
--
2.21.0
[-- Attachment #4: 0003-build-system-cargo-don-t-copy-source-as-an-output.patch --]
[-- Type: application/octet-stream, Size: 3196 bytes --]
From 5615665eafdc3a543e0eb4ec1ed84f7c38475446 Mon Sep 17 00:00:00 2001
From: Ivan Petkov <ivanppetkov@gmail.com>
Date: Thu, 16 May 2019 23:05:50 -0700
Subject: [PATCH 3/8] build-system/cargo: don't copy source as an output
* guix/build-system/cargo: (cargo-build)[build-expression->derivation]:
Don't add "src" output.
* guix/build/cargo-build-system: (install-source): Delete it.
(%standard-phases): Delete 'install-source.
---
guix/build-system/cargo.scm | 2 +-
guix/build/cargo-build-system.scm | 21 +--------------------
2 files changed, 2 insertions(+), 21 deletions(-)
diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
index c1bfd13b2f..fb24ea9892 100644
--- a/guix/build-system/cargo.scm
+++ b/guix/build-system/cargo.scm
@@ -120,7 +120,7 @@ to NAME and VERSION."
#:inputs inputs
#:system system
#:modules imported-modules
- #:outputs (cons "src" outputs)
+ #:outputs outputs
#:guile-for-build guile-for-build))
(define (package-cargo-deps p)
diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm
index 44ad9744ce..26d474c9b5 100644
--- a/guix/build/cargo-build-system.scm
+++ b/guix/build/cargo-build-system.scm
@@ -79,7 +79,7 @@
;; The --strip-components argument is needed to prevent creating
;; an extra directory within `crate-dir`.
(invoke "tar" "xvf" path "-C" crate-dir "--strip-components" "1")
- (generate-checksums crate-dir "/dev/null")))))
+ (generate-checksums crate-dir)))))
inputs)
;; Configure cargo to actually use this new directory.
@@ -124,24 +124,6 @@ directory = '" port)
(define (touch file-name)
(call-with-output-file file-name (const #t)))
-(define* (install-source #:key inputs outputs #:allow-other-keys)
- "Install the source for a given Cargo package."
- (let* ((out (assoc-ref outputs "out"))
- (src (assoc-ref inputs "source"))
- (rsrc (string-append (assoc-ref outputs "src")
- "/share/rust-source")))
- (mkdir-p rsrc)
- ;; Rust doesn't have a stable ABI yet. Because of this
- ;; Cargo doesn't have a search path for binaries yet.
- ;; Until this changes we are working around this by
- ;; vendoring the crates' sources by symlinking them
- ;; to store paths.
- (copy-recursively "." rsrc)
- (touch (string-append rsrc "/.cargo-ok"))
- (generate-checksums rsrc)
- (install-file "Cargo.toml" rsrc)
- #t))
-
(define* (install #:key inputs outputs skip-build? #:allow-other-keys)
"Install a given Cargo package."
(let* ((out (assoc-ref outputs "out")))
@@ -163,7 +145,6 @@ directory = '" port)
(define %standard-phases
(modify-phases gnu:%standard-phases
(delete 'bootstrap)
- (add-before 'configure 'install-source install-source)
(replace 'configure configure)
(replace 'build build)
(replace 'check check)
--
2.21.0
[-- Attachment #5: 0004-doc-Update-cargo-build-system-parameter-docs.patch --]
[-- Type: application/octet-stream, Size: 2052 bytes --]
From e79254d9ca054dcc5c03d5e54a5206e0793ab3e7 Mon Sep 17 00:00:00 2001
From: Ivan Petkov <ivanppetkov@gmail.com>
Date: Fri, 17 May 2019 09:07:54 -0700
Subject: [PATCH 4/8] doc: Update cargo-build-system parameter docs
* doc/guix.texi: (Build Systems)[cargo-build-system]: Add references to
the #:rust, #:cargo-deps, and #:cargo-dev-deps parameters.
Remove reference to installing crate sources.
---
doc/guix.texi | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index ae9ad0739e..8683a5f4ed 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -5780,10 +5780,20 @@ This variable is exported by @code{(guix build-system cargo)}. It
supports builds of packages using Cargo, the build tool of the
@uref{https://www.rust-lang.org, Rust programming language}.
-In its @code{configure} phase, this build system replaces dependencies
-specified in the @file{Cargo.toml} file with inputs to the Guix package.
-The @code{install} phase installs the binaries, and it also installs the
-source code and @file{Cargo.toml} file.
+It adds @code{rustc} and @code{cargo} to the set of inputs.
+A different Rust package can be specified with the @code{#:rust} parameter.
+
+Regular cargo dependencies should be added to the package definition via
+the @code{#:cargo-deps} parameter as a list of name and spec pairs, where the
+spec can be a package or a source definition. Note that the spec must evaluate
+to a path to a gzipped tarball with the @code{.crate} extension, or it will be
+ignored. Similarly, cargo dev-dependencies should be added to the package
+definition via the @code{#:cargo-dev-deps} parameter.
+
+In its @code{configure} phase, this build system will make any source inputs
+specified in the @code{#:cargo-deps} and @code{#:cargo-dev-deps} parameters
+available to cargo. The @code{install} phase installs any crate the binaries
+if they are defined by the crate.
@end defvr
@cindex Clojure (programming language)
--
2.21.0
[-- Attachment #6: 0005-import-crate-import-sources-with-.crate-extension.patch --]
[-- Type: application/octet-stream, Size: 1152 bytes --]
From d802ae3164c6724fd831b847c468046bc32d332d Mon Sep 17 00:00:00 2001
From: Ivan Petkov <ivanppetkov@gmail.com>
Date: Fri, 17 May 2019 00:25:06 -0700
Subject: [PATCH 5/8] import: crate: import sources with .crate extension
* guix/import/crate.scm: (make-crate-sexp)[file-name]: Use .crate extension.
---
guix/import/crate.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index e0b400d054..24d3a7d961 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -94,7 +94,7 @@ VERSION, INPUTS, NATIVE-INPUTS, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE."
(source (origin
(method url-fetch)
(uri (crate-uri ,name version))
- (file-name (string-append name "-" version ".tar.gz"))
+ (file-name (string-append name "-" version ".crate"))
(sha256
(base32
,(bytevector->nix-base32-string (port-sha256 port))))))
--
2.21.0
[-- Attachment #7: 0006-import-crate-define-dependencies-as-arguments.patch --]
[-- Type: application/octet-stream, Size: 5464 bytes --]
From c81535f09c78c8008f285ab05b127a7e68b6f00b Mon Sep 17 00:00:00 2001
From: Ivan Petkov <ivanppetkov@gmail.com>
Date: Fri, 17 May 2019 00:26:07 -0700
Subject: [PATCH 6/8] import: crate: define dependencies as arguments
* guix/import/crate.scm:
(crate-fetch)[input-crates]: Rename to dev-crates.
[native-input-crates]: Rename to dev-dep-crates.
[inputs]: Rename to cargo-deps.
[native-inputs]: Rename to cargo-dev-deps.
(maybe-cargo-deps): Add it.
(maybe-cargo-dev-deps): Add it.
(maybe-arguments): Add it.
(make-crate-sexp): Use new procedures.
[inputs]: Rename to cargo-deps.
[native-inputs]: Rename to cargo-dev-deps.
* guix/import/utils.scm: (package-names->package-inputs): Make public.
Add doc string.
---
guix/import/crate.scm | 43 ++++++++++++++++++++++++++++++++-----------
guix/import/utils.scm | 4 ++++
2 files changed, 36 insertions(+), 11 deletions(-)
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 24d3a7d961..0ed683298b 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -65,29 +65,50 @@
(path (string-append "/" version "/dependencies"))
(deps-json (json-fetch-alist (string-append crate-url name path)))
(deps (assoc-ref deps-json "dependencies"))
- (input-crates (filter (crate-kind-predicate "normal") deps))
- (native-input-crates
+ (dep-crates (filter (crate-kind-predicate "normal") deps))
+ (dev-dep-crates
(filter (lambda (dep)
(not ((crate-kind-predicate "normal") dep))) deps))
- (inputs (crates->inputs input-crates))
- (native-inputs (crates->inputs native-input-crates))
+ (cargo-deps (crates->inputs dep-crates))
+ (cargo-dev-deps (crates->inputs dev-dep-crates))
(home-page (match homepage
(() repository)
(_ homepage))))
(callback #:name name #:version version
- #:inputs inputs #:native-inputs native-inputs
+ #:cargo-deps cargo-deps #:cargo-dev-deps cargo-dev-deps
#:home-page home-page #:synopsis synopsis
#:description description #:license license)))
-(define* (make-crate-sexp #:key name version inputs native-inputs
+(define (maybe-cargo-deps package-names)
+ (match (package-names->package-inputs package-names)
+ (()
+ '())
+ ((package-inputs ...)
+ `((#:cargo-deps ,package-inputs)))))
+
+(define (maybe-cargo-dev-deps package-names)
+ (match (package-names->package-inputs package-names)
+ (()
+ '())
+ ((package-inputs ...)
+ `((#:cargo-dev-deps ,package-inputs)))))
+
+(define (maybe-arguments arguments)
+ (match arguments
+ (()
+ '())
+ ((args ...)
+ `((arguments (,'quasiquote ,args))))))
+
+(define* (make-crate-sexp #:key name version cargo-deps cargo-dev-deps
home-page synopsis description license
#:allow-other-keys)
"Return the `package' s-expression for a rust package with the given NAME,
-VERSION, INPUTS, NATIVE-INPUTS, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE."
+VERSION, CARGO-DEPS, CARGO-DEV-DEPS, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE."
(let* ((port (http-fetch (crate-uri name version)))
(guix-name (crate-name->package-name name))
- (inputs (map crate-name->package-name inputs))
- (native-inputs (map crate-name->package-name native-inputs))
+ (cargo-deps (map crate-name->package-name cargo-deps))
+ (cargo-dev-deps (map crate-name->package-name cargo-dev-deps))
(pkg `(package
(name ,guix-name)
(version ,version)
@@ -99,8 +120,8 @@ VERSION, INPUTS, NATIVE-INPUTS, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE."
(base32
,(bytevector->nix-base32-string (port-sha256 port))))))
(build-system cargo-build-system)
- ,@(maybe-native-inputs native-inputs "src")
- ,@(maybe-inputs inputs "src")
+ ,@(maybe-arguments (append (maybe-cargo-deps cargo-deps)
+ (maybe-cargo-dev-deps cargo-dev-deps)))
(home-page ,(match home-page
(() "")
(_ home-page)))
diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 516c0cfaa2..33cb9bbc36 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -51,6 +51,7 @@
url-fetch
guix-hash-url
+ package-names->package-inputs
maybe-inputs
maybe-native-inputs
package->definition
@@ -235,6 +236,9 @@ into a proper sentence and by using two spaces between sentences."
cleaned 'pre ". " 'post)))
(define* (package-names->package-inputs names #:optional (output #f))
+ "Given a list of PACKAGE-NAMES, and an optional OUTPUT, tries to generate a
+quoted list of inputs, as suitable to use in an 'inputs' field of a package
+definition."
(map (lambda (input)
(cons* input (list 'unquote (string->symbol input))
(or (and output (list output))
--
2.21.0
[-- Attachment #8: 0007-gnu-crate-add-unicode-xid.patch --]
[-- Type: application/octet-stream, Size: 2956 bytes --]
From 990ec0caa1d8f86750fc183e85e4b7bae9dc5106 Mon Sep 17 00:00:00 2001
From: Ivan Petkov <ivanppetkov@gmail.com>
Date: Tue, 16 Apr 2019 03:40:14 -0700
Subject: [PATCH 7/8] gnu: crate: add unicode-xid
gnu/local.mk: (GNU_SYSTEM_MODULES): Add new file.
gnu/packages/crates-io.scm: (rust-unicode-xid): New variable.
---
gnu/local.mk | 1 +
gnu/packages/crates-io.scm | 45 ++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+)
create mode 100644 gnu/packages/crates-io.scm
diff --git a/gnu/local.mk b/gnu/local.mk
index 694bbfd367..bfa66e0840 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -121,6 +121,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/cpp.scm \
%D%/packages/cppi.scm \
%D%/packages/cran.scm \
+ %D%/packages/crates-io.scm \
%D%/packages/cross-base.scm \
%D%/packages/crypto.scm \
%D%/packages/cryptsetup.scm \
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
new file mode 100644
index 0000000000..1440edef9b
--- /dev/null
+++ b/gnu/packages/crates-io.scm
@@ -0,0 +1,45 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages crates-io)
+ #:use-module (guix build-system cargo)
+ #:use-module (guix download)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix packages))
+
+(define-public rust-unicode-xid
+ (package
+ (name "rust-unicode-xid")
+ (version "0.1.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (crate-uri "unicode-xid" version))
+ (file-name
+ (string-append name "-" version ".crate"))
+ (sha256
+ (base32
+ "1z57lqh4s18rr4x0j4fw4fmp9hf9346h0kmdgqsqx0fhjr3k0wpw"))))
+ (build-system cargo-build-system)
+ (home-page
+ "https://github.com/unicode-rs/unicode-xid")
+ (synopsis "Determine Unicode XID related properties")
+ (description "Determine whether characters have the XID_Start
+or XID_Continue properties according to Unicode Standard Annex #31.")
+ ;; Dual licensed.
+ (license (list license:asl2.0 license:expat))))
--
2.21.0
[-- Attachment #9: 0008-gnu-crate-Add-proc-macro2-and-quote.patch --]
[-- Type: application/octet-stream, Size: 2546 bytes --]
From cc4008769de81015749e2af46612540dca05cea7 Mon Sep 17 00:00:00 2001
From: Ivan Petkov <ivanppetkov@gmail.com>
Date: Tue, 16 Apr 2019 03:42:27 -0700
Subject: [PATCH 8/8] gnu: crate: Add proc-macro2 and quote
* gnu/packages/crates-io.scm: (rust-proc-macro2): New variable.
(rust-quote): New variable.
---
gnu/packages/crates-io.scm | 47 ++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 1440edef9b..a10128413a 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -43,3 +43,50 @@
or XID_Continue properties according to Unicode Standard Annex #31.")
;; Dual licensed.
(license (list license:asl2.0 license:expat))))
+
+(define-public rust-proc-macro2
+ (package
+ (name "rust-proc-macro2")
+ (version "0.4.27")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (crate-uri "proc-macro2" version))
+ (file-name
+ (string-append name "-" version ".crate"))
+ (sha256
+ (base32
+ "05c92v787snyaq4ss16vxc9mdv6zndfgsdq8k3hnnyffmsf7ycad"))))
+ (build-system cargo-build-system)
+ (arguments
+ `(#:cargo-deps (("rust-unicode-xid" ,rust-unicode-xid))
+ #:cargo-dev-deps (("rust-quote" ,rust-quote))))
+ (home-page "https://github.com/alexcrichton/proc-macro2")
+ (synopsis "Stable implementation of the upcoming new `proc_macro` API")
+ (description "This package provides a stable implementation of the upcoming new
+`proc_macro` API. Comes with an option, off by default, to also reimplement itself
+in terms of the upstream unstable API.")
+ ;; Dual licensed.
+ (license (list license:asl2.0 license:expat))))
+
+(define-public rust-quote
+ (package
+ (name "rust-quote")
+ (version "0.6.12")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (crate-uri "quote" version))
+ (file-name
+ (string-append name "-" version ".crate"))
+ (sha256
+ (base32
+ "1nw0klza45hf127kfyrpxsxd5jw2l6h21qxalil3hkr7bnf7kx7s"))))
+ (build-system cargo-build-system)
+ (arguments
+ `(#:cargo-deps (("rust-proc-macro2" ,rust-proc-macro2))))
+ (home-page "https://github.com/dtolnay/quote")
+ (synopsis "Quasi-quoting macro quote!(...)")
+ (description "Quasi-quoting macro quote!(...)")
+ ;; Dual licensed.
+ (license (list license:asl2.0 license:expat))))
--
2.21.0
next prev parent reply other threads:[~2019-05-20 1:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-19 5:34 [bug#35318] [PATCH] Update cargo-build-system to expand package inputs Ivan Petkov
2019-05-04 16:40 ` Ivan Petkov
2019-05-04 18:31 ` Danny Milosavljevic
2019-05-04 21:09 ` Ivan Petkov
2019-05-06 8:00 ` Ludovic Courtès
2019-05-06 16:04 ` Ivan Petkov
2019-05-09 23:17 ` Ivan Petkov
2019-05-15 6:08 ` Ivan Petkov
2019-05-15 12:44 ` Ludovic Courtès
2019-05-20 1:00 ` Ivan Petkov [this message]
2019-05-20 19:38 ` Ludovic Courtès
2019-05-22 2:48 ` Ivan Petkov
2019-06-08 18:44 ` Chris Marusich
2019-06-08 23:33 ` Ivan Petkov
2019-06-09 23:53 ` Ivan Petkov
2019-06-12 1:14 ` bug#35318: " Chris Marusich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6A0A0108-A722-4D73-85B7-E61AB8230026@gmail.com \
--to=ivanppetkov@gmail.com \
--cc=35318@debbugs.gnu.org \
--cc=cmmarusich@gmail.com \
--cc=ludo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).