packages: <origin> no longer has an 'imported-modules' field.

* guix/packages.scm (<origin>)[imported-modules]: Remove.
(patch-and-repack): Remove #:imported-modules.  Use
'with-imported-modules'.  Remove #:modules argument to
'gexp->derivation'.
(origin->derivation): Adjust accordingly.
* doc/guix.texi (origin Reference): Adjust accordingly.
This commit is contained in:
Ludovic Courtès 2016-07-12 22:23:12 +02:00
parent c1629416d8
commit 1929fdba80
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 93 additions and 101 deletions

View file

@ -2697,8 +2697,9 @@ file name explicitly because the default is not very descriptive.
A list of file names containing patches to be applied to the source. A list of file names containing patches to be applied to the source.
@item @code{snippet} (default: @code{#f}) @item @code{snippet} (default: @code{#f})
A quoted piece of code that will be run in the source directory to make A G-expression (@pxref{G-Expressions}) or S-expression that will be run
any modifications, which is sometimes more convenient than a patch. in the source directory. This is a convenient way to modify the source,
sometimes more convenient than a patch.
@item @code{patch-flags} (default: @code{'("-p1")}) @item @code{patch-flags} (default: @code{'("-p1")})
A list of command-line flags that should be passed to the @code{patch} A list of command-line flags that should be passed to the @code{patch}
@ -2713,10 +2714,6 @@ such as GNU@tie{}Patch.
A list of Guile modules that should be loaded during the patching A list of Guile modules that should be loaded during the patching
process and while running the code in the @code{snippet} field. process and while running the code in the @code{snippet} field.
@item @code{imported-modules} (default: @code{'()})
The list of Guile modules to import in the patch derivation, for use by
the @code{snippet}.
@item @code{patch-guile} (default: @code{#f}) @item @code{patch-guile} (default: @code{#f})
The Guile package that should be used in the patching process. When The Guile package that should be used in the patching process. When
this is @code{#f}, a sensible default is used. this is @code{#f}, a sensible default is used.

View file

@ -56,7 +56,6 @@ (define-module (guix packages)
origin-patch-guile origin-patch-guile
origin-snippet origin-snippet
origin-modules origin-modules
origin-imported-modules
base32 base32
package package
@ -164,8 +163,7 @@ (define-record-type* <origin>
(default #f)) (default #f))
(modules origin-modules ; list of module names (modules origin-modules ; list of module names
(default '())) (default '()))
(imported-modules origin-imported-modules ; list of module names
(default '()))
(patch-guile origin-patch-guile ; package or #f (patch-guile origin-patch-guile ; package or #f
(default #f))) (default #f)))
@ -381,14 +379,13 @@ (define* (patch-and-repack source patches
(snippet #f) (snippet #f)
(flags '("-p1")) (flags '("-p1"))
(modules '()) (modules '())
(imported-modules '())
(guile-for-build (%guile-for-build)) (guile-for-build (%guile-for-build))
(system (%current-system))) (system (%current-system)))
"Unpack SOURCE (a derivation or store path), apply all of PATCHES, and "Unpack SOURCE (a derivation or store path), apply all of PATCHES, and
repack the tarball using the tools listed in INPUTS. When SNIPPET is true, repack the tarball using the tools listed in INPUTS. When SNIPPET is true,
it must be an s-expression that will run from within the directory where it must be an s-expression that will run from within the directory where
SOURCE was unpacked, after all of PATCHES have been applied. MODULES and SOURCE was unpacked, after all of PATCHES have been applied. MODULES
IMPORTED-MODULES specify modules to use/import for use by SNIPPET." specifies modules in scope when evaluating SNIPPET."
(define source-file-name (define source-file-name
;; SOURCE is usually a derivation, but it could be a store file. ;; SOURCE is usually a derivation, but it could be a store file.
(if (derivation? source) (if (derivation? source)
@ -449,6 +446,7 @@ (define instantiate-patch
(patches (sequence %store-monad (patches (sequence %store-monad
(map instantiate-patch patches)))) (map instantiate-patch patches))))
(define build (define build
(with-imported-modules '((guix build utils))
#~(begin #~(begin
(use-modules (ice-9 ftw) (use-modules (ice-9 ftw)
(srfi srfi-1) (srfi srfi-1)
@ -512,9 +510,9 @@ (define (first-file directory)
(and (every apply-patch '#+patches) (and (every apply-patch '#+patches)
#+@(if snippet #+@(if snippet
#~((let ((module (make-fresh-user-module))) #~((let ((module (make-fresh-user-module)))
(module-use-interfaces! module (module-use-interfaces!
(map resolve-interface module
'#+modules)) (map resolve-interface '#+modules))
((@ (system base compile) compile) ((@ (system base compile) compile)
'#+snippet '#+snippet
#:to 'value #:to 'value
@ -527,11 +525,13 @@ (define (first-file directory)
(unless tar-supports-sort? (unless tar-supports-sort?
(call-with-output-file ".file_list" (call-with-output-file ".file_list"
(lambda (port) (lambda (port)
(for-each (lambda (name) (format port "~a~%" name)) (for-each (lambda (name)
(format port "~a~%" name))
(find-files directory (find-files directory
#:directories? #t #:directories? #t
#:fail-on-error? #t))))) #:fail-on-error? #t)))))
(zero? (apply system* (string-append #+tar "/bin/tar") (zero? (apply system*
(string-append #+tar "/bin/tar")
"cvfa" #$output "cvfa" #$output
;; avoid non-determinism in the archive ;; avoid non-determinism in the archive
"--mtime=@0" "--mtime=@0"
@ -541,15 +541,12 @@ (define (first-file directory)
`("--sort=name" `("--sort=name"
,directory) ,directory)
'("--no-recursion" '("--no-recursion"
"--files-from=.file_list"))))))))) "--files-from=.file_list"))))))))))
(let ((name (tarxz-name original-file-name)) (let ((name (tarxz-name original-file-name)))
(modules (delete-duplicates (cons '(guix build utils)
imported-modules))))
(gexp->derivation name build (gexp->derivation name build
#:graft? #f #:graft? #f
#:system system #:system system
#:modules modules
#:guile-for-build guile-for-build)))) #:guile-for-build guile-for-build))))
(define (transitive-inputs inputs) (define (transitive-inputs inputs)
@ -1138,8 +1135,7 @@ (define* (origin->derivation origin
;; No patches, no snippet: this is a fixed-output derivation. ;; No patches, no snippet: this is a fixed-output derivation.
(method uri 'sha256 sha256 name #:system system)) (method uri 'sha256 sha256 name #:system system))
(($ <origin> uri method sha256 name (= force (patches ...)) snippet (($ <origin> uri method sha256 name (= force (patches ...)) snippet
(flags ...) inputs (modules ...) (imported-modules ...) (flags ...) inputs (modules ...) guile-for-build)
guile-for-build)
;; Patches and/or a snippet. ;; Patches and/or a snippet.
(mlet %store-monad ((source (method uri 'sha256 sha256 name (mlet %store-monad ((source (method uri 'sha256 sha256 name
#:system system)) #:system system))
@ -1153,7 +1149,6 @@ (define* (origin->derivation origin
#:flags flags #:flags flags
#:system system #:system system
#:modules modules #:modules modules
#:imported-modules imported-modules
#:guile-for-build guile))))) #:guile-for-build guile)))))
(define-gexp-compiler (origin-compiler (origin origin?) system target) (define-gexp-compiler (origin-compiler (origin origin?) system target)