gnu: guix: Update development snapshot.
[jackhill/guix/guix.git] / gnu / packages / package-management.scm
index 46ebde8..da11ef4 100644 (file)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix gexp)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
+  #:use-module ((guix build utils) #:select (with-directory-excursion))
   #:use-module ((guix licenses) #:select (gpl2+ gpl3+ lgpl2.1+ asl2.0))
   #:use-module (gnu packages)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages popt)
   #:use-module (gnu packages gnuzilla)
   #:use-module (gnu packages cpio)
-  #:use-module (gnu packages tls))
+  #:use-module (gnu packages tls)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:use-module (ice-9 popen)
+  #:use-module (ice-9 rdelim)
+  #:use-module (ice-9 match))
 
 (define (boot-guile-uri arch)
   "Return the URI for the bootstrap Guile tarball for ARCH."
                      arch "-linux"
                      "/20131110/guile-2.0.9.tar.xz")))
 
-(define-public guix-0.10.0
+(define-public guix-0.11.0
   (package
     (name "guix")
-    (version "0.10.0")
+    (version "0.11.0")
     (source (origin
              (method url-fetch)
              (uri (string-append "ftp://alpha.gnu.org/gnu/guix/guix-"
                                  version ".tar.gz"))
              (sha256
               (base32
-               "0d4afwy7bpqi4k4bzvwc4ga4shwssis1nrvdw53qjyg9bw1a8lbn"))))
+               "1cwrbpv4dq7aczwksmcfw9w8r2bzrb5ld9zvjcr90i804hjpcb93"))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags (list
                        ;; incompatible .go files as reported at
                        ;; <https://lists.gnu.org/archive/html/guix-devel/2016-03/msg01261.html>.
                        (wrap-program (string-append out "/bin/guix")
-                         `("GUILE_LOAD_PATH" ":" = (,path))
+                         `("GUILE_LOAD_PATH" ":" prefix (,path))
                          `("GUILE_LOAD_COMPILED_PATH" ":" = (,path)))
 
                        #t))))))
     (native-inputs `(("pkg-config" ,pkg-config)
-                     ("emacs" ,emacs-no-x)))      ;for guix.el
+                     ("emacs" ,emacs-minimal)     ;for guix.el
+
+                     ;; XXX: Keep the development inputs here even though
+                     ;; they're unnecessary, just so that 'guix environment
+                     ;; guix' always contains them.
+                     ("autoconf" ,(autoconf-wrapper))
+                     ("automake" ,automake)
+                     ("gettext" ,gnu-gettext)
+                     ("texinfo" ,texinfo)
+                     ("graphviz" ,graphviz)
+                     ("help2man" ,help2man)))
     (inputs
      (let ((boot-guile (lambda (arch hash)
                          (origin
                           (sha256 hash)))))
        `(("bzip2" ,bzip2)
          ("gzip" ,gzip)
+         ("zlib" ,zlib)                           ;for 'guix publish'
 
          ("sqlite" ,sqlite)
          ("libgcrypt" ,libgcrypt)
     (propagated-inputs
      `(("gnutls" ,gnutls)                         ;for 'guix download' & co.
        ("guile-json" ,guile-json)
-       ("geiser" ,geiser)))                       ;for guix.el
+       ("geiser" ,geiser)                         ;for guix.el
+       ("emacs-magit-popup" ,emacs-magit-popup))) ;for "M-x guix" command
 
     (home-page "http://www.gnu.org/software/guix")
     (synopsis "Functional package manager for installed software packages and versions")
@@ -203,20 +222,22 @@ the Nix package manager.")
   ;;
   ;; Note: use a very short commit id; with a longer one, the limit on
   ;; hash-bang lines would be exceeded while running the tests.
-  (let ((commit "761139354798303c605964b896c250a01486b00a"))
-    (package (inherit guix-0.10.0)
-      (version (string-append "0.10.0-0." (string-take commit 4)))
+  (let ((commit "166ba5b10207f44360e218d9e3f00772d09bc7cd"))
+    (package (inherit guix-0.11.0)
+      (version (string-append "0.11.0-2." (string-take commit 4)))
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
-                      (url "git://git.sv.gnu.org/guix.git")
+                      ;; "git://git.sv.gnu.org/guix.git" temporarily
+                      ;; unavailable (XXX).
+                      (url "http://git.savannah.gnu.org/r/guix.git")
                       (commit commit)))
                 (sha256
                  (base32
-                  "1wvy9kms3v6k7cybw6489mqk161lv8d03qgmmxbmdgiwjmjxbzbn"))
+                  "144ld5l2gnjcw819cz8mninfwhxr0ijv3wac3j3xf0pzqhxfi29c"))
                 (file-name (string-append "guix-" version "-checkout"))))
       (arguments
-       (substitute-keyword-arguments (package-arguments guix-0.10.0)
+       (substitute-keyword-arguments (package-arguments guix-0.11.0)
          ((#:configure-flags flags)
           ;; Set 'DOT_USER_PROGRAM' to the empty string so we don't keep a
           ;; reference to Graphviz, whose closure is pretty big (too big for
@@ -232,18 +253,77 @@ the Nix package manager.")
                             (chmod po #o666))
                           (find-files "." "\\.po$"))
 
-                (zero? (system* "sh" "bootstrap"))))))))
-      (native-inputs
-       `(("autoconf" ,(autoconf-wrapper))
-         ("automake" ,automake)
-         ("gettext" ,gnu-gettext)
-         ("texinfo" ,texinfo)
-         ("graphviz" ,graphviz)
-         ("help2man" ,help2man)
-         ,@(package-native-inputs guix-0.10.0))))))
+                (zero? (system* "sh" "bootstrap")))))))))))
 
 (define-public guix guix-devel)
 
+(define (source-file? file stat)
+  "Return true if FILE is likely a source file, false if it is a typical
+generated file."
+  (define (wrong-extension? file)
+    (or (string-suffix? "~" file)
+        (member (file-extension file)
+                '("o" "a" "lo" "so" "go"))))
+
+  (match (basename file)
+    ((or ".git" "autom4te.cache" "configure" "Makefile" "Makefile.in" ".libs")
+     #f)
+    ((? wrong-extension?)
+     #f)
+    (_
+     #t)))
+
+(define (make-git-predicate directory)
+  "Return a predicate that returns true if a file is part of the Git checkout
+living at DIRECTORY.  Upon Git failure, return #f instead of a predicate."
+  (define (parent-directory? thing directory)
+    ;; Return #t if DIRECTORY is the parent of THING.
+    (or (string-suffix? thing directory)
+        (and (string-index thing #\/)
+             (parent-directory? (dirname thing) directory))))
+
+  (let* ((pipe        (with-directory-excursion directory
+                        (open-pipe* OPEN_READ "git" "ls-files")))
+         (files       (let loop ((lines '()))
+                        (match (read-line pipe)
+                          ((? eof-object?)
+                           (reverse lines))
+                          (line
+                           (loop (cons line lines))))))
+         (status      (close-pipe pipe)))
+    (and (zero? status)
+         (lambda (file stat)
+           (match (stat:type stat)
+             ('directory
+              ;; 'git ls-files' does not list directories, only regular files,
+              ;; so we need this special trick.
+              (any (cut parent-directory? <> file) files))
+             ((or 'regular 'symlink)
+              (any (cut string-suffix? <> file) files))
+             (_
+              #f))))))
+
+(define-public current-guix
+  (let ((select? (delay (or (make-git-predicate
+                             (string-append (current-source-directory)
+                                            "/../.."))
+                            source-file?))))
+    (lambda ()
+      "Return a package representing Guix built from the current source tree.
+This works by adding the current source tree to the store (after filtering it
+out) and returning a package that uses that as its 'source'."
+      (package
+        (inherit guix)
+        (version (string-append (package-version guix) "+"))
+        (source (local-file "../.." "guix-current"
+                            #:recursive? #t
+                            #:select? (force select?)))))))
+
+\f
+;;;
+;;; Other tools.
+;;;
+
 (define-public nix
   (package
     (name "nix")
@@ -325,14 +405,15 @@ symlinks to the files in a common directory such as /usr/local.")
 (define-public rpm
   (package
     (name "rpm")
-    (version "4.12.0")
+    (version "4.12.0.1")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://rpm.org/releases/rpm-4.12.x/rpm-"
                                   version ".tar.bz2"))
               (sha256
                (base32
-                "18hk47hc755nslvb7xkq4jb095z7va0nlcyxdpxayc4lmb8mq3bp"))))
+                "0a82ym8phx7g0f3k6smvxnvzh7yv857l42xafk49689kzhld5pbp"))
+              (patches (search-patches "rpm-CVE-2014-8118.patch"))))
     (build-system gnu-build-system)
     (arguments
      '(#:configure-flags '("--with-external-db"   ;use the system's bdb
@@ -397,13 +478,13 @@ transactions from C or Python.")
 (define-public diffoscope
   (package
     (name "diffoscope")
-    (version "51")
+    (version "62")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri name version))
               (sha256
                (base32
-                "18rn6rrwh586228vnaf1nq0wayh19zbvfc0qmnbys6ln2pv2v007"))))
+                "127b4gsw11hjbha5jpz5i42pc142h52pwzs1p792047y0j1yjg8z"))))
     (build-system python-build-system)
     (arguments
      `(#:phases (modify-phases %standard-phases