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