gnu: mariadb: Update to 10.1.20.
[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)
a7fd7b68 47 #:use-module (gnu packages bdw-gc)
e3e1ecf6
LC
48 #:use-module (gnu packages python)
49 #:use-module (gnu packages popt)
50 #:use-module (gnu packages gnuzilla)
51 #:use-module (gnu packages cpio)
04eb0fab 52 #:use-module (gnu packages tls)
43ddcd72 53 #:use-module (gnu packages ssh)
04eb0fab
LC
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
c8e2219c 70(define-public guix-0.12.0
bbe8d8f0
LC
71 (package
72 (name "guix")
c8e2219c 73 (version "0.12.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
c8e2219c 80 "1jgy5mlygmhxdqhrp6vr8w83ndcm5mk64xfravr8l2d7hq8y40b2"))))
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"
7af6ecab 123 (("^\\(test-(assert|equal) \"(clone|setns|pivot-root)\"" all)
5d09263b
LC
124 (string-append "(test-skip 1)\n" all)))
125 (substitute* "tests/containers.scm"
198eac2b 126 (("^\\(test-(assert|equal)" all)
5d09263b 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"))
43ddcd72 146 (ssh (assoc-ref inputs "guile-ssh"))
932e7204
LC
147 (gnutls (assoc-ref inputs "gnutls"))
148 (path (string-append
149 json "/share/guile/site/2.0:"
43ddcd72 150 ssh "/share/guile/site/2.0:"
932e7204 151 gnutls "/share/guile/site/2.0")))
61cdad35
LC
152
153 ;; Ignore user settings so that a bogus
154 ;; GUILE_LOAD_COMPILED_PATH does not prevent use of
155 ;; 'guix', notably when it contains entries pointing to
156 ;; incompatible .go files as reported at
157 ;; <https://lists.gnu.org/archive/html/guix-devel/2016-03/msg01261.html>.
932e7204 158 (wrap-program (string-append out "/bin/guix")
acbf2c4f 159 `("GUILE_LOAD_PATH" ":" prefix (,path))
61cdad35
LC
160 `("GUILE_LOAD_COMPILED_PATH" ":" = (,path)))
161
932e7204 162 #t))))))
b173d0e4 163 (native-inputs `(("pkg-config" ,pkg-config)
a7db8540
LC
164
165 ;; XXX: Keep the development inputs here even though
166 ;; they're unnecessary, just so that 'guix environment
167 ;; guix' always contains them.
168 ("autoconf" ,(autoconf-wrapper))
169 ("automake" ,automake)
7c90d0f4 170 ("gettext" ,gettext-minimal)
a7db8540
LC
171 ("texinfo" ,texinfo)
172 ("graphviz" ,graphviz)
173 ("help2man" ,help2man)))
bbe8d8f0
LC
174 (inputs
175 (let ((boot-guile (lambda (arch hash)
176 (origin
177 (method url-fetch)
39de700c 178 (uri (boot-guile-uri arch))
bbe8d8f0
LC
179 (sha256 hash)))))
180 `(("bzip2" ,bzip2)
2d195e67 181 ("gzip" ,gzip)
6e6ddebf 182 ("zlib" ,zlib) ;for 'guix publish'
2d195e67 183
bbe8d8f0
LC
184 ("sqlite" ,sqlite)
185 ("libgcrypt" ,libgcrypt)
186 ("guile" ,guile-2.0)
bbe8d8f0
LC
187
188 ("boot-guile/i686"
189 ,(boot-guile "i686"
190 (base32
8a43ff10 191 "0im800m30abgh7msh331pcbjvb4n02smz5cfzf1srv0kpx3csmxp")))
bbe8d8f0
LC
192 ("boot-guile/x86_64"
193 ,(boot-guile "x86_64"
194 (base32
8a43ff10
LC
195 "1w2p5zyrglzzniqgvyn1b55vprfzhgk8vzbzkkbdgl5248si0yq3")))
196 ("boot-guile/mips64el"
197 ,(boot-guile "mips64el"
198 (base32
39de700c
LC
199 "0fzp93lvi0hn54acc0fpvhc7bvl0yc853k62l958cihk03q80ilr")))
200 ("boot-guile/armhf"
201 ,(boot-guile "armhf"
202 (base32
203 "1mi3brl7l58aww34rawhvja84xc7l1b4hmwdmc36fp9q9mfx0lg5"))))))
f1082ec1 204 (propagated-inputs
45cbe390
TUBK
205 `(("gnutls" ,gnutls) ;for 'guix download' & co.
206 ("guile-json" ,guile-json)
deb6276d 207 ("guile-ssh" ,guile-ssh)))
f1082ec1 208
bbe8d8f0 209 (home-page "http://www.gnu.org/software/guix")
79c311b8 210 (synopsis "Functional package manager for installed software packages and versions")
bbe8d8f0 211 (description
79c311b8 212 "GNU Guix is a functional package manager for the GNU system, and is
c5779c93 213also a distribution thereof. It includes a virtual machine image. Besides
79c311b8 214the usual package management features, it also supports transactional
c5779c93
LC
215upgrades and roll-backs, per-user profiles, and much more. It is based on
216the Nix package manager.")
63e8bb12
LC
217 (license gpl3+)
218 (properties '((ftp-server . "alpha.gnu.org")))))
30f25b03 219
3ad9a0b1 220(define guix-devel
480af4d6 221 ;; Development version of Guix.
1dccdb75 222 ;;
a2da8c17
LC
223 ;; Note: use a very short commit id; with a longer one, the limit on
224 ;; hash-bang lines would be exceeded while running the tests.
7aa8785c 225 (let ((commit "b291b3271a025dfe41e1a7fdfadd393373b0128d"))
c8e2219c 226 (package (inherit guix-0.12.0)
7aa8785c 227 (version (string-append "0.12.0-2." (string-take commit 4)))
480af4d6
LC
228 (source (origin
229 (method git-fetch)
230 (uri (git-reference
52e1defe
LC
231 ;; "git://git.sv.gnu.org/guix.git" temporarily
232 ;; unavailable (XXX).
233 (url "http://git.savannah.gnu.org/r/guix.git")
2e69dd8c 234 (commit commit)))
480af4d6
LC
235 (sha256
236 (base32
7aa8785c 237 "1hris387xn2wk4lcl20x1zyhiz96060w34xs1x13b4vmvkkvcpg4"))
e21adc76 238 (file-name (string-append "guix-" version "-checkout"))))
480af4d6 239 (arguments
c8e2219c 240 (substitute-keyword-arguments (package-arguments guix-0.12.0)
c56ab21b
LC
241 ((#:configure-flags flags)
242 ;; Set 'DOT_USER_PROGRAM' to the empty string so we don't keep a
243 ;; reference to Graphviz, whose closure is pretty big (too big for
244 ;; the GuixSD installation image.)
245 `(cons "ac_cv_path_DOT_USER_PROGRAM=dot" ,flags))
480af4d6 246 ((#:phases phases)
b93c1d9d
MW
247 `(modify-phases ,phases
248 (add-after
249 'unpack 'bootstrap
250 (lambda _
251 ;; Make sure 'msgmerge' can modify the PO files.
252 (for-each (lambda (po)
253 (chmod po #o666))
254 (find-files "." "\\.po$"))
480af4d6 255
a7db8540 256 (zero? (system* "sh" "bootstrap")))))))))))
3ad9a0b1 257
62a31793 258(define-public guix guix-devel)
fcb0109d 259
04eb0fab
LC
260(define (source-file? file stat)
261 "Return true if FILE is likely a source file, false if it is a typical
262generated file."
263 (define (wrong-extension? file)
264 (or (string-suffix? "~" file)
265 (member (file-extension file)
266 '("o" "a" "lo" "so" "go"))))
267
268 (match (basename file)
269 ((or ".git" "autom4te.cache" "configure" "Makefile" "Makefile.in" ".libs")
270 #f)
271 ((? wrong-extension?)
272 #f)
273 (_
274 #t)))
275
276(define (make-git-predicate directory)
277 "Return a predicate that returns true if a file is part of the Git checkout
278living at DIRECTORY. Upon Git failure, return #f instead of a predicate."
279 (define (parent-directory? thing directory)
280 ;; Return #t if DIRECTORY is the parent of THING.
281 (or (string-suffix? thing directory)
282 (and (string-index thing #\/)
283 (parent-directory? (dirname thing) directory))))
284
285 (let* ((pipe (with-directory-excursion directory
286 (open-pipe* OPEN_READ "git" "ls-files")))
287 (files (let loop ((lines '()))
288 (match (read-line pipe)
289 ((? eof-object?)
290 (reverse lines))
291 (line
292 (loop (cons line lines))))))
293 (status (close-pipe pipe)))
294 (and (zero? status)
295 (lambda (file stat)
296 (match (stat:type stat)
297 ('directory
298 ;; 'git ls-files' does not list directories, only regular files,
299 ;; so we need this special trick.
300 (any (cut parent-directory? <> file) files))
301 ((or 'regular 'symlink)
302 (any (cut string-suffix? <> file) files))
303 (_
304 #f))))))
305
306(define-public current-guix
307 (let ((select? (delay (or (make-git-predicate
308 (string-append (current-source-directory)
309 "/../.."))
310 source-file?))))
311 (lambda ()
312 "Return a package representing Guix built from the current source tree.
313This works by adding the current source tree to the store (after filtering it
314out) and returning a package that uses that as its 'source'."
315 (package
316 (inherit guix)
317 (version (string-append (package-version guix) "+"))
318 (source (local-file "../.." "guix-current"
319 #:recursive? #t
320 #:select? (force select?)))))))
321
322\f
323;;;
324;;; Other tools.
325;;;
326
fcb0109d
LC
327(define-public nix
328 (package
329 (name "nix")
56f5f921 330 (version "1.11.2")
fcb0109d
LC
331 (source (origin
332 (method url-fetch)
333 (uri (string-append "http://nixos.org/releases/nix/nix-"
334 version "/nix-" version ".tar.xz"))
335 (sha256
336 (base32
56f5f921 337 "1mk9z75gklxcv6kzwwz1h5r2ci5kjy6bh7qwk4m5lf5v9s0k64pw"))))
fcb0109d
LC
338 (build-system gnu-build-system)
339 ;; XXX: Should we pass '--with-store-dir=/gnu/store'? But then we'd also
340 ;; need '--localstatedir=/var'. But then! The thing would use /var/nix
341 ;; instead of /var/guix. So in the end, we do nothing special.
9083788a
SB
342 (arguments
343 '(#:configure-flags
344 ;; Set the prefixes of Perl libraries to avoid propagation.
345 (let ((perl-libdir (lambda (p)
346 (string-append
347 (assoc-ref %build-inputs p)
348 "/lib/perl5/site_perl"))))
349 (list (string-append "--with-dbi="
350 (perl-libdir "perl-dbi"))
351 (string-append "--with-dbd-sqlite="
352 (perl-libdir "perl-dbd-sqlite"))
353 (string-append "--with-www-curl="
354 (perl-libdir "perl-www-curl"))))))
fcb0109d
LC
355 (native-inputs `(("perl" ,perl)
356 ("pkg-config" ,pkg-config)))
357 (inputs `(("curl" ,curl)
358 ("openssl" ,openssl)
359 ("libgc" ,libgc)
360 ("sqlite" ,sqlite)
9083788a
SB
361 ("bzip2" ,bzip2)
362 ("perl-www-curl" ,perl-www-curl)
363 ("perl-dbi" ,perl-dbi)
364 ("perl-dbd-sqlite" ,perl-dbd-sqlite)))
fcb0109d
LC
365 (home-page "http://nixos.org/nix/")
366 (synopsis "The Nix package manager")
367 (description
368 "Nix is a purely functional package manager. This means that it treats
369packages like values in purely functional programming languages such as
370Haskell—they are built by functions that don't have side-effects, and they
371never change after they have been built. Nix stores packages in the Nix
372store, usually the directory /nix/store, where each package has its own unique
373sub-directory.")
374 (license lgpl2.1+)))
8d422e25
RW
375
376(define-public stow
377 (package
378 (name "stow")
ddfd70da 379 (version "2.2.2")
8d422e25
RW
380 (source (origin
381 (method url-fetch)
382 (uri (string-append "mirror://gnu/stow/stow-"
383 version ".tar.gz"))
384 (sha256
385 (base32
ddfd70da 386 "1pvky9fayms4r6fhns8jd0vavszd7d979w62vfd5n88v614pdxz2"))))
8d422e25
RW
387 (build-system gnu-build-system)
388 (inputs
389 `(("perl" ,perl)))
390 (native-inputs
391 `(("perl-test-simple" ,perl-test-simple)
392 ("perl-test-output" ,perl-test-output)
ddfd70da
LC
393 ("perl-capture-tiny" ,perl-capture-tiny)
394 ("perl-io-stringy" ,perl-io-stringy)))
8d422e25
RW
395 (home-page "https://www.gnu.org/software/stow/")
396 (synopsis "Managing installed software packages")
397 (description
398 "GNU Stow is a symlink manager. It generates symlinks to directories
399of data and makes them appear to be merged into the same directory. It is
400typically used for managing software packages installed from source, by
401letting you install them apart in distinct directories and then create
402symlinks to the files in a common directory such as /usr/local.")
403 (license gpl2+)))
e3e1ecf6
LC
404
405(define-public rpm
406 (package
407 (name "rpm")
41019e9f 408 (version "4.12.0.1")
e3e1ecf6
LC
409 (source (origin
410 (method url-fetch)
411 (uri (string-append "http://rpm.org/releases/rpm-4.12.x/rpm-"
412 version ".tar.bz2"))
413 (sha256
414 (base32
65da8dd0
LF
415 "0a82ym8phx7g0f3k6smvxnvzh7yv857l42xafk49689kzhld5pbp"))
416 (patches (search-patches "rpm-CVE-2014-8118.patch"))))
e3e1ecf6
LC
417 (build-system gnu-build-system)
418 (arguments
419 '(#:configure-flags '("--with-external-db" ;use the system's bdb
420 "--enable-python"
421 "--without-lua")
422 #:phases (modify-phases %standard-phases
423 (add-before 'configure 'set-nspr-search-path
424 (lambda* (#:key inputs #:allow-other-keys)
425 ;; nspr.pc contains the right -I flag pointing to
426 ;; 'include/nspr', but unfortunately 'configure' doesn't
427 ;; use 'pkg-config'. Thus, augment CPATH.
428 ;; Likewise for NSS.
429 (let ((nspr (assoc-ref inputs "nspr"))
430 (nss (assoc-ref inputs "nss")))
431 (setenv "CPATH"
e8e2e18b 432 (string-append (getenv "C_INCLUDE_PATH") ":"
e3e1ecf6
LC
433 nspr "/include/nspr:"
434 nss "/include/nss"))
435 (setenv "LIBRARY_PATH"
436 (string-append (getenv "LIBRARY_PATH") ":"
437 nss "/lib/nss"))
438 #t)))
439 (add-after 'install 'fix-rpm-symlinks
440 (lambda* (#:key outputs #:allow-other-keys)
441 ;; 'make install' gets these symlinks wrong. Fix them.
442 (let* ((out (assoc-ref outputs "out"))
443 (bin (string-append out "/bin")))
444 (with-directory-excursion bin
445 (for-each (lambda (file)
446 (delete-file file)
447 (symlink "rpm" file))
448 '("rpmquery" "rpmverify"))
449 #t)))))))
450 (native-inputs
451 `(("pkg-config" ,pkg-config)))
452 (inputs
453 `(("python" ,python-2)
454 ("xz" ,xz)
455 ("bdb" ,bdb)
456 ("popt" ,popt)
457 ("nss" ,nss)
458 ("nspr" ,nspr)
459 ("libarchive" ,libarchive)
460 ("nettle" ,nettle) ;XXX: actually a dependency of libarchive
461 ("file" ,file)
462 ("bzip2" ,bzip2)
463 ("zlib" ,zlib)
464 ("cpio" ,cpio)))
465 (home-page "http://www.rpm.org/")
466 (synopsis "The RPM Package Manager")
467 (description
468 "The RPM Package Manager (RPM) is a command-line driven package
469management system capable of installing, uninstalling, verifying, querying,
470and updating computer software packages. Each software package consists of an
471archive of files along with information about the package like its version, a
472description. There is also a library permitting developers to manage such
473transactions from C or Python.")
474
475 ;; The whole is GPLv2+; librpm itself is dual-licensed LGPLv2+ | GPLv2+.
476 (license gpl2+)))
477
08dcff47
LC
478(define-public diffoscope
479 (package
480 (name "diffoscope")
b245f758 481 (version "63")
08dcff47 482 (source (origin
7dd21101
LF
483 (method url-fetch)
484 (uri (pypi-uri name version))
08dcff47
LC
485 (sha256
486 (base32
b245f758 487 "12q5d2nszql1g4jf2ss863v0wpvvhrkaivqzhy6af9m9zwvw0p0k"))))
08dcff47
LC
488 (build-system python-build-system)
489 (arguments
7dd21101
LF
490 `(#:phases (modify-phases %standard-phases
491 ;; setup.py mistakenly requires python-magic from PyPi, even
492 ;; though the Python bindings of `file` are sufficient.
493 ;; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815844
494 (add-after 'unpack 'dependency-on-python-magic
495 (lambda _
496 (substitute* "setup.py"
b245f758 497 (("'python-magic',") "")))))))
08dcff47 498 (inputs `(("rpm" ,rpm) ;for rpm-python
7dd21101
LF
499 ("python-file" ,python-file)
500 ("python-debian" ,python-debian)
501 ("python-libarchive-c" ,python-libarchive-c)
502 ("python-tlsh" ,python-tlsh)
08dcff47
LC
503
504 ;; Below are modules used for tests.
7dd21101
LF
505 ("python-pytest" ,python-pytest)
506 ("python-chardet" ,python-chardet)))
08dcff47
LC
507 (home-page "http://diffoscope.org/")
508 (synopsis "Compare files, archives, and directories in depth")
509 (description
510 "Diffoscope tries to get to the bottom of what makes files or directories
511different. It recursively unpacks archives of many kinds and transforms
512various binary formats into more human readable forms to compare them. It can
513compare two tarballs, ISO images, or PDFs just as easily.")
514 (license gpl3+)))