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