summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/packages/base.scm20
-rw-r--r--gnu/packages/bash.scm30
-rw-r--r--gnu/packages/commencement.scm2
-rw-r--r--gnu/packages/cross-base.scm5
-rw-r--r--gnu/packages/databases.scm9
-rw-r--r--guix/packages.scm237
-rw-r--r--tests/packages.scm5
7 files changed, 166 insertions, 142 deletions
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index ac059870e2..3ed853a179 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -151,14 +151,14 @@ standard utility.")
 (define-public patch
   (package
    (name "patch")
-    (version "2.7.4")
+    (version "2.7.5")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnu/patch/patch-"
                                   version ".tar.xz"))
               (sha256
                (base32
-                "02gikxjvcxysr4l65c8vivgz62xmalp0av5ypzff8vqhrq3vpb0f"))))
+                "16d2r9kpivaak948mxzc0bai45mqfw73m113wrkmbffnalv1b5gx"))))
    (build-system gnu-build-system)
    (native-inputs `(("ed", ed)))
    (synopsis "Apply differences to originals, with optional backups")
@@ -431,7 +431,8 @@ included.")
       #:tests? #f                                 ; XXX
       #:phases (alist-cons-before
                 'configure 'pre-configure
-                (lambda* (#:key inputs outputs #:allow-other-keys)
+                (lambda* (#:key inputs native-inputs outputs
+                          #:allow-other-keys)
                   (let* ((out  (assoc-ref outputs "out"))
                          (bin  (string-append out "/bin")))
                     ;; Use `pwd', not `/bin/pwd'.
@@ -455,8 +456,13 @@ included.")
 
                     ;; Copy a statically-linked Bash in the output, with
                     ;; no references to other store paths.
+                    ;; FIXME: Normally we would look it up only in INPUTS but
+                    ;; cross-base uses it as a native input.
                     (mkdir-p bin)
-                    (copy-file (string-append (assoc-ref inputs "static-bash")
+                    (copy-file (string-append (or (assoc-ref inputs
+                                                             "static-bash")
+                                                  (assoc-ref native-inputs
+                                                             "static-bash"))
                                               "/bin/bash")
                                (string-append bin "/bash"))
                     (remove-store-references (string-append bin "/bash"))
@@ -611,7 +617,7 @@ command.")
 (define-public tzdata
   (package
     (name "tzdata")
-    (version "2014j")
+    (version "2015b")
     (source (origin
              (method url-fetch)
              (uri (string-append
@@ -619,7 +625,7 @@ command.")
                    version ".tar.gz"))
              (sha256
               (base32
-               "038fvj6zf51k6z9sbbxbj87ajaf69l3whal2vwshbm4l0qr71n52"))))
+               "0qmdr1yqqn94b5a54axwszfzimyxg27i6xsfmp0sswd3nfjw2sjm"))))
     (build-system gnu-build-system)
     (arguments
      '(#:tests? #f
@@ -666,7 +672,7 @@ command.")
                                 version ".tar.gz"))
                           (sha256
                            (base32
-                            "1qpd12imy7q5hb5fhk48mfw65s0xlrkmms0zr2gk0mj88qjn3m3z"))))))
+                            "0xjxlgzva13y8qi3vfbb3nq5pii8ax9wi4yc7vj9134rbciz2s76"))))))
     (home-page "http://www.iana.org/time-zones")
     (synopsis "Database of current and historical time zones")
     (description "The Time Zone Database (often called tz or zoneinfo)
diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm
index 361eb475d6..d98ef0582b 100644
--- a/gnu/packages/bash.scm
+++ b/gnu/packages/bash.scm
@@ -128,6 +128,26 @@ number/base32-hash tuples, directly usable in the 'patch-series' form."
              (let ((out (assoc-ref outputs "out")))
                (with-directory-excursion (string-append out "/bin")
                  (symlink "bash" "sh")))))
+         (install-headers-phase
+          '(lambda* (#:key outputs #:allow-other-keys)
+             ;; Install Bash headers so that packages that provide extensions
+             ;; can use them.  We install them in include/bash; that's what
+             ;; Debian does and what Bash extensions like recutils or
+             ;; guile-bash expect.
+             (let ((include (string-append (assoc-ref outputs "include")
+                                            "/include/bash"))
+                   (headers "^\\./(builtins/|lib/glob/|lib/tilde/|)[^/]+\\.h$"))
+               (mkdir-p include)
+               (for-each (lambda (file)
+                           (when ((@ (ice-9 regex) string-match) headers file)
+                             (let ((directory (string-append include "/"
+                                                             (dirname file))))
+                               (mkdir-p directory)
+                               (copy-file file
+                                          (string-append directory "/"
+                                                         (basename file))))))
+                         (find-files "." "\\.h$"))
+               #t)))
          (version "4.3"))
     (package
      (name "bash")
@@ -148,6 +168,9 @@ number/base32-hash tuples, directly usable in the 'patch-series' form."
      (version (string-append version "."
                              (number->string (length %patch-series-4.3))))
      (build-system gnu-build-system)
+
+     (outputs '("out"
+                "include"))                       ;headers used by extensions
      (native-inputs `(("bison" ,bison)))          ;to rebuild the parser
      (inputs `(("readline" ,readline)
                ("ncurses" ,ncurses)))             ;TODO: add texinfo
@@ -169,9 +192,10 @@ number/base32-hash tuples, directly usable in the 'patch-series' form."
         ;; for now.
         #:tests? #f
 
-        #:phases (alist-cons-after 'install 'post-install
-                                   ,post-install-phase
-                                   %standard-phases)))
+        #:phases (modify-phases %standard-phases
+                   (add-after install post-install ,post-install-phase)
+                   (add-after install install-headers
+                              ,install-headers-phase))))
      (synopsis "The GNU Bourne-Again SHell")
      (description
       "Bash is the shell, or command-line interpreter, of the GNU system.  It
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index f312e1729c..d96a8237c3 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -616,7 +616,7 @@ store.")
                                  (current-source-location)
                                  #:guile %bootstrap-guile)))
 
-(define glibc-utf8-locales-final
+(define-public glibc-utf8-locales-final
   ;; Now that we have GUILE-FINAL, build the UTF-8 locales.  They are needed
   ;; by the build processes afterwards so their 'scm_to_locale_string' works
   ;; with the full range of Unicode codepoints (remember
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 5a67d4b6ac..dbcc5bc268 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -298,8 +298,13 @@ XBINUTILS and the cross tool chain."
     ;; "linux-headers" input to point to the right thing.
     (propagated-inputs `(("linux-headers" ,xlinux-headers)))
 
+    ;; FIXME: 'static-bash' should really be an input, not a native input, but
+    ;; to do that will require building an intermediate cross libc.
+    (inputs '())
+
     (native-inputs `(("cross-gcc" ,xgcc)
                      ("cross-binutils" ,xbinutils)
+                     ,@(package-inputs glibc)     ;FIXME: static-bash
                      ,@(package-native-inputs glibc)))))
 
 
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index ee97977777..6498091aaf 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -238,9 +238,12 @@ types are supported, as is encryption.")
               "04dl53iv5q0srv4jcgjfzsrdzkq6dg1sgmlmpw9lrd4xrmj6jmvl"))))
    (build-system gnu-build-system)
    (inputs `(("readline" ,readline)))
-   ;; Add -DSQLITE_SECURE_DELETE.  GNU Icecat will refuse to use the system
-   ;; SQLite unless this option is enabled.
-   (arguments `(#:configure-flags '("CFLAGS=-O2 -DSQLITE_SECURE_DELETE")))
+   (arguments
+    `(#:configure-flags
+      ;; Add -DSQLITE_SECURE_DELETE and -DSQLITE_ENABLE_UNLOCK_NOTIFY to
+      ;; CFLAGS.  GNU Icecat will refuse to use the system SQLite unless these
+      ;; options are enabled.
+      '("CFLAGS=-O2 -DSQLITE_SECURE_DELETE -DSQLITE_ENABLE_UNLOCK_NOTIFY")))
    (home-page "http://www.sqlite.org/")
    (synopsis "The SQLite database management system")
    (description
diff --git a/guix/packages.scm b/guix/packages.scm
index ec0e79d08b..99fbd24cb6 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -26,6 +26,7 @@
   #:use-module (guix base32)
   #:use-module (guix derivations)
   #:use-module (guix build-system)
+  #:use-module (guix gexp)
   #:use-module (ice-9 match)
   #:use-module (ice-9 vlist)
   #:use-module (srfi srfi-1)
@@ -334,8 +335,10 @@ corresponds to the arguments expected by `set-path-environment-variable'."
       ("bzip2" ,(ref '(gnu packages compression) 'bzip2))
       ("gzip"  ,(ref '(gnu packages compression) 'gzip))
       ("lzip"  ,(ref '(gnu packages compression) 'lzip))
+      ("unzip" ,(ref '(gnu packages zip) 'unzip))
       ("patch" ,(ref '(gnu packages base) 'patch))
-      ("locales" ,(ref '(gnu packages base) 'glibc-utf8-locales)))))
+      ("locales" ,(ref '(gnu packages commencement)
+                       'glibc-utf8-locales-final)))))
 
 (define (default-guile)
   "Return the default Guile package used to run the build code of
@@ -349,10 +352,9 @@ the build code of derivation."
   (package->derivation (default-guile) system
                        #:graft? #f))
 
-;; TODO: Rewrite using %STORE-MONAD and gexps.
-(define* (patch-and-repack store source patches
+(define* (patch-and-repack source patches
                            #:key
-                           (inputs '())
+                           inputs
                            (snippet #f)
                            (flags '("-p1"))
                            (modules '())
@@ -370,10 +372,20 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET."
         (derivation->output-path source)
         source))
 
+  (define lookup-input
+    ;; The default value of the 'patch-inputs' field, and thus INPUTS is #f,
+    ;; so deal with that.
+    (let ((inputs (or inputs (%standard-patch-inputs))))
+      (lambda (name)
+        (match (assoc-ref inputs name)
+          ((package) package)
+          (#f        #f)))))
+
   (define decompression-type
     (cond ((string-suffix? "gz" source-file-name)  "gzip")
           ((string-suffix? "bz2" source-file-name) "bzip2")
           ((string-suffix? "lz" source-file-name)  "lzip")
+          ((string-suffix? "zip" source-file-name) "unzip")
           (else "xz")))
 
   (define original-file-name
@@ -398,115 +410,95 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET."
                          ".xz"
                          ".tar.xz"))))
 
-  (define patch-inputs
-    (map (lambda (number patch)
-           (list (string-append "patch" (number->string number))
-                 (match patch
-                   ((? string?)
-                    (add-to-store store (basename patch) #t
-                                  "sha256" patch))
-                   ((? origin?)
-                    (package-source-derivation store patch system)))))
-         (iota (length patches))
-
-         patches))
-
-  (define builder
-    `(begin
-       (use-modules (ice-9 ftw)
-                    (srfi srfi-1)
-                    (guix build utils))
-
-       ;; Encoding/decoding errors shouldn't be silent.
-       (fluid-set! %default-port-conversion-strategy 'error)
-
-       (let ((locales (assoc-ref %build-inputs "locales"))
-             (out     (assoc-ref %outputs "out"))
-             (xz      (assoc-ref %build-inputs "xz"))
-             (decomp  (assoc-ref %build-inputs ,decompression-type))
-             (source  (assoc-ref %build-inputs "source"))
-             (tar     (string-append (assoc-ref %build-inputs "tar")
-                                     "/bin/tar"))
-             (patch   (string-append (assoc-ref %build-inputs "patch")
-                                     "/bin/patch")))
-         (define (apply-patch input)
-           (let ((patch* (assoc-ref %build-inputs input)))
-             (format (current-error-port) "applying '~a'...~%" patch*)
-
-             ;; Use '--force' so that patches that do not apply perfectly are
-             ;; rejected.
-             (zero? (system* 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 '("." "..")))))))
-
-         (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"))
-           (setlocale LC_ALL "en_US.UTF-8"))
-
-         (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     (or (getenv "NIX_STORE") "/gnu/store"))
-                         (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)
-                  (zero? (system* tar "xvf" source)))
-              (let ((directory (first-file ".")))
-                (format (current-error-port)
-                        "source is under '~a'~%" directory)
-                (chdir directory)
-
-                (and (every apply-patch ',(map car patch-inputs))
-
-                     ,@(if snippet
-                           `((let ((module (make-fresh-user-module)))
-                               (module-use-interfaces! module
-                                                       (map resolve-interface
-                                                            ',modules))
-                               (module-define! module '%build-inputs
-                                               %build-inputs)
-                               (module-define! module '%outputs %outputs)
-                               ((@ (system base compile) compile)
-                                ',snippet
-                                #:to 'value
-                                #:opts %auto-compilation-options
-                                #:env module)))
-                           '())
-
-                     (begin (chdir "..") #t)
-                     (zero? (system* tar "cvfa" out directory))))))))
-
-
-  (let ((name    (tarxz-name original-file-name))
-        (inputs  (filter-map (match-lambda
-                              ((name (? package? p))
-                               (and (member name (cons decompression-type
-                                                       '("tar" "xz" "patch")))
-                                    (list name
-                                          (package-derivation store p system
-                                                              #:graft? #f)))))
-                             (or inputs (%standard-patch-inputs))))
-        (modules (delete-duplicates (cons '(guix build utils) modules))))
-
-    (build-expression->derivation store name builder
-                                 #:inputs `(("source" ,source)
-                                            ,@inputs
-                                            ,@patch-inputs)
-                                 #:system system
-                                 #:modules modules
-                                 #:guile-for-build guile-for-build)))
+  (define instantiate-patch
+    (match-lambda
+      ((? string? patch)
+       (interned-file patch #:recursive? #t))
+      ((? origin? patch)
+       (origin->derivation patch system))))
+
+  (mlet %store-monad ((tar ->     (lookup-input "tar"))
+                      (xz ->      (lookup-input "xz"))
+                      (patch ->   (lookup-input "patch"))
+                      (locales -> (lookup-input "locales"))
+                      (decomp ->  (lookup-input decompression-type))
+                      (patches    (sequence %store-monad
+                                            (map instantiate-patch patches))))
+    (define build
+      #~(begin
+          (use-modules (ice-9 ftw)
+                       (srfi srfi-1)
+                       (guix build utils))
+
+          (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"))
+            (setlocale LC_ALL "en_US.UTF-8"))
+
+          (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     (or (getenv "NIX_STORE") "/gnu/store"))
+                          (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)
+                      (zero? (system* (string-append #$tar "/bin/tar")
+                                      "cvfa" #$output directory)))))))
+
+    (let ((name    (tarxz-name original-file-name))
+          (modules (delete-duplicates (cons '(guix build utils) modules))))
+      (gexp->derivation name build
+                        #:graft? #f
+                        #:system system
+                        #:modules modules
+                        #:guile-for-build guile-for-build))))
 
 (define (transitive-inputs inputs)
   (let loop ((inputs  inputs)
@@ -954,9 +946,6 @@ cross-compilation target triplet."
       (package->cross-derivation package target system)
       (package->derivation package system)))
 
-(define patch-and-repack*
-  (store-lift patch-and-repack))
-
 (define* (origin->derivation source
                              #:optional (system (%current-system)))
   "When SOURCE is an <origin> object, return its derivation for SYSTEM.  When
@@ -976,14 +965,14 @@ outside of the store) or SOURCE itself (if SOURCE is already a store item.)"
                                                           (default-guile))
                                                       system
                                                       #:graft? #f)))
-       (patch-and-repack* source patches
-                          #:inputs inputs
-                          #:snippet snippet
-                          #:flags flags
-                          #:system system
-                          #:modules modules
-                          #:imported-modules modules
-                          #:guile-for-build guile)))
+       (patch-and-repack source patches
+                         #:inputs inputs
+                         #:snippet snippet
+                         #:flags flags
+                         #:system system
+                         #:modules modules
+                         #:imported-modules modules
+                         #:guile-for-build guile)))
     ((and (? string?) (? direct-store-path?) file)
      (with-monad %store-monad
        (return file)))
diff --git a/tests/packages.scm b/tests/packages.scm
index c9dd5d859a..a181b1b08a 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -205,10 +205,7 @@
                                 (chmod "." #o777)
                                 (symlink "guile" "guile-rocks")
                                 (copy-recursively "../share/guile/2.0/scripts"
-                                                  "scripts")
-
-                                ;; These variables must exist.
-                                (pk %build-inputs %outputs))))))
+                                                  "scripts"))))))
          (package (package (inherit (dummy-package "with-snippet"))
                     (source source)
                     (build-system trivial-build-system)