summaryrefslogtreecommitdiff
path: root/guix/packages.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-07-12 22:23:12 +0200
committerLudovic Courtès <ludo@gnu.org>2016-07-12 22:47:08 +0200
commit1929fdba80ab2432d0a9c27633c94a79fb3bb170 (patch)
tree6812d6979bc3b413232ac6172c0d86acabe5a968 /guix/packages.scm
parentc1629416d89b187b1f37ed0c834570846f8a087a (diff)
downloadguix-patches-1929fdba80ab2432d0a9c27633c94a79fb3bb170.tar
guix-patches-1929fdba80ab2432d0a9c27633c94a79fb3bb170.tar.gz
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.
Diffstat (limited to 'guix/packages.scm')
-rw-r--r--guix/packages.scm209
1 files changed, 102 insertions, 107 deletions
diff --git a/guix/packages.scm b/guix/packages.scm
index acb8f34417..bfb4c557ab 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -56,7 +56,6 @@
origin-patch-guile
origin-snippet
origin-modules
- origin-imported-modules
base32
package
@@ -164,8 +163,7 @@
(default #f))
(modules origin-modules ; list of module names
(default '()))
- (imported-modules origin-imported-modules ; list of module names
- (default '()))
+
(patch-guile origin-patch-guile ; package or #f
(default #f)))
@@ -381,14 +379,13 @@ the build code of derivation."
(snippet #f)
(flags '("-p1"))
(modules '())
- (imported-modules '())
(guile-for-build (%guile-for-build))
(system (%current-system)))
"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,
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
-IMPORTED-MODULES specify modules to use/import for use by SNIPPET."
+SOURCE was unpacked, after all of PATCHES have been applied. MODULES
+specifies modules in scope when evaluating SNIPPET."
(define source-file-name
;; SOURCE is usually a derivation, but it could be a store file.
(if (derivation? source)
@@ -449,107 +446,107 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET."
(patches (sequence %store-monad
(map instantiate-patch patches))))
(define build
- #~(begin
- (use-modules (ice-9 ftw)
- (srfi srfi-1)
- (guix build utils))
-
- ;; The --sort option was added to GNU tar in version 1.28, released
- ;; 2014-07-28. During bootstrap we must cope with older versions.
- (define tar-supports-sort?
- (zero? (system* (string-append #+tar "/bin/tar")
- "cf" "/dev/null" "--files-from=/dev/null"
- "--sort=name")))
-
- (define (apply-patch patch)
- (format (current-error-port) "applying '~a'...~%" patch)
-
- ;; Use '--force' so that patches that do not apply perfectly are
- ;; rejected.
- (zero? (system* (string-append #+patch "/bin/patch")
- "--force" #+@flags "--input" patch)))
-
- (define (first-file directory)
- ;; Return the name of the first file in DIRECTORY.
- (car (scandir directory
- (lambda (name)
- (not (member name '("." "..")))))))
-
- ;; Encoding/decoding errors shouldn't be silent.
- (fluid-set! %default-port-conversion-strategy 'error)
-
- (when #+locales
- ;; First of all, install a UTF-8 locale so that UTF-8 file names
- ;; are correctly interpreted. During bootstrap, LOCALES is #f.
- (setenv "LOCPATH"
- (string-append #+locales "/lib/locale/"
- #+(and locales
- (package-version locales))))
- (setlocale LC_ALL "en_US.utf8"))
-
- (setenv "PATH" (string-append #+xz "/bin" ":"
- #+decomp "/bin"))
-
- ;; SOURCE may be either a directory or a tarball.
- (and (if (file-is-directory? #+source)
- (let* ((store (%store-directory))
- (len (+ 1 (string-length store)))
- (base (string-drop #+source len))
- (dash (string-index base #\-))
- (directory (string-drop base (+ 1 dash))))
- (mkdir directory)
- (copy-recursively #+source directory)
- #t)
- #+(if (string=? decompression-type "unzip")
- #~(zero? (system* "unzip" #+source))
- #~(zero? (system* (string-append #+tar "/bin/tar")
- "xvf" #+source))))
- (let ((directory (first-file ".")))
- (format (current-error-port)
- "source is under '~a'~%" directory)
- (chdir directory)
-
- (and (every apply-patch '#+patches)
- #+@(if snippet
- #~((let ((module (make-fresh-user-module)))
- (module-use-interfaces! module
- (map resolve-interface
- '#+modules))
- ((@ (system base compile) compile)
- '#+snippet
- #:to 'value
- #:opts %auto-compilation-options
- #:env module)))
- #~())
-
- (begin (chdir "..") #t)
-
- (unless tar-supports-sort?
- (call-with-output-file ".file_list"
- (lambda (port)
- (for-each (lambda (name) (format port "~a~%" name))
- (find-files directory
- #:directories? #t
- #:fail-on-error? #t)))))
- (zero? (apply system* (string-append #+tar "/bin/tar")
- "cvfa" #$output
- ;; avoid non-determinism in the archive
- "--mtime=@0"
- "--owner=root:0"
- "--group=root:0"
- (if tar-supports-sort?
- `("--sort=name"
- ,directory)
- '("--no-recursion"
- "--files-from=.file_list")))))))))
-
- (let ((name (tarxz-name original-file-name))
- (modules (delete-duplicates (cons '(guix build utils)
- imported-modules))))
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (ice-9 ftw)
+ (srfi srfi-1)
+ (guix build utils))
+
+ ;; The --sort option was added to GNU tar in version 1.28, released
+ ;; 2014-07-28. During bootstrap we must cope with older versions.
+ (define tar-supports-sort?
+ (zero? (system* (string-append #+tar "/bin/tar")
+ "cf" "/dev/null" "--files-from=/dev/null"
+ "--sort=name")))
+
+ (define (apply-patch patch)
+ (format (current-error-port) "applying '~a'...~%" patch)
+
+ ;; Use '--force' so that patches that do not apply perfectly are
+ ;; rejected.
+ (zero? (system* (string-append #+patch "/bin/patch")
+ "--force" #+@flags "--input" patch)))
+
+ (define (first-file directory)
+ ;; Return the name of the first file in DIRECTORY.
+ (car (scandir directory
+ (lambda (name)
+ (not (member name '("." "..")))))))
+
+ ;; Encoding/decoding errors shouldn't be silent.
+ (fluid-set! %default-port-conversion-strategy 'error)
+
+ (when #+locales
+ ;; First of all, install a UTF-8 locale so that UTF-8 file names
+ ;; are correctly interpreted. During bootstrap, LOCALES is #f.
+ (setenv "LOCPATH"
+ (string-append #+locales "/lib/locale/"
+ #+(and locales
+ (package-version locales))))
+ (setlocale LC_ALL "en_US.utf8"))
+
+ (setenv "PATH" (string-append #+xz "/bin" ":"
+ #+decomp "/bin"))
+
+ ;; SOURCE may be either a directory or a tarball.
+ (and (if (file-is-directory? #+source)
+ (let* ((store (%store-directory))
+ (len (+ 1 (string-length store)))
+ (base (string-drop #+source len))
+ (dash (string-index base #\-))
+ (directory (string-drop base (+ 1 dash))))
+ (mkdir directory)
+ (copy-recursively #+source directory)
+ #t)
+ #+(if (string=? decompression-type "unzip")
+ #~(zero? (system* "unzip" #+source))
+ #~(zero? (system* (string-append #+tar "/bin/tar")
+ "xvf" #+source))))
+ (let ((directory (first-file ".")))
+ (format (current-error-port)
+ "source is under '~a'~%" directory)
+ (chdir directory)
+
+ (and (every apply-patch '#+patches)
+ #+@(if snippet
+ #~((let ((module (make-fresh-user-module)))
+ (module-use-interfaces!
+ module
+ (map resolve-interface '#+modules))
+ ((@ (system base compile) compile)
+ '#+snippet
+ #:to 'value
+ #:opts %auto-compilation-options
+ #:env module)))
+ #~())
+
+ (begin (chdir "..") #t)
+
+ (unless tar-supports-sort?
+ (call-with-output-file ".file_list"
+ (lambda (port)
+ (for-each (lambda (name)
+ (format port "~a~%" name))
+ (find-files directory
+ #:directories? #t
+ #:fail-on-error? #t)))))
+ (zero? (apply system*
+ (string-append #+tar "/bin/tar")
+ "cvfa" #$output
+ ;; avoid non-determinism in the archive
+ "--mtime=@0"
+ "--owner=root:0"
+ "--group=root:0"
+ (if tar-supports-sort?
+ `("--sort=name"
+ ,directory)
+ '("--no-recursion"
+ "--files-from=.file_list"))))))))))
+
+ (let ((name (tarxz-name original-file-name)))
(gexp->derivation name build
#:graft? #f
#:system system
- #:modules modules
#:guile-for-build guile-for-build))))
(define (transitive-inputs inputs)
@@ -1138,8 +1135,7 @@ cross-compilation target triplet."
;; No patches, no snippet: this is a fixed-output derivation.
(method uri 'sha256 sha256 name #:system system))
(($ <origin> uri method sha256 name (= force (patches ...)) snippet
- (flags ...) inputs (modules ...) (imported-modules ...)
- guile-for-build)
+ (flags ...) inputs (modules ...) guile-for-build)
;; Patches and/or a snippet.
(mlet %store-monad ((source (method uri 'sha256 sha256 name
#:system system))
@@ -1153,7 +1149,6 @@ cross-compilation target triplet."
#:flags flags
#:system system
#:modules modules
- #:imported-modules imported-modules
#:guile-for-build guile)))))
(define-gexp-compiler (origin-compiler (origin origin?) system target)