Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / package-management.scm
CommitLineData
bbe8d8f0 1;;; GNU Guix --- Functional package management for GNU
e8e2e18b 2;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
8d422e25 3;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
bbe8d8f0
LC
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (gnu packages package-management)
21 #:use-module (guix packages)
22 #:use-module (guix download)
480af4d6 23 #:use-module (guix git-download)
04eb0fab 24 #:use-module (guix gexp)
480af4d6 25 #:use-module (guix utils)
bbe8d8f0 26 #:use-module (guix build-system gnu)
e3e1ecf6 27 #:use-module (guix build-system python)
04eb0fab 28 #:use-module ((guix build utils) #:select (with-directory-excursion))
e3e1ecf6 29 #:use-module ((guix licenses) #:select (gpl2+ gpl3+ lgpl2.1+ asl2.0))
8a43ff10 30 #:use-module (gnu packages)
bbe8d8f0 31 #:use-module (gnu packages guile)
e3e1ecf6
LC
32 #:use-module (gnu packages file)
33 #:use-module (gnu packages backup)
38cf2ba0 34 #:use-module (gnu packages compression)
bbe8d8f0 35 #:use-module (gnu packages gnupg)
5f96f303 36 #:use-module (gnu packages databases)
480af4d6
LC
37 #:use-module (gnu packages graphviz)
38 #:use-module (gnu packages pkg-config)
39 #:use-module (gnu packages autotools)
40 #:use-module (gnu packages gettext)
fcb0109d 41 #:use-module (gnu packages texinfo)
e3e1ecf6 42 #:use-module (gnu packages nettle)
fcb0109d
LC
43 #:use-module (gnu packages perl)
44 #:use-module (gnu packages curl)
45 #:use-module (gnu packages web)
e21adc76 46 #:use-module (gnu packages man)
b173d0e4 47 #:use-module (gnu packages emacs)
a7fd7b68 48 #:use-module (gnu packages bdw-gc)
e3e1ecf6
LC
49 #:use-module (gnu packages python)
50 #:use-module (gnu packages popt)
51 #:use-module (gnu packages gnuzilla)
52 #:use-module (gnu packages cpio)
04eb0fab
LC
53 #:use-module (gnu packages tls)
54 #:use-module (srfi srfi-1)
55 #:use-module (srfi srfi-26)
56 #:use-module (ice-9 popen)
57 #:use-module (ice-9 rdelim)
58 #:use-module (ice-9 match))
bbe8d8f0 59
39de700c
LC
60(define (boot-guile-uri arch)
61 "Return the URI for the bootstrap Guile tarball for ARCH."
62 (if (string=? "armhf" arch)
63 (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
64 arch "-linux"
65 "/20150101/guile-2.0.11.tar.xz")
66 (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
67 arch "-linux"
68 "/20131110/guile-2.0.9.tar.xz")))
69
58f0aae5 70(define-public guix-0.10.0
bbe8d8f0
LC
71 (package
72 (name "guix")
58f0aae5 73 (version "0.10.0")
bbe8d8f0
LC
74 (source (origin
75 (method url-fetch)
76 (uri (string-append "ftp://alpha.gnu.org/gnu/guix/guix-"
77 version ".tar.gz"))
78 (sha256
79 (base32
58f0aae5 80 "0d4afwy7bpqi4k4bzvwc4ga4shwssis1nrvdw53qjyg9bw1a8lbn"))))
bbe8d8f0
LC
81 (build-system gnu-build-system)
82 (arguments
83 `(#:configure-flags (list
2d195e67 84 "--localstatedir=/var"
202adef2 85 "--sysconfdir=/etc"
dd3a42e6
MW
86 (string-append "--with-bash-completion-dir="
87 (assoc-ref %outputs "out")
88 "/etc/bash_completion.d")
bbe8d8f0
LC
89 (string-append "--with-libgcrypt-prefix="
90 (assoc-ref %build-inputs
91 "libgcrypt")))
dc57d527 92 #:parallel-tests? #f ;work around <http://bugs.gnu.org/21097>
02c2cf43
LC
93 #:phases (modify-phases %standard-phases
94 (add-before
95 'configure 'copy-bootstrap-guile
96 (lambda* (#:key system inputs #:allow-other-keys)
97 (define (boot-guile-version arch)
98 (if (string=? "armhf" arch)
99 "2.0.11"
100 "2.0.9"))
39de700c 101
02c2cf43
LC
102 (define (copy arch)
103 (let ((guile (assoc-ref inputs
104 (string-append "boot-guile/"
105 arch)))
106 (target (string-append "gnu/packages/bootstrap/"
107 arch "-linux/"
108 "/guile-"
109 (boot-guile-version arch)
110 ".tar.xz")))
111 (copy-file guile target)))
bbe8d8f0 112
02c2cf43
LC
113 (copy "i686")
114 (copy "x86_64")
115 (copy "mips64el")
116 (copy "armhf")
932e7204 117 #t))
5d09263b
LC
118 (add-after
119 'unpack 'disable-container-tests
120 ;; XXX FIXME: These tests fail within the build container.
121 (lambda _
122 (substitute* "tests/syscalls.scm"
123 (("^\\(test-assert \"(clone|setns|pivot-root)\"" all)
124 (string-append "(test-skip 1)\n" all)))
125 (substitute* "tests/containers.scm"
126 (("^\\(test-assert" all)
127 (string-append "(test-skip 1)\n" all)))
dc57d527
LC
128 (when (file-exists? "tests/guix-environment-container.sh")
129 (substitute* "tests/guix-environment-container.sh"
130 (("guix environment --version")
131 "exit 77\n")))
5d09263b 132 #t))
dc57d527
LC
133 (add-before 'check 'set-SHELL
134 (lambda _
135 ;; 'guix environment' tests rely on 'SHELL' having a
136 ;; correct value, so set it.
137 (setenv "SHELL" (which "sh"))
138 #t))
932e7204
LC
139 (add-after
140 'install 'wrap-program
141 (lambda* (#:key inputs outputs #:allow-other-keys)
142 ;; Make sure the 'guix' command finds GnuTLS and
143 ;; Guile-JSON automatically.
144 (let* ((out (assoc-ref outputs "out"))
145 (json (assoc-ref inputs "guile-json"))
146 (gnutls (assoc-ref inputs "gnutls"))
147 (path (string-append
148 json "/share/guile/site/2.0:"
149 gnutls "/share/guile/site/2.0")))
61cdad35
LC
150
151 ;; Ignore user settings so that a bogus
152 ;; GUILE_LOAD_COMPILED_PATH does not prevent use of
153 ;; 'guix', notably when it contains entries pointing to
154 ;; incompatible .go files as reported at
155 ;; <https://lists.gnu.org/archive/html/guix-devel/2016-03/msg01261.html>.
932e7204 156 (wrap-program (string-append out "/bin/guix")
61cdad35
LC
157 `("GUILE_LOAD_PATH" ":" = (,path))
158 `("GUILE_LOAD_COMPILED_PATH" ":" = (,path)))
159
932e7204 160 #t))))))
b173d0e4 161 (native-inputs `(("pkg-config" ,pkg-config)
b8fc3622 162 ("emacs" ,emacs-minimal))) ;for guix.el
bbe8d8f0
LC
163 (inputs
164 (let ((boot-guile (lambda (arch hash)
165 (origin
166 (method url-fetch)
39de700c 167 (uri (boot-guile-uri arch))
bbe8d8f0
LC
168 (sha256 hash)))))
169 `(("bzip2" ,bzip2)
2d195e67 170 ("gzip" ,gzip)
6e6ddebf 171 ("zlib" ,zlib) ;for 'guix publish'
2d195e67 172
bbe8d8f0
LC
173 ("sqlite" ,sqlite)
174 ("libgcrypt" ,libgcrypt)
175 ("guile" ,guile-2.0)
bbe8d8f0
LC
176
177 ("boot-guile/i686"
178 ,(boot-guile "i686"
179 (base32
8a43ff10 180 "0im800m30abgh7msh331pcbjvb4n02smz5cfzf1srv0kpx3csmxp")))
bbe8d8f0
LC
181 ("boot-guile/x86_64"
182 ,(boot-guile "x86_64"
183 (base32
8a43ff10
LC
184 "1w2p5zyrglzzniqgvyn1b55vprfzhgk8vzbzkkbdgl5248si0yq3")))
185 ("boot-guile/mips64el"
186 ,(boot-guile "mips64el"
187 (base32
39de700c
LC
188 "0fzp93lvi0hn54acc0fpvhc7bvl0yc853k62l958cihk03q80ilr")))
189 ("boot-guile/armhf"
190 ,(boot-guile "armhf"
191 (base32
192 "1mi3brl7l58aww34rawhvja84xc7l1b4hmwdmc36fp9q9mfx0lg5"))))))
f1082ec1 193 (propagated-inputs
45cbe390
TUBK
194 `(("gnutls" ,gnutls) ;for 'guix download' & co.
195 ("guile-json" ,guile-json)
e446182e
AK
196 ("geiser" ,geiser) ;for guix.el
197 ("emacs-magit-popup" ,emacs-magit-popup))) ;for "M-x guix" command
f1082ec1 198
bbe8d8f0 199 (home-page "http://www.gnu.org/software/guix")
79c311b8 200 (synopsis "Functional package manager for installed software packages and versions")
bbe8d8f0 201 (description
79c311b8 202 "GNU Guix is a functional package manager for the GNU system, and is
c5779c93 203also a distribution thereof. It includes a virtual machine image. Besides
79c311b8 204the usual package management features, it also supports transactional
c5779c93
LC
205upgrades and roll-backs, per-user profiles, and much more. It is based on
206the Nix package manager.")
63e8bb12
LC
207 (license gpl3+)
208 (properties '((ftp-server . "alpha.gnu.org")))))
30f25b03 209
3ad9a0b1 210(define guix-devel
480af4d6 211 ;; Development version of Guix.
1dccdb75 212 ;;
a2da8c17
LC
213 ;; Note: use a very short commit id; with a longer one, the limit on
214 ;; hash-bang lines would be exceeded while running the tests.
95af24a2 215 (let ((commit "97c8aef15de89799ac01b62dd9b91245c23eefcb"))
58f0aae5 216 (package (inherit guix-0.10.0)
fd6830b3 217 (version (string-append "0.10.0-1." (string-take commit 4)))
480af4d6
LC
218 (source (origin
219 (method git-fetch)
220 (uri (git-reference
52e1defe
LC
221 ;; "git://git.sv.gnu.org/guix.git" temporarily
222 ;; unavailable (XXX).
223 (url "http://git.savannah.gnu.org/r/guix.git")
2e69dd8c 224 (commit commit)))
480af4d6
LC
225 (sha256
226 (base32
95af24a2 227 "0sdxq87mbvig7785gzf52ywmvl3p1q1qgsczmkzrlw988xkma1dr"))
e21adc76 228 (file-name (string-append "guix-" version "-checkout"))))
480af4d6 229 (arguments
58f0aae5 230 (substitute-keyword-arguments (package-arguments guix-0.10.0)
c56ab21b
LC
231 ((#:configure-flags flags)
232 ;; Set 'DOT_USER_PROGRAM' to the empty string so we don't keep a
233 ;; reference to Graphviz, whose closure is pretty big (too big for
234 ;; the GuixSD installation image.)
235 `(cons "ac_cv_path_DOT_USER_PROGRAM=dot" ,flags))
480af4d6 236 ((#:phases phases)
b93c1d9d
MW
237 `(modify-phases ,phases
238 (add-after
239 'unpack 'bootstrap
240 (lambda _
241 ;; Make sure 'msgmerge' can modify the PO files.
242 (for-each (lambda (po)
243 (chmod po #o666))
244 (find-files "." "\\.po$"))
480af4d6 245
34582b30 246 (zero? (system* "sh" "bootstrap"))))))))
480af4d6
LC
247 (native-inputs
248 `(("autoconf" ,(autoconf-wrapper))
249 ("automake" ,automake)
250 ("gettext" ,gnu-gettext)
251 ("texinfo" ,texinfo)
252 ("graphviz" ,graphviz)
e21adc76 253 ("help2man" ,help2man)
58f0aae5 254 ,@(package-native-inputs guix-0.10.0))))))
3ad9a0b1 255
f98b48dc 256(define-public guix guix-devel)
fcb0109d 257
04eb0fab
LC
258(define (source-file? file stat)
259 "Return true if FILE is likely a source file, false if it is a typical
260generated file."
261 (define (wrong-extension? file)
262 (or (string-suffix? "~" file)
263 (member (file-extension file)
264 '("o" "a" "lo" "so" "go"))))
265
266 (match (basename file)
267 ((or ".git" "autom4te.cache" "configure" "Makefile" "Makefile.in" ".libs")
268 #f)
269 ((? wrong-extension?)
270 #f)
271 (_
272 #t)))
273
274(define (make-git-predicate directory)
275 "Return a predicate that returns true if a file is part of the Git checkout
276living at DIRECTORY. Upon Git failure, return #f instead of a predicate."
277 (define (parent-directory? thing directory)
278 ;; Return #t if DIRECTORY is the parent of THING.
279 (or (string-suffix? thing directory)
280 (and (string-index thing #\/)
281 (parent-directory? (dirname thing) directory))))
282
283 (let* ((pipe (with-directory-excursion directory
284 (open-pipe* OPEN_READ "git" "ls-files")))
285 (files (let loop ((lines '()))
286 (match (read-line pipe)
287 ((? eof-object?)
288 (reverse lines))
289 (line
290 (loop (cons line lines))))))
291 (status (close-pipe pipe)))
292 (and (zero? status)
293 (lambda (file stat)
294 (match (stat:type stat)
295 ('directory
296 ;; 'git ls-files' does not list directories, only regular files,
297 ;; so we need this special trick.
298 (any (cut parent-directory? <> file) files))
299 ((or 'regular 'symlink)
300 (any (cut string-suffix? <> file) files))
301 (_
302 #f))))))
303
304(define-public current-guix
305 (let ((select? (delay (or (make-git-predicate
306 (string-append (current-source-directory)
307 "/../.."))
308 source-file?))))
309 (lambda ()
310 "Return a package representing Guix built from the current source tree.
311This works by adding the current source tree to the store (after filtering it
312out) and returning a package that uses that as its 'source'."
313 (package
314 (inherit guix)
315 (version (string-append (package-version guix) "+"))
316 (source (local-file "../.." "guix-current"
317 #:recursive? #t
318 #:select? (force select?)))))))
319
320\f
321;;;
322;;; Other tools.
323;;;
324
fcb0109d
LC
325(define-public nix
326 (package
327 (name "nix")
56f5f921 328 (version "1.11.2")
fcb0109d
LC
329 (source (origin
330 (method url-fetch)
331 (uri (string-append "http://nixos.org/releases/nix/nix-"
332 version "/nix-" version ".tar.xz"))
333 (sha256
334 (base32
56f5f921 335 "1mk9z75gklxcv6kzwwz1h5r2ci5kjy6bh7qwk4m5lf5v9s0k64pw"))))
fcb0109d
LC
336 (build-system gnu-build-system)
337 ;; XXX: Should we pass '--with-store-dir=/gnu/store'? But then we'd also
338 ;; need '--localstatedir=/var'. But then! The thing would use /var/nix
339 ;; instead of /var/guix. So in the end, we do nothing special.
9083788a
SB
340 (arguments
341 '(#:configure-flags
342 ;; Set the prefixes of Perl libraries to avoid propagation.
343 (let ((perl-libdir (lambda (p)
344 (string-append
345 (assoc-ref %build-inputs p)
346 "/lib/perl5/site_perl"))))
347 (list (string-append "--with-dbi="
348 (perl-libdir "perl-dbi"))
349 (string-append "--with-dbd-sqlite="
350 (perl-libdir "perl-dbd-sqlite"))
351 (string-append "--with-www-curl="
352 (perl-libdir "perl-www-curl"))))))
fcb0109d
LC
353 (native-inputs `(("perl" ,perl)
354 ("pkg-config" ,pkg-config)))
355 (inputs `(("curl" ,curl)
356 ("openssl" ,openssl)
357 ("libgc" ,libgc)
358 ("sqlite" ,sqlite)
9083788a
SB
359 ("bzip2" ,bzip2)
360 ("perl-www-curl" ,perl-www-curl)
361 ("perl-dbi" ,perl-dbi)
362 ("perl-dbd-sqlite" ,perl-dbd-sqlite)))
fcb0109d
LC
363 (home-page "http://nixos.org/nix/")
364 (synopsis "The Nix package manager")
365 (description
366 "Nix is a purely functional package manager. This means that it treats
367packages like values in purely functional programming languages such as
368Haskell—they are built by functions that don't have side-effects, and they
369never change after they have been built. Nix stores packages in the Nix
370store, usually the directory /nix/store, where each package has its own unique
371sub-directory.")
372 (license lgpl2.1+)))
8d422e25
RW
373
374(define-public stow
375 (package
376 (name "stow")
ddfd70da 377 (version "2.2.2")
8d422e25
RW
378 (source (origin
379 (method url-fetch)
380 (uri (string-append "mirror://gnu/stow/stow-"
381 version ".tar.gz"))
382 (sha256
383 (base32
ddfd70da 384 "1pvky9fayms4r6fhns8jd0vavszd7d979w62vfd5n88v614pdxz2"))))
8d422e25
RW
385 (build-system gnu-build-system)
386 (inputs
387 `(("perl" ,perl)))
388 (native-inputs
389 `(("perl-test-simple" ,perl-test-simple)
390 ("perl-test-output" ,perl-test-output)
ddfd70da
LC
391 ("perl-capture-tiny" ,perl-capture-tiny)
392 ("perl-io-stringy" ,perl-io-stringy)))
8d422e25
RW
393 (home-page "https://www.gnu.org/software/stow/")
394 (synopsis "Managing installed software packages")
395 (description
396 "GNU Stow is a symlink manager. It generates symlinks to directories
397of data and makes them appear to be merged into the same directory. It is
398typically used for managing software packages installed from source, by
399letting you install them apart in distinct directories and then create
400symlinks to the files in a common directory such as /usr/local.")
401 (license gpl2+)))
e3e1ecf6
LC
402
403(define-public rpm
404 (package
405 (name "rpm")
41019e9f 406 (version "4.12.0.1")
e3e1ecf6
LC
407 (source (origin
408 (method url-fetch)
409 (uri (string-append "http://rpm.org/releases/rpm-4.12.x/rpm-"
410 version ".tar.bz2"))
411 (sha256
412 (base32
65da8dd0
LF
413 "0a82ym8phx7g0f3k6smvxnvzh7yv857l42xafk49689kzhld5pbp"))
414 (patches (search-patches "rpm-CVE-2014-8118.patch"))))
e3e1ecf6
LC
415 (build-system gnu-build-system)
416 (arguments
417 '(#:configure-flags '("--with-external-db" ;use the system's bdb
418 "--enable-python"
419 "--without-lua")
420 #:phases (modify-phases %standard-phases
421 (add-before 'configure 'set-nspr-search-path
422 (lambda* (#:key inputs #:allow-other-keys)
423 ;; nspr.pc contains the right -I flag pointing to
424 ;; 'include/nspr', but unfortunately 'configure' doesn't
425 ;; use 'pkg-config'. Thus, augment CPATH.
426 ;; Likewise for NSS.
427 (let ((nspr (assoc-ref inputs "nspr"))
428 (nss (assoc-ref inputs "nss")))
429 (setenv "CPATH"
e8e2e18b 430 (string-append (getenv "C_INCLUDE_PATH") ":"
e3e1ecf6
LC
431 nspr "/include/nspr:"
432 nss "/include/nss"))
433 (setenv "LIBRARY_PATH"
434 (string-append (getenv "LIBRARY_PATH") ":"
435 nss "/lib/nss"))
436 #t)))
437 (add-after 'install 'fix-rpm-symlinks
438 (lambda* (#:key outputs #:allow-other-keys)
439 ;; 'make install' gets these symlinks wrong. Fix them.
440 (let* ((out (assoc-ref outputs "out"))
441 (bin (string-append out "/bin")))
442 (with-directory-excursion bin
443 (for-each (lambda (file)
444 (delete-file file)
445 (symlink "rpm" file))
446 '("rpmquery" "rpmverify"))
447 #t)))))))
448 (native-inputs
449 `(("pkg-config" ,pkg-config)))
450 (inputs
451 `(("python" ,python-2)
452 ("xz" ,xz)
453 ("bdb" ,bdb)
454 ("popt" ,popt)
455 ("nss" ,nss)
456 ("nspr" ,nspr)
457 ("libarchive" ,libarchive)
458 ("nettle" ,nettle) ;XXX: actually a dependency of libarchive
459 ("file" ,file)
460 ("bzip2" ,bzip2)
461 ("zlib" ,zlib)
462 ("cpio" ,cpio)))
463 (home-page "http://www.rpm.org/")
464 (synopsis "The RPM Package Manager")
465 (description
466 "The RPM Package Manager (RPM) is a command-line driven package
467management system capable of installing, uninstalling, verifying, querying,
468and updating computer software packages. Each software package consists of an
469archive of files along with information about the package like its version, a
470description. There is also a library permitting developers to manage such
471transactions from C or Python.")
472
473 ;; The whole is GPLv2+; librpm itself is dual-licensed LGPLv2+ | GPLv2+.
474 (license gpl2+)))
475
08dcff47
LC
476(define-public diffoscope
477 (package
478 (name "diffoscope")
e538a245 479 (version "54")
08dcff47 480 (source (origin
7dd21101
LF
481 (method url-fetch)
482 (uri (pypi-uri name version))
08dcff47
LC
483 (sha256
484 (base32
e538a245 485 "1dv46ywzcll3mlqgvr48mq7rncizfvsic62c6dd2kdhynb22087n"))))
08dcff47
LC
486 (build-system python-build-system)
487 (arguments
7dd21101
LF
488 `(#:phases (modify-phases %standard-phases
489 ;; setup.py mistakenly requires python-magic from PyPi, even
490 ;; though the Python bindings of `file` are sufficient.
491 ;; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815844
492 (add-after 'unpack 'dependency-on-python-magic
493 (lambda _
494 (substitute* "setup.py"
495 (("'python-magic',") ""))))
08dcff47
LC
496 (add-before 'build 'disable-egg-zipping
497 (lambda _
498 ;; Leave the .egg file uncompressed.
499 (let ((port (open-file "setup.cfg" "a")))
500 (display "\n[easy_install]\nzip_ok = 0\n"
501 port)
502 (close-port port)
7dd21101 503 #t))))))
08dcff47 504 (inputs `(("rpm" ,rpm) ;for rpm-python
7dd21101
LF
505 ("python-file" ,python-file)
506 ("python-debian" ,python-debian)
507 ("python-libarchive-c" ,python-libarchive-c)
508 ("python-tlsh" ,python-tlsh)
08dcff47
LC
509
510 ;; Below are modules used for tests.
7dd21101
LF
511 ("python-pytest" ,python-pytest)
512 ("python-chardet" ,python-chardet)))
08dcff47
LC
513 (home-page "http://diffoscope.org/")
514 (synopsis "Compare files, archives, and directories in depth")
515 (description
516 "Diffoscope tries to get to the bottom of what makes files or directories
517different. It recursively unpacks archives of many kinds and transforms
518various binary formats into more human readable forms to compare them. It can
519compare two tarballs, ISO images, or PDFs just as easily.")
520 (license gpl3+)))