From 1407ebeaa1b0bb88caf1aa44d192600399d67ab3 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Thu, 1 Aug 2019 07:34:17 +0900 Subject: doc: Document the use of `program-file' for mcron jobs. * doc/guix.texi (Scheduled Job Execution): Explain why using `program-file' for an mcron job can be necessary. Add an example. --- doc/guix.texi | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 043851e418..8f2608d5af 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -12442,6 +12442,40 @@ gexps to introduce job definitions that are passed to mcron %base-services))) @end lisp +For more complex jobs defined in Scheme where you need control over the top +level, for instance to introduce a @code{use-modules} form that defines syntax +(macros), you can move your code to a separate program using the +@code{program-file} procedure of the @code{(guix gexp)} module +(@pxref{G-Expressions}). The example below illustrates that. + +@lisp +(define %battery-alert-job + ;; Beep when the battery percentage falls below %MIN-LEVEL. + #~(job + '(next-minute (range 0 60 1)) + #$(program-file + "battery-alert.scm" + (with-imported-modules (source-module-closure + '((guix build utils))) + #~(begin + (define %min-level 20) + (use-modules (guix build utils) + (ice-9 popen) + (ice-9 regex) + (ice-9 textual-ports) + (srfi srfi-2)) + (setenv "LC_ALL" "C") ;ensure English output + (and-let* ((input-pipe (open-pipe* + OPEN_READ + #$(file-append acpi "/bin/acpi"))) + (output (get-string-all input-pipe)) + (m (string-match "Discharging, ([0-9]+)%" output)) + (level (string->number (match:substring m 1))) + ((< level %min-level))) + (format #t "warning: Battery level is low (~a%)~%" level) + (invoke #$(file-append beep "/bin/beep") "-r5"))))))) +@end lisp + @xref{Guile Syntax, mcron job specifications,, mcron, GNU@tie{}mcron}, for more information on mcron job specifications. Below is the reference of the mcron service. -- cgit v1.2.3 From 5aa4278319a914c69a6a0f61c1b09b7db8573e57 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 26 Aug 2019 22:50:16 +0200 Subject: doc: Fix typo. * doc/guix.texi (Build Systems): Add missing question mark to --- doc/guix.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 8f2608d5af..c1e451fbec 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -6112,7 +6112,7 @@ interpreter version. By default guix calls @code{setup.py} under control of @code{setuptools}, much like @command{pip} does. Some packages are not compatible with setuptools (and pip), thus you can disable this by -setting the @code{#:use-setuptools} parameter to @code{#f}. +setting the @code{#:use-setuptools?} parameter to @code{#f}. @end defvr @defvr {Scheme Variable} perl-build-system -- cgit v1.2.3 From 4183105de08a2403915536a97d06ca0c119487bc Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Tue, 27 Aug 2019 19:36:05 +0900 Subject: doc: Follow-up commit to 407ebeaa1. Following some discussion with Ludovic (see: https://lists.gnu.org/archive/html/guix-patches/2019-08/msg00506.html), it is better advice to generally recommend the use of `program-file' for any usage of modules, not just for those which define syntax. * doc/guix.texi (Scheduled Job Execution): Drop the following text: "that defines syntax (macros)". --- doc/guix.texi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index c1e451fbec..6499b39ebf 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -12443,10 +12443,10 @@ gexps to introduce job definitions that are passed to mcron @end lisp For more complex jobs defined in Scheme where you need control over the top -level, for instance to introduce a @code{use-modules} form that defines syntax -(macros), you can move your code to a separate program using the -@code{program-file} procedure of the @code{(guix gexp)} module -(@pxref{G-Expressions}). The example below illustrates that. +level, for instance to introduce a @code{use-modules} form, you can move your +code to a separate program using the @code{program-file} procedure of the +@code{(guix gexp)} module (@pxref{G-Expressions}). The example below +illustrates that. @lisp (define %battery-alert-job -- cgit v1.2.3 From f9c1ebdb7daea30ceaf73f43bf15c222dc4a58ad Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Tue, 27 Aug 2019 08:48:27 +0200 Subject: services: cups: Complete SSL-OPTIONS. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …except for ‘AllowDH’, which makes no sense on GNU TLS systems. * gnu/services/cups.scm (ssl-options?): Validate ‘DenyCBC’ and ‘DenyTLS1.0’. * doc/guix.texi (Printing Services): Document them both. --- doc/guix.texi | 15 +++++++++------ gnu/services/cups.scm | 6 +++++- 2 files changed, 14 insertions(+), 7 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 6499b39ebf..90b2deb251 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -49,7 +49,7 @@ Copyright @copyright{} 2017 Christopher Allan Webber@* Copyright @copyright{} 2017, 2018 Marius Bakke@* Copyright @copyright{} 2017 Hartmut Goebel@* Copyright @copyright{} 2017 Maxim Cournoyer@* -Copyright @copyright{} 2017, 2018 Tobias Geerinckx-Rice@* +Copyright @copyright{} 2017, 2018, 2019 Tobias Geerinckx-Rice@* Copyright @copyright{} 2017 George Clemmer@* Copyright @copyright{} 2017 Andy Wingo@* Copyright @copyright{} 2017, 2018, 2019 Arun Isaac@* @@ -14757,11 +14757,14 @@ Defaults to @samp{()}. @deftypevr {@code{cups-configuration} parameter} ssl-options ssl-options Sets encryption options. By default, CUPS only supports encryption -using TLS v1.0 or higher using known secure cipher suites. The -@code{AllowRC4} option enables the 128-bit RC4 cipher suites, which are -required for some older clients that do not implement newer ones. The -@code{AllowSSL3} option enables SSL v3.0, which is required for some -older clients that do not support TLS v1.0. +using TLS v1.0 or higher using known secure cipher suites. Security is +reduced when @code{Allow} options are used, and enhanced when @code{Deny} +options are used. The @code{AllowRC4} option enables the 128-bit RC4 cipher +suites, which are required for some older clients. The @code{AllowSSL3} option +enables SSL v3.0, which is required for some older clients that do not support +TLS v1.0. The @code{DenyCBC} option disables all CBC cipher suites. The +@code{DenyTLS1.0} option disables TLS v1.0 support - this sets the minimum +protocol version to TLS v1.1. Defaults to @samp{()}. @end deftypevr diff --git a/gnu/services/cups.scm b/gnu/services/cups.scm index 9d21b6e70c..c20244cb32 100644 --- a/gnu/services/cups.scm +++ b/gnu/services/cups.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2017 Clément Lassieur ;;; Copyright © 2018 Ricardo Wurmus ;;; Copyright © 2019 Alex Griffin +;;; Copyright © 2019 Tobias Geerinckx-Rice ;;; ;;; This file is part of GNU Guix. ;;; @@ -170,7 +171,10 @@ (define (serialize-boolean-or-non-negative-integer field-name x) (define (ssl-options? x) (and (list? x) - (and-map (lambda (elt) (memq elt '(AllowRC4 AllowSSL3))) x))) + (and-map (lambda (elt) (memq elt '(AllowRC4 + AllowSSL3 + DenyCBC + DenyTLS1.0))) x))) (define (serialize-ssl-options field-name val) (serialize-field field-name (match val -- cgit v1.2.3 From 3762e31b6c8089928aad3186f70f157502950e3b Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Thu, 22 Aug 2019 16:21:26 +0300 Subject: build/cargo-build-system: Remove 'update-cargo-lock phase. * guix/build/cargo-build-system.scm (update-cargo-lock): Remove procedure. (configure): Delete Cargo.lock file if it exists. (%standard-phases): Remove 'update-cargo-lock. * doc/guix.texi (Build System)[cargo-build-system]: Remove references to the 'update-cargo-lock phase. --- doc/guix.texi | 9 ++++----- guix/build/cargo-build-system.scm | 19 ++++--------------- 2 files changed, 8 insertions(+), 20 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 90b2deb251..707c2ba700 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -5854,11 +5854,10 @@ should be added to the package definition via the In its @code{configure} phase, this build system will make any source inputs specified in the @code{#:cargo-inputs} and @code{#:cargo-development-inputs} -parameters available to cargo. The @code{update-cargo-lock} phase will, -when there is a @code{Cargo.lock} file, update the @code{Cargo.lock} file -with the inputs and their versions available at build time. The -@code{install} phase installs any crate the binaries if they are defined by -the crate. +parameters available to cargo. It will also remove an included +@code{Cargo.lock} file to be recreated by @code{cargo} during the +@code{build} phase. The @code{install} phase installs any crate the binaries +if they are defined by the crate. @end defvr @cindex Clojure (programming language) diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index 7d363a18a5..06ed14b89f 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -134,22 +134,12 @@ (define* (configure #:key inputs ;; upgrading the compiler for example. (setenv "RUSTFLAGS" "--cap-lints allow") (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc")) - #t) -;; The Cargo.lock file tells the build system which crates are required for -;; building and hardcodes their version and checksum. In order to build with -;; the inputs we provide, we need to recreate the file with our inputs. -(define* (update-cargo-lock #:key - (vendor-dir "guix-vendor") - #:allow-other-keys) - "Regenerate the Cargo.lock file with the current build inputs." + ;; We don't use the Cargo.lock file to determine the package versions we use + ;; during building, and in any case if one is not present it is created + ;; during the 'build phase by cargo. (when (file-exists? "Cargo.lock") - (begin - ;; Unfortunately we can't generate a Cargo.lock file until the checksums - ;; are generated, so we have an extra round of generate-all-checksums here. - (generate-all-checksums vendor-dir) - (delete-file "Cargo.lock") - (invoke "cargo" "generate-lockfile"))) + (delete-file "Cargo.lock")) #t) ;; After the 'patch-generated-file-shebangs phase any vendored crates who have @@ -203,7 +193,6 @@ (define %standard-phases (replace 'build build) (replace 'check check) (replace 'install install) - (add-after 'configure 'update-cargo-lock update-cargo-lock) (add-after 'patch-generated-file-shebangs 'patch-cargo-checksums patch-cargo-checksums))) (define* (cargo-build #:key inputs (phases %standard-phases) -- cgit v1.2.3 From 3e7a62e2e40fc575d161e4c06ea2e333ab7df3b3 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Thu, 29 Aug 2019 08:04:21 +0200 Subject: services: cuirass: Log web interface to separate file. * gnu/services/cuirass.scm (): Add web-log-file field. (cuirass-shepherd-service): Read it and use it. * doc/guix.texi (Continuous Integration): Document it. --- doc/guix.texi | 3 +++ gnu/services/cuirass.scm | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 707c2ba700..5a64b89086 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -21387,6 +21387,9 @@ Data type representing the configuration of Cuirass. @item @code{log-file} (default: @code{"/var/log/cuirass.log"}) Location of the log file. +@item @code{web-log-file} (default: @code{"/var/log/cuirass-web.log"}) +Location of the log file used by the web interface. + @item @code{cache-directory} (default: @code{"/var/cache/cuirass"}) Location of the repository cache. diff --git a/gnu/services/cuirass.scm b/gnu/services/cuirass.scm index 138a5cf67c..7bd43cd427 100644 --- a/gnu/services/cuirass.scm +++ b/gnu/services/cuirass.scm @@ -3,7 +3,7 @@ ;;; Copyright © 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2017 Jan Nieuwenhuizen -;;; Copyright © 2018 Ricardo Wurmus +;;; Copyright © 2018, 2019 Ricardo Wurmus ;;; Copyright © 2018 Clément Lassieur ;;; ;;; This file is part of GNU Guix. @@ -52,6 +52,8 @@ (define-record-type* (default cuirass)) (log-file cuirass-configuration-log-file ;string (default "/var/log/cuirass.log")) + (web-log-file cuirass-configuration-web-log-file ;string + (default "/var/log/cuirass-web.log")) (cache-directory cuirass-configuration-cache-directory ;string (dir-name) (default "/var/cache/cuirass")) (ttl cuirass-configuration-ttl ;integer @@ -83,6 +85,7 @@ (define (cuirass-shepherd-service config) (cuirass-configuration? config) (let ((cuirass (cuirass-configuration-cuirass config)) (cache-directory (cuirass-configuration-cache-directory config)) + (web-log-file (cuirass-configuration-web-log-file config)) (log-file (cuirass-configuration-log-file config)) (user (cuirass-configuration-user config)) (group (cuirass-configuration-group config)) @@ -140,7 +143,7 @@ (define (cuirass-shepherd-service config) #:user #$user #:group #$group - #:log-file #$log-file)) + #:log-file #$web-log-file)) (stop #~(make-kill-destructor))))))) (define (cuirass-account config) -- cgit v1.2.3 From ad553ec4b12f24a0bbd25b547bac885ddb84776a Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Wed, 28 Aug 2019 00:38:31 +0200 Subject: import: cran: Add support for git repositories. * guix/import/cran.scm (vcs-file?): New procedure. (download): Support downloading from git. (fetch-description): Add a clause for the 'git repository type. (files-match-pattern?): New procedure. (tarball-files-match-pattern?): Implement in terms of FILES-MATCH-PATTERN?. (directory-needs-fortran?, directory-needs-zlib?, directory-needs-pkg-config?): New procedures. (needs-fortran?, needs-zlib?, needs-pkg-config?): Rename these procedures... (tarball-needs-fortran?, tarball-needs-zlib?, tarball-needs-pkg-config?): ...to this, and use them. (file-hash): New procedure. (description->package): Handle the 'git repository type. * guix/import/utils.scm (package->definition): Handle package expression inside of a let. * guix/scripts/import.scm (guix-import): Handle let expressions. * doc/guix.texi (Invoking guix import): Document it. --- doc/guix.texi | 8 ++ guix/import/cran.scm | 254 ++++++++++++++++++++++++++++++++++-------------- guix/import/utils.scm | 5 +- guix/scripts/import.scm | 4 +- 4 files changed, 198 insertions(+), 73 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 5a64b89086..a87a8a3d9a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -8638,6 +8638,14 @@ R package: guix import cran --archive=bioconductor GenomicRanges @end example +Finally, you can also import R packages that have not yet been published on +CRAN or Bioconductor as long as they are in a git repository. Use +@code{--archive=git} followed by the URL of the git repository: + +@example +guix import cran --archive=git https://github.com/immunogenomics/harmony +@end example + @item texlive @cindex TeX Live @cindex CTAN diff --git a/guix/import/cran.scm b/guix/import/cran.scm index 9c964701b1..51c7ea7b2f 100644 --- a/guix/import/cran.scm +++ b/guix/import/cran.scm @@ -24,6 +24,7 @@ (define-module (guix import cran) #:use-module ((ice-9 rdelim) #:select (read-string read-line)) #:use-module (srfi srfi-1) #:use-module (srfi srfi-2) + #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (ice-9 receive) @@ -32,11 +33,13 @@ (define-module (guix import cran) #:use-module (guix http-client) #:use-module (gcrypt hash) #:use-module (guix store) + #:use-module ((guix serialization) #:select (write-file)) #:use-module (guix base32) #:use-module ((guix download) #:select (download-to-store)) #:use-module (guix import utils) #:use-module ((guix build utils) #:select (find-files)) #:use-module (guix utils) + #:use-module (guix git) #:use-module ((guix build-system r) #:select (cran-uri bioconductor-uri)) #:use-module (guix upstream) #:use-module (guix packages) @@ -166,11 +169,25 @@ (define* (latest-bioconductor-package-version name #:optional type) (bioconductor-packages-list type)) (cut assoc-ref <> "Version"))) +;; XXX taken from (guix scripts hash) +(define (vcs-file? file stat) + (case (stat:type stat) + ((directory) + (member (basename file) '(".bzr" ".git" ".hg" ".svn" "CVS"))) + ((regular) + ;; Git sub-modules have a '.git' file that is a regular text file. + (string=? (basename file) ".git")) + (else + #f))) + ;; Little helper to download URLs only once. (define download (memoize - (lambda (url) - (with-store store (download-to-store store url))))) + (lambda* (url #:optional git) + (with-store store + (if git + (latest-repository-commit store url) + (download-to-store store url)))))) (define (fetch-description repository name) "Return an alist of the contents of the DESCRIPTION file for the R package @@ -211,7 +228,18 @@ (define (fetch-description repository name) (string-append dir "/DESCRIPTION") read-string)) (lambda (meta) (if (boolean? type) meta - (cons `(bioconductor-type . ,type) meta)))))))))))) + (cons `(bioconductor-type . ,type) meta)))))))))) + ((git) + ;; Download the git repository at "NAME" + (call-with-values + (lambda () (download name #t)) + (lambda (dir commit) + (and=> (description->alist (with-input-from-file + (string-append dir "/DESCRIPTION") read-string)) + (lambda (meta) + (cons* `(git . ,name) + `(git-commit . ,commit) + meta)))))))) (define (listify meta field) "Look up FIELD in the alist META. If FIELD contains a comma-separated @@ -256,7 +284,7 @@ (define invalid-packages (define cran-guix-name (cut guix-name "r-" <>)) -(define (needs-fortran? tarball) +(define (tarball-needs-fortran? tarball) "Check if the TARBALL contains Fortran source files." (define (check pattern) (parameterize ((current-error-port (%make-void-port "rw+")) @@ -266,69 +294,127 @@ (define (check pattern) (check "*.f95") (check "*.f"))) +(define (directory-needs-fortran? dir) + "Check if the directory DIR contains Fortran source files." + (match (find-files dir "\\.f(90|95)?") + (() #f) + (_ #t))) + +(define (needs-fortran? thing tarball?) + "Check if the THING contains Fortran source files." + (if tarball? + (tarball-needs-fortran? thing) + (directory-needs-fortran? thing))) + +(define (files-match-pattern? directory regexp . file-patterns) + "Return #T if any of the files matching FILE-PATTERNS in the DIRECTORY match +the given REGEXP." + (let ((pattern (make-regexp regexp))) + (any (lambda (file) + (call-with-input-file file + (lambda (port) + (let loop () + (let ((line (read-line port))) + (cond + ((eof-object? line) #f) + ((regexp-exec pattern line) #t) + (else (loop)))))))) + (apply find-files directory file-patterns)))) + (define (tarball-files-match-pattern? tarball regexp . file-patterns) "Return #T if any of the files represented by FILE-PATTERNS in the TARBALL match the given REGEXP." (call-with-temporary-directory (lambda (dir) - (let ((pattern (make-regexp regexp))) - (parameterize ((current-error-port (%make-void-port "rw+"))) - (apply system* "tar" - "xf" tarball "-C" dir - `("--wildcards" ,@file-patterns))) - (any (lambda (file) - (call-with-input-file file - (lambda (port) - (let loop () - (let ((line (read-line port))) - (cond - ((eof-object? line) #f) - ((regexp-exec pattern line) #t) - (else (loop)))))))) - (find-files dir)))))) - -(define (needs-zlib? tarball) + (parameterize ((current-error-port (%make-void-port "rw+"))) + (apply system* "tar" + "xf" tarball "-C" dir + `("--wildcards" ,@file-patterns))) + (files-match-pattern? dir regexp)))) + +(define (directory-needs-zlib? dir) + "Return #T if any of the Makevars files in the src directory DIR contain a +zlib linker flag." + (files-match-pattern? dir "-lz" "(Makevars.*|configure.*)")) + +(define (tarball-needs-zlib? tarball) "Return #T if any of the Makevars files in the src directory of the TARBALL contain a zlib linker flag." (tarball-files-match-pattern? tarball "-lz" "*/src/Makevars*" "*/src/configure*" "*/configure*")) -(define (needs-pkg-config? tarball) +(define (needs-zlib? thing tarball?) + "Check if the THING contains files indicating a dependency on zlib." + (if tarball? + (tarball-needs-zlib? thing) + (directory-needs-zlib? thing))) + +(define (directory-needs-pkg-config? dir) + "Return #T if any of the Makevars files in the src directory DIR reference +the pkg-config tool." + (files-match-pattern? dir "pkg-config" + "(Makevars.*|configure.*)")) + +(define (tarball-needs-pkg-config? tarball) "Return #T if any of the Makevars files in the src directory of the TARBALL reference the pkg-config tool." (tarball-files-match-pattern? tarball "pkg-config" "*/src/Makevars*" "*/src/configure*" "*/configure*")) +(define (needs-pkg-config? thing tarball?) + "Check if the THING contains files indicating a dependency on pkg-config." + (if tarball? + (tarball-needs-pkg-config? thing) + (directory-needs-pkg-config? thing))) + +;; XXX adapted from (guix scripts hash) +(define (file-hash file select? recursive?) + ;; Compute the hash of FILE. + (if recursive? + (let-values (((port get-hash) (open-sha256-port))) + (write-file file port #:select? select?) + (force-output port) + (get-hash)) + (call-with-input-file file port-sha256))) + (define (description->package repository meta) "Return the `package' s-expression for an R package published on REPOSITORY from the alist META, which was derived from the R package's DESCRIPTION file." (let* ((base-url (case repository ((cran) %cran-url) - ((bioconductor) %bioconductor-url))) + ((bioconductor) %bioconductor-url) + ((git) #f))) (uri-helper (case repository ((cran) cran-uri) - ((bioconductor) bioconductor-uri))) + ((bioconductor) bioconductor-uri) + ((git) #f))) (name (assoc-ref meta "Package")) (synopsis (assoc-ref meta "Title")) (version (assoc-ref meta "Version")) (license (string->license (assoc-ref meta "License"))) ;; Some packages have multiple home pages. Some have none. - (home-page (match (listify meta "URL") - ((url rest ...) url) - (_ (string-append base-url name)))) - (source-url (match (apply uri-helper name version - (case repository - ((bioconductor) - (list (assoc-ref meta 'bioconductor-type))) - (else '()))) - ((url rest ...) url) - ((? string? url) url) - (_ #f))) - (tarball (download source-url)) + (home-page (case repository + ((git) (assoc-ref meta 'git)) + (else (match (listify meta "URL") + ((url rest ...) url) + (_ (string-append base-url name)))))) + (source-url (case repository + ((git) (assoc-ref meta 'git)) + (else + (match (apply uri-helper name version + (case repository + ((bioconductor) + (list (assoc-ref meta 'bioconductor-type))) + (else '()))) + ((url rest ...) url) + ((? string? url) url) + (_ #f))))) + (git? (assoc-ref meta 'git)) + (source (download source-url git?)) (sysdepends (append - (if (needs-zlib? tarball) '("zlib") '()) + (if (needs-zlib? source (not git?)) '("zlib") '()) (filter (lambda (name) (not (member name invalid-packages))) (map string-downcase (listify meta "SystemRequirements"))))) @@ -339,41 +425,67 @@ (define (description->package repository meta) (listify meta "Imports") (listify meta "LinkingTo") (delete "R" - (listify meta "Depends")))))) + (listify meta "Depends"))))) + (package + `(package + (name ,(cran-guix-name name)) + (version ,(case repository + ((git) + `(git-version ,version revision commit)) + (else version))) + (source (origin + (method ,(if git? + 'git-fetch + 'url-fetch)) + (uri ,(case repository + ((git) + `(git-reference + (url ,(assoc-ref meta 'git)) + (commit commit))) + (else + `(,(procedure-name uri-helper) ,name version + ,@(or (and=> (assoc-ref meta 'bioconductor-type) + (lambda (type) + (list (list 'quote type)))) + '()))))) + ,@(if git? + '((file-name (git-file-name name version))) + '()) + (sha256 + (base32 + ,(bytevector->nix-base32-string + (case repository + ((git) + (file-hash source (negate vcs-file?) #t)) + (else (file-sha256 source)))))))) + ,@(if (not (and git? + (equal? (string-append "r-" name) + (cran-guix-name name)))) + `((properties ,`(,'quasiquote ((,'upstream-name . ,name))))) + '()) + (build-system r-build-system) + ,@(maybe-inputs sysdepends) + ,@(maybe-inputs (map cran-guix-name propagate) 'propagated-inputs) + ,@(maybe-inputs + `(,@(if (needs-fortran? source (not git?)) + '("gfortran") '()) + ,@(if (needs-pkg-config? source (not git?)) + '("pkg-config") '())) + 'native-inputs) + (home-page ,(if (string-null? home-page) + (string-append base-url name) + home-page)) + (synopsis ,synopsis) + (description ,(beautify-description (or (assoc-ref meta "Description") + ""))) + (license ,license)))) (values - `(package - (name ,(cran-guix-name name)) - (version ,version) - (source (origin - (method url-fetch) - (uri (,(procedure-name uri-helper) ,name version - ,@(or (and=> (assoc-ref meta 'bioconductor-type) - (lambda (type) - (list (list 'quote type)))) - '()))) - (sha256 - (base32 - ,(bytevector->nix-base32-string (file-sha256 tarball)))))) - ,@(if (not (equal? (string-append "r-" name) - (cran-guix-name name))) - `((properties ,`(,'quasiquote ((,'upstream-name . ,name))))) - '()) - (build-system r-build-system) - ,@(maybe-inputs sysdepends) - ,@(maybe-inputs (map cran-guix-name propagate) 'propagated-inputs) - ,@(maybe-inputs - `(,@(if (needs-fortran? tarball) - '("gfortran") '()) - ,@(if (needs-pkg-config? tarball) - '("pkg-config") '())) - 'native-inputs) - (home-page ,(if (string-null? home-page) - (string-append base-url name) - home-page)) - (synopsis ,synopsis) - (description ,(beautify-description (or (assoc-ref meta "Description") - ""))) - (license ,license)) + (case repository + ((git) + `(let ((commit ,(assoc-ref meta 'git-commit)) + (revision "1")) + ,package)) + (else package)) propagate))) (define cran->guix-package diff --git a/guix/import/utils.scm b/guix/import/utils.scm index 2a3b7341fb..252875eeab 100644 --- a/guix/import/utils.scm +++ b/guix/import/utils.scm @@ -2,7 +2,7 @@ ;;; Copyright © 2012, 2013, 2018, 2019 Ludovic Courtès ;;; Copyright © 2016 Jelle Licht ;;; Copyright © 2016 David Craven -;;; Copyright © 2017 Ricardo Wurmus +;;; Copyright © 2017, 2019 Ricardo Wurmus ;;; Copyright © 2018 Oleg Pykhalov ;;; Copyright © 2019 Robert Vollmert ;;; @@ -251,6 +251,9 @@ (define* (maybe-native-inputs package-names #:optional (output #f)) (define (package->definition guix-package) (match guix-package (('package ('name (? string? name)) _ ...) + `(define-public ,(string->symbol name) + ,guix-package)) + (('let anything ('package ('name (? string? name)) _ ...)) `(define-public ,(string->symbol name) ,guix-package)))) diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index 0b326e1049..c6cc93fad8 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès ;;; Copyright © 2014 David Thompson ;;; Copyright © 2018 Kyle Meyer +;;; Copyright © 2019 Ricardo Wurmus ;;; ;;; This file is part of GNU Guix. ;;; @@ -113,7 +114,8 @@ (define (guix-import . args) (pretty-print expr (newline-rewriting-port (current-output-port)))))) (match (apply (resolve-importer importer) args) - ((and expr ('package _ ...)) + ((and expr (or ('package _ ...) + ('let _ ...))) (print expr)) ((? list? expressions) (for-each (lambda (expr) -- cgit v1.2.3 From f9a1f15efc8ebcae0502f51fbd40f074290711d9 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Thu, 29 Aug 2019 11:29:44 +0200 Subject: doc: Do not refer to Bioconductor SVN. * doc/guix.texi (Invoking guix import): Do not mention the now defunct Bioconductor SVN repository. --- doc/guix.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index a87a8a3d9a..1998ad049b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -8628,8 +8628,8 @@ When @code{--archive=bioconductor} is added, metadata is imported from packages for for the analysis and comprehension of high-throughput genomic data in bioinformatics. -Information is extracted from the @code{DESCRIPTION} file of a package -published on the web interface of the Bioconductor SVN repository. +Information is extracted from the @code{DESCRIPTION} file contained in the +package archive. The command below imports metadata for the @code{GenomicRanges} R package: -- cgit v1.2.3