guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

10/10: download: Use 'with-imported-modules'.


From: Ludovic Courtès
Subject: 10/10: download: Use 'with-imported-modules'.
Date: Mon, 11 Jul 2016 22:59:08 +0000 (UTC)

civodul pushed a commit to branch wip-gexp-imported-modules
in repository guix.

commit af50c0848fd77b450c277859482a5030b33cf94b
Author: Ludovic Courtès <address@hidden>
Date:   Tue Jul 12 00:56:37 2016 +0200

    download: Use 'with-imported-modules'.
    
    * guix/cvs-download.scm (cvs-fetch): Use 'with-imported-modules' instead
    of the #:modules argument of 'gexp->derivation'.
    * guix/download.scm (url-fetch): Likewise.
    * guix/git-download.scm (git-fetch): Likewise.
    * guix/hg-download.scm (hg-fetch): Likewise.
    * guix/svn-download.scm (svn-fetch): Likewise.
---
 guix/cvs-download.scm |   20 ++++++++---------
 guix/download.scm     |   57 +++++++++++++++++++++++++------------------------
 guix/git-download.scm |   36 +++++++++++++++----------------
 guix/hg-download.scm  |   22 +++++++++----------
 guix/svn-download.scm |   22 +++++++++----------
 5 files changed, 79 insertions(+), 78 deletions(-)

diff --git a/guix/cvs-download.scm b/guix/cvs-download.scm
index 72478dd..85744c5 100644
--- a/guix/cvs-download.scm
+++ b/guix/cvs-download.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015 Ludovic Courtès <address@hidden>
+;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2014 Sree Harsha Totakura <address@hidden>
 ;;; Copyright © 2015 Mark H Weaver <address@hidden>
 ;;;
@@ -60,13 +60,15 @@
 object.  The output is expected to have recursive hash HASH of type
 HASH-ALGO (a symbol).  Use NAME as the file name, or a generic name if #f."
   (define build
-    #~(begin
-        (use-modules (guix build cvs))
-        (cvs-fetch '#$(cvs-reference-root-directory ref)
-                   '#$(cvs-reference-module ref)
-                   '#$(cvs-reference-revision ref)
-                   #$output
-                   #:cvs-command (string-append #+cvs "/bin/cvs"))))
+    (with-imported-modules '((guix build cvs)
+                             (guix build utils))
+      #~(begin
+          (use-modules (guix build cvs))
+          (cvs-fetch '#$(cvs-reference-root-directory ref)
+                     '#$(cvs-reference-module ref)
+                     '#$(cvs-reference-revision ref)
+                     #$output
+                     #:cvs-command (string-append #+cvs "/bin/cvs")))))
 
   (mlet %store-monad ((guile (package->derivation guile system)))
     (gexp->derivation (or name "cvs-checkout") build
@@ -74,8 +76,6 @@ HASH-ALGO (a symbol).  Use NAME as the file name, or a 
generic name if #f."
                       #:hash-algo hash-algo
                       #:hash hash
                       #:recursive? #t
-                      #:modules '((guix build cvs)
-                                  (guix build utils))
                       #:guile-for-build guile
                       #:local-build? #t)))
 
diff --git a/guix/download.scm b/guix/download.scm
index c75a655..336bc54 100644
--- a/guix/download.scm
+++ b/guix/download.scm
@@ -286,33 +286,39 @@ in the store."
          (any https? url)))))
 
   (define builder
-    #~(begin
-        #+(if need-gnutls?
+    (with-imported-modules '((guix build download)
+                             (guix build utils)
+                             (guix ftp-client)
+                             (guix base32)
+                             (guix base64))
+      #~(begin
+          #+(if need-gnutls?
 
-              ;; Add GnuTLS to the inputs and to the load path.
-              #~(eval-when (load expand eval)
-                  (set! %load-path
-                        (cons (string-append #+(gnutls-package)
-                                             "/share/guile/site/"
-                                             (effective-version))
-                              %load-path)))
-              #~#t)
+                ;; Add GnuTLS to the inputs and to the load path.
+                #~(eval-when (load expand eval)
+                    (set! %load-path
+                      (cons (string-append #+(gnutls-package)
+                                           "/share/guile/site/"
+                                           (effective-version))
+                            %load-path)))
+                #~#t)
 
-        (use-modules (guix build download)
-                     (guix base32))
+          (use-modules (guix build download)
+                       (guix base32))
 
-        (let ((value-from-environment (lambda (variable)
-                                        (call-with-input-string
-                                            (getenv variable)
-                                          read))))
-          (url-fetch (value-from-environment "guix download url")
-                     #$output
-                     #:mirrors (call-with-input-file #$%mirror-file read)
+          (let ((value-from-environment (lambda (variable)
+                                          (call-with-input-string
+                                              (getenv variable)
+                                            read))))
+            (url-fetch (value-from-environment "guix download url")
+                       #$output
+                       #:mirrors (call-with-input-file #$%mirror-file read)
 
-                     ;; Content-addressed mirrors.
-                     #:hashes (value-from-environment "guix download hashes")
-                     #:content-addressed-mirrors
-                     (primitive-load #$%content-addressed-mirror-file)))))
+                       ;; Content-addressed mirrors.
+                       #:hashes
+                       (value-from-environment "guix download hashes")
+                       #:content-addressed-mirrors
+                       (primitive-load #$%content-addressed-mirror-file))))))
 
   (let ((uri (and (string? url) (string->uri url))))
     (if (or (and (string? url) (not uri))
@@ -325,11 +331,6 @@ in the store."
                             #:system system
                             #:hash-algo hash-algo
                             #:hash hash
-                            #:modules '((guix build download)
-                                        (guix build utils)
-                                        (guix ftp-client)
-                                        (guix base32)
-                                        (guix base64))
 
                             ;; Use environment variables and a fixed script
                             ;; name so there's only one script in store for
diff --git a/guix/git-download.scm b/guix/git-download.scm
index 1e5c845..9cc6dd3 100644
--- a/guix/git-download.scm
+++ b/guix/git-download.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015 Ludovic Courtès <address@hidden>
+;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -68,23 +68,25 @@ HASH-ALGO (a symbol).  Use NAME as the file name, or a 
generic name if #f."
         '()))
 
   (define build
-    #~(begin
-        (use-modules (guix build git)
-                     (guix build utils)
-                     (ice-9 match))
+    (with-imported-modules '((guix build git)
+                             (guix build utils))
+      #~(begin
+          (use-modules (guix build git)
+                       (guix build utils)
+                       (ice-9 match))
 
-        ;; The 'git submodule' commands expects Coreutils, sed,
-        ;; grep, etc. to be in $PATH.
-        (set-path-environment-variable "PATH" '("bin")
-                                       (match '#+inputs
-                                         (((names dirs) ...)
-                                          dirs)))
+          ;; The 'git submodule' commands expects Coreutils, sed,
+          ;; grep, etc. to be in $PATH.
+          (set-path-environment-variable "PATH" '("bin")
+                                         (match '#+inputs
+                                           (((names dirs) ...)
+                                            dirs)))
 
-        (git-fetch '#$(git-reference-url ref)
-                   '#$(git-reference-commit ref)
-                   #$output
-                   #:recursive? '#$(git-reference-recursive? ref)
-                   #:git-command (string-append #+git "/bin/git"))))
+          (git-fetch '#$(git-reference-url ref)
+                     '#$(git-reference-commit ref)
+                     #$output
+                     #:recursive? '#$(git-reference-recursive? ref)
+                     #:git-command (string-append #+git "/bin/git")))))
 
   (mlet %store-monad ((guile (package->derivation guile system)))
     (gexp->derivation (or name "git-checkout") build
@@ -93,8 +95,6 @@ HASH-ALGO (a symbol).  Use NAME as the file name, or a 
generic name if #f."
                       #:hash-algo hash-algo
                       #:hash hash
                       #:recursive? #t
-                      #:modules '((guix build git)
-                                  (guix build utils))
                       #:guile-for-build guile
                       #:local-build? #t)))
 
diff --git a/guix/hg-download.scm b/guix/hg-download.scm
index f3e1d29..8420980 100644
--- a/guix/hg-download.scm
+++ b/guix/hg-download.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015 Ludovic Courtès <address@hidden>
+;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2016 Ricardo Wurmus <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -60,15 +60,17 @@
 object.  The output is expected to have recursive hash HASH of type
 HASH-ALGO (a symbol).  Use NAME as the file name, or a generic name if #f."
   (define build
-    #~(begin
-        (use-modules (guix build hg)
-                     (guix build utils)
-                     (ice-9 match))
+    (with-imported-modules '((guix build hg)
+                             (guix build utils))
+      #~(begin
+          (use-modules (guix build hg)
+                       (guix build utils)
+                       (ice-9 match))
 
-        (hg-fetch '#$(hg-reference-url ref)
-                  '#$(hg-reference-changeset ref)
-                  #$output
-                  #:hg-command (string-append #+hg "/bin/hg"))))
+          (hg-fetch '#$(hg-reference-url ref)
+                    '#$(hg-reference-changeset ref)
+                    #$output
+                    #:hg-command (string-append #+hg "/bin/hg")))))
 
   (mlet %store-monad ((guile (package->derivation guile system)))
     (gexp->derivation (or name "hg-checkout") build
@@ -77,8 +79,6 @@ HASH-ALGO (a symbol).  Use NAME as the file name, or a 
generic name if #f."
                       #:hash-algo hash-algo
                       #:hash hash
                       #:recursive? #t
-                      #:modules '((guix build hg)
-                                  (guix build utils))
                       #:guile-for-build guile)))
 
 ;;; hg-download.scm ends here
diff --git a/guix/svn-download.scm b/guix/svn-download.scm
index dddf648..c1200fa 100644
--- a/guix/svn-download.scm
+++ b/guix/svn-download.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015 Ludovic Courtès <address@hidden>
+;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2014 Sree Harsha Totakura <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -59,14 +59,16 @@
 object.  The output is expected to have recursive hash HASH of type
 HASH-ALGO (a symbol).  Use NAME as the file name, or a generic name if #f."
   (define build
-    #~(begin
-        (use-modules (guix build svn))
-        (svn-fetch '#$(svn-reference-url ref)
-                   '#$(svn-reference-revision ref)
-                   #$output
-                   #:svn-command (string-append #+svn "/bin/svn")
-                   #:user-name #$(svn-reference-user-name ref)
-                   #:password #$(svn-reference-password ref))))
+    (with-imported-modules '((guix build svn)
+                             (guix build utils))
+      #~(begin
+          (use-modules (guix build svn))
+          (svn-fetch '#$(svn-reference-url ref)
+                     '#$(svn-reference-revision ref)
+                     #$output
+                     #:svn-command (string-append #+svn "/bin/svn")
+                     #:user-name #$(svn-reference-user-name ref)
+                     #:password #$(svn-reference-password ref)))))
 
   (mlet %store-monad ((guile (package->derivation guile system)))
     (gexp->derivation (or name "svn-checkout") build
@@ -74,8 +76,6 @@ HASH-ALGO (a symbol).  Use NAME as the file name, or a 
generic name if #f."
                       #:hash-algo hash-algo
                       #:hash hash
                       #:recursive? #t
-                      #:modules '((guix build svn)
-                                  (guix build utils))
                       #:guile-for-build guile
                       #:local-build? #t)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]