gnu: Add python-black.
[jackhill/guix/guix.git] / gnu / packages / package-management.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015, 2017 Ricardo Wurmus <rekado@elephly.net>
4 ;;; Copyright © 2017 Muriithi Frederick Muriuki <fredmanglis@gmail.com>
5 ;;; Copyright © 2017, 2018 Oleg Pykhalov <go.wigust@gmail.com>
6 ;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
7 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
8 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
9 ;;; Copyright © 2018 Rutger Helling <rhelling@mykolab.com>
10 ;;; Copyright © 2018 Sou Bunnbu <iyzsong@member.fsf.org>
11 ;;;
12 ;;; This file is part of GNU Guix.
13 ;;;
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
18 ;;;
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
23 ;;;
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27 (define-module (gnu packages package-management)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages acl)
30 #:use-module (gnu packages attr)
31 #:use-module (gnu packages avahi)
32 #:use-module (gnu packages autotools)
33 #:use-module (gnu packages backup)
34 #:use-module (gnu packages bdw-gc)
35 #:use-module (gnu packages bison)
36 #:use-module (gnu packages bootstrap) ;for 'bootstrap-guile-origin'
37 #:use-module (gnu packages check)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages cpio)
40 #:use-module (gnu packages crypto)
41 #:use-module (gnu packages curl)
42 #:use-module (gnu packages databases)
43 #:use-module (gnu packages docbook)
44 #:use-module (gnu packages emacs)
45 #:use-module (gnu packages file)
46 #:use-module (gnu packages gettext)
47 #:use-module (gnu packages glib)
48 #:use-module (gnu packages gnome)
49 #:use-module (gnu packages gnupg)
50 #:use-module (gnu packages gnuzilla)
51 #:use-module (gnu packages graphviz)
52 #:use-module (gnu packages guile)
53 #:use-module (gnu packages linux)
54 #:use-module (gnu packages lisp)
55 #:use-module (gnu packages man)
56 #:use-module (gnu packages nettle)
57 #:use-module (gnu packages patchutils)
58 #:use-module (gnu packages perl)
59 #:use-module (gnu packages perl-check)
60 #:use-module (gnu packages pkg-config)
61 #:use-module (gnu packages popt)
62 #:use-module (gnu packages python)
63 #:use-module (gnu packages python-web)
64 #:use-module (gnu packages serialization)
65 #:use-module (gnu packages ssh)
66 #:use-module (gnu packages texinfo)
67 #:use-module (gnu packages time)
68 #:use-module (gnu packages tls)
69 #:use-module (gnu packages vim)
70 #:use-module (gnu packages web)
71 #:use-module (gnu packages xml)
72 #:use-module (guix build-system emacs)
73 #:use-module (guix build-system gnu)
74 #:use-module (guix build-system meson)
75 #:use-module (guix build-system python)
76 #:use-module (guix download)
77 #:use-module (guix gexp)
78 #:use-module (guix git-download)
79 #:use-module ((guix licenses) #:prefix license:)
80 #:use-module (guix packages)
81 #:use-module (guix utils)
82 #:use-module (ice-9 match)
83 #:use-module (srfi srfi-1))
84
85 (define (boot-guile-uri arch)
86 "Return the URI for the bootstrap Guile tarball for ARCH."
87 (cond ((string=? "armhf" arch)
88 (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
89 arch "-linux"
90 "/20150101/guile-2.0.11.tar.xz"))
91 ((string=? "aarch64" arch)
92 (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
93 arch "-linux/20170217/guile-2.0.14.tar.xz"))
94 (else
95 (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
96 arch "-linux"
97 "/20131110/guile-2.0.9.tar.xz"))))
98
99 (define-public guix
100 ;; Latest version of Guix, which may or may not correspond to a release.
101 ;; Note: the 'update-guix-package.scm' script expects this definition to
102 ;; start precisely like this.
103 (let ((version "0.15.0")
104 (commit "3d43017026f9995ad128915db8ca5eafe061bf75")
105 (revision 3))
106 (package
107 (name "guix")
108
109 (version (if (zero? revision)
110 version
111 (string-append version "-"
112 (number->string revision)
113 "." (string-take commit 7))))
114 (source (origin
115 (method git-fetch)
116 (uri (git-reference
117 (url "https://git.savannah.gnu.org/r/guix.git")
118 (commit commit)))
119 (sha256
120 (base32
121 "167rzz2h33xmmchkplwzfq94s5jwdn5nabsq2lb84s54ps0sm89m"))
122 (file-name (string-append "guix-" version "-checkout"))))
123 (build-system gnu-build-system)
124 (arguments
125 `(#:configure-flags (list
126 "--localstatedir=/var"
127 "--sysconfdir=/etc"
128 (string-append "--with-bash-completion-dir="
129 (assoc-ref %outputs "out")
130 "/etc/bash_completion.d")
131 (string-append "--with-libgcrypt-prefix="
132 (assoc-ref %build-inputs
133 "libgcrypt"))
134
135 ;; Set 'DOT_USER_PROGRAM' to the empty string so
136 ;; we don't keep a reference to Graphviz, whose
137 ;; closure is pretty big (too big for the GuixSD
138 ;; installation image.)
139 "ac_cv_path_DOT_USER_PROGRAM=dot"
140
141 ;; To avoid problems with the length of shebangs,
142 ;; choose a fixed-width and short directory name
143 ;; for tests.
144 "ac_cv_guix_test_root=/tmp/guix-tests")
145 #:parallel-tests? #f ;work around <http://bugs.gnu.org/21097>
146
147 #:modules ((guix build gnu-build-system)
148 (guix build utils)
149 (srfi srfi-26)
150 (ice-9 popen)
151 (ice-9 rdelim))
152
153 #:phases (modify-phases %standard-phases
154 (replace 'bootstrap
155 (lambda _
156 ;; Make sure 'msgmerge' can modify the PO files.
157 (for-each (lambda (po)
158 (chmod po #o666))
159 (find-files "." "\\.po$"))
160
161 (patch-shebang "build-aux/git-version-gen")
162
163 (call-with-output-file ".tarball-version"
164 (lambda (port)
165 (display ,version port)))
166
167 (invoke "sh" "bootstrap")))
168 (add-before 'check 'copy-bootstrap-guile
169 (lambda* (#:key system inputs #:allow-other-keys)
170 ;; Copy the bootstrap guile tarball in the store used
171 ;; by the test suite.
172 (define (intern tarball)
173 (let ((base (strip-store-file-name tarball)))
174 (copy-file tarball base)
175 (invoke "./test-env" "guix" "download"
176 (string-append "file://" (getcwd)
177 "/" base))
178 (delete-file base)))
179
180
181 (intern (assoc-ref inputs "boot-guile"))
182
183 ;; On x86_64 some tests need the i686 Guile.
184 ,@(if (and (not (%current-target-system))
185 (string=? (%current-system)
186 "x86_64-linux"))
187 '((intern (assoc-ref inputs "boot-guile/i686")))
188 '())
189 #t))
190 (add-after 'unpack 'disable-failing-tests
191 ;; XXX FIXME: These tests fail within the build container.
192 (lambda _
193 (substitute* "tests/syscalls.scm"
194 (("^\\(test-(assert|equal) \"(clone|setns|pivot-root)\"" all)
195 (string-append "(test-skip 1)\n" all)))
196 (substitute* "tests/containers.scm"
197 (("^\\(test-(assert|equal)" all)
198 (string-append "(test-skip 1)\n" all)))
199 (when (file-exists? "tests/guix-environment-container.sh")
200 (substitute* "tests/guix-environment-container.sh"
201 (("guix environment --version")
202 "exit 77\n")))
203 #t))
204 (add-before 'check 'set-SHELL
205 (lambda _
206 ;; 'guix environment' tests rely on 'SHELL' having a
207 ;; correct value, so set it.
208 (setenv "SHELL" (which "sh"))
209 #t))
210 (add-after 'install 'wrap-program
211 (lambda* (#:key inputs outputs #:allow-other-keys)
212 ;; Make sure the 'guix' command finds GnuTLS,
213 ;; Guile-JSON, and Guile-Git automatically.
214 (let* ((out (assoc-ref outputs "out"))
215 (guile (assoc-ref inputs "guile"))
216 (gcrypt (assoc-ref inputs "guile-gcrypt"))
217 (json (assoc-ref inputs "guile-json"))
218 (sqlite (assoc-ref inputs "guile-sqlite3"))
219 (git (assoc-ref inputs "guile-git"))
220 (bs (assoc-ref inputs
221 "guile-bytestructures"))
222 (ssh (assoc-ref inputs "guile-ssh"))
223 (gnutls (assoc-ref inputs "gnutls"))
224 (deps (list gcrypt json sqlite gnutls
225 git bs ssh))
226 (effective
227 (read-line
228 (open-pipe* OPEN_READ
229 (string-append guile "/bin/guile")
230 "-c" "(display (effective-version))")))
231 (path (string-join
232 (map (cut string-append <>
233 "/share/guile/site/"
234 effective)
235 deps)
236 ":"))
237 (gopath (string-join
238 (map (cut string-append <>
239 "/lib/guile/" effective
240 "/site-ccache")
241 deps)
242 ":")))
243
244 (wrap-program (string-append out "/bin/guix")
245 `("GUILE_LOAD_PATH" ":" prefix (,path))
246 `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,gopath)))
247
248 #t))))))
249 (native-inputs `(("pkg-config" ,pkg-config)
250
251 ;; XXX: Keep the development inputs here even though
252 ;; they're unnecessary, just so that 'guix environment
253 ;; guix' always contains them.
254 ("autoconf" ,autoconf-wrapper)
255 ("automake" ,automake)
256 ("gettext" ,gettext-minimal)
257 ("texinfo" ,texinfo)
258 ("graphviz" ,graphviz)
259 ("help2man" ,help2man)
260 ("po4a" ,po4a)))
261 (inputs
262 `(("bzip2" ,bzip2)
263 ("gzip" ,gzip)
264 ("zlib" ,zlib) ;for 'guix publish'
265
266 ("sqlite" ,sqlite)
267 ("libgcrypt" ,libgcrypt)
268
269 ;; Use 2.2.4 to avoid various thread-safety issues while building
270 ;; code in parallel.
271 ("guile" ,guile-2.2.4)
272
273 ;; Many tests rely on the 'guile-bootstrap' package, which is why we
274 ;; have it here.
275 ("boot-guile" ,(bootstrap-guile-origin (%current-system)))
276 ;; Some of the tests use "unshare" when it is available.
277 ("util-linux" ,util-linux)
278 ,@(if (and (not (%current-target-system))
279 (string=? (%current-system) "x86_64-linux"))
280 `(("boot-guile/i686" ,(bootstrap-guile-origin "i686-linux")))
281 '())))
282 (propagated-inputs
283 `(("gnutls" ,gnutls)
284 ("guile-gcrypt" ,guile-gcrypt)
285 ("guile-json" ,guile-json)
286 ("guile-sqlite3" ,guile-sqlite3)
287 ("guile-ssh" ,guile-ssh)
288 ("guile-git" ,guile-git)))
289
290 (home-page "https://www.gnu.org/software/guix/")
291 (synopsis "Functional package manager for installed software packages and versions")
292 (description
293 "GNU Guix is a functional package manager for the GNU system, and is
294 also a distribution thereof. It includes a virtual machine image. Besides
295 the usual package management features, it also supports transactional
296 upgrades and roll-backs, per-user profiles, and much more. It is based on
297 the Nix package manager.")
298 (license license:gpl3+)
299 (properties '((ftp-server . "alpha.gnu.org"))))))
300
301 ;; Alias for backward compatibility.
302 (define-public guix-devel guix)
303
304 (define-public guix-daemon
305 ;; This package is for internal consumption: it allows us to quickly build
306 ;; the 'guix-daemon' program and use that in (guix self), used by 'guix
307 ;; pull'.
308 (package
309 (inherit guix)
310 (properties `((hidden? . #t)))
311 (name "guix-daemon")
312
313 ;; Use a minimum set of dependencies.
314 (native-inputs
315 (fold alist-delete (package-native-inputs guix)
316 '("po4a" "graphviz" "help2man")))
317 (inputs
318 `(("gnutls" ,gnutls)
319 ("guile-git" ,guile-git)
320 ("guile-gcrypt" ,guile-gcrypt)
321 ,@(fold alist-delete (package-inputs guix)
322 '("boot-guile" "boot-guile/i686" "util-linux"))))
323
324 (propagated-inputs '())
325
326 (arguments
327 (substitute-keyword-arguments (package-arguments guix)
328 ((#:configure-flags flags '())
329 ;; Pretend we have those libraries; we don't actually need them.
330 `(append ,flags
331 '("guix_cv_have_recent_guile_sqlite3=yes"
332 "guix_cv_have_recent_guile_ssh=yes")))
333 ((#:tests? #f #f)
334 #f)
335 ((#:phases phases '%standard-phases)
336 `(modify-phases ,phases
337 (replace 'build
338 (lambda _
339 (invoke "make" "nix/libstore/schema.sql.hh")
340 (invoke "make" "-j" (number->string
341 (parallel-job-count))
342 "guix-daemon")))
343 (delete 'copy-bootstrap-guile)
344 (replace 'install
345 (lambda* (#:key outputs #:allow-other-keys)
346 (invoke "make" "install-binPROGRAMS"
347 "install-nodist_pkglibexecSCRIPTS")
348
349 ;; We need to tell 'guix-daemon' which 'guix' command to use.
350 ;; Here we use a questionable hack where we hard-code
351 ;; "~root/.config", which could be wrong (XXX).
352 (let ((out (assoc-ref outputs "out")))
353 (substitute* (find-files (string-append out "/libexec"))
354 (("exec \".*/bin/guix\"")
355 "exec ~root/.config/guix/current/bin/guix"))
356 #t)))
357 (delete 'wrap-program)))))))
358
359 (define-public guile2.0-guix
360 (package
361 (inherit guix)
362 (name "guile2.0-guix")
363 (inputs
364 `(("guile" ,guile-2.0)
365 ,@(alist-delete "guile" (package-inputs guix))))
366 (propagated-inputs
367 `(("gnutls" ,gnutls/guile-2.0)
368 ("guile-json" ,guile2.0-json)
369 ("guile-ssh" ,guile2.0-ssh)
370 ("guile-git" ,guile2.0-git)))))
371
372 (define (source-file? file stat)
373 "Return true if FILE is likely a source file, false if it is a typical
374 generated file."
375 (define (wrong-extension? file)
376 (or (string-suffix? "~" file)
377 (member (file-extension file)
378 '("o" "a" "lo" "so" "go"))))
379
380 (match (basename file)
381 ((or ".git" "autom4te.cache" "configure" "Makefile" "Makefile.in" ".libs")
382 #f)
383 ((? wrong-extension?)
384 #f)
385 (_
386 #t)))
387
388 (define-public current-guix
389 (let* ((repository-root (canonicalize-path
390 (string-append (current-source-directory)
391 "/../..")))
392 (select? (delay (or (git-predicate repository-root)
393 source-file?))))
394 (lambda ()
395 "Return a package representing Guix built from the current source tree.
396 This works by adding the current source tree to the store (after filtering it
397 out) and returning a package that uses that as its 'source'."
398 (package
399 (inherit guix)
400 (version (string-append (package-version guix) "+"))
401 (source (local-file repository-root "guix-current"
402 #:recursive? #t
403 #:select? (force select?)))))))
404
405 \f
406 ;;;
407 ;;; Other tools.
408 ;;;
409
410 (define-public nix
411 (package
412 (name "nix")
413 (version "2.0.4")
414 (source (origin
415 (method url-fetch)
416 (uri (string-append "http://nixos.org/releases/nix/nix-"
417 version "/nix-" version ".tar.xz"))
418 (sha256
419 (base32
420 "0ss9svxlh1pvrdmnqjvjyqjmbqmrdbyfarvbb14i9d4bggzl0r8n"))))
421 (build-system gnu-build-system)
422 (native-inputs `(("pkg-config" ,pkg-config)))
423 (inputs `(("curl" ,curl)
424 ("bzip2" ,bzip2)
425 ("libgc" ,libgc)
426 ("libseccomp" ,libseccomp)
427 ("libsodium" ,libsodium)
428 ("openssl" ,openssl)
429 ("sqlite" ,sqlite)
430 ("xz" ,xz)))
431 (home-page "https://nixos.org/nix/")
432 (synopsis "The Nix package manager")
433 (description
434 "Nix is a purely functional package manager. This means that it treats
435 packages like values in purely functional programming languages such as
436 Haskell—they are built by functions that don't have side-effects, and they
437 never change after they have been built. Nix stores packages in the Nix
438 store, usually the directory /nix/store, where each package has its own unique
439 sub-directory.")
440 (license license:lgpl2.1+)))
441
442 (define-public emacs-nix-mode
443 (package
444 (name "emacs-nix-mode")
445 (version "1.2.2")
446 (source
447 (origin
448 (method url-fetch)
449 (uri (string-append "https://github.com/NixOS/nix-mode/archive/v"
450 version ".tar.gz"))
451 (file-name (string-append name "-" version ".tar.gz"))
452 (sha256
453 (base32
454 "06aqz0czznsj8835jqnk794sy2p6pa8kxfqwh0nl5d5vxivria6z"))))
455 (build-system emacs-build-system)
456 (inputs
457 `(("emacs-company" ,emacs-company)
458 ("emacs-mmm-mode" ,emacs-mmm-mode)))
459 (home-page "https://github.com/NixOS/nix-mode")
460 (synopsis "Emacs major mode for editing Nix expressions")
461 (description "@code{nixos-mode} provides an Emacs major mode for editing
462 Nix expressions. It supports syntax highlighting, indenting and refilling of
463 comments.")
464 (license license:lgpl2.1+)))
465
466 (define-public stow
467 (package
468 (name "stow")
469 (version "2.2.2")
470 (source (origin
471 (method url-fetch)
472 (uri (string-append "mirror://gnu/stow/stow-"
473 version ".tar.gz"))
474 (sha256
475 (base32
476 "1pvky9fayms4r6fhns8jd0vavszd7d979w62vfd5n88v614pdxz2"))))
477 (build-system gnu-build-system)
478 (inputs
479 `(("perl" ,perl)))
480 (native-inputs
481 `(("perl-test-simple" ,perl-test-simple)
482 ("perl-test-output" ,perl-test-output)
483 ("perl-capture-tiny" ,perl-capture-tiny)
484 ("perl-io-stringy" ,perl-io-stringy)))
485 (home-page "https://www.gnu.org/software/stow/")
486 (synopsis "Managing installed software packages")
487 (description
488 "GNU Stow is a symlink manager. It generates symlinks to directories
489 of data and makes them appear to be merged into the same directory. It is
490 typically used for managing software packages installed from source, by
491 letting you install them apart in distinct directories and then create
492 symlinks to the files in a common directory such as /usr/local.")
493 (license license:gpl2+)))
494
495 (define-public rpm
496 (package
497 (name "rpm")
498 (version "4.13.0.2")
499 (source (origin
500 (method url-fetch)
501 (uri (string-append "http://ftp.rpm.org/releases/rpm-"
502 (version-major+minor version) ".x/rpm-"
503 version ".tar.bz2"))
504 (sha256
505 (base32
506 "1521y4ghjns449kzpwkjn9cksh686383xnfx0linzlalqc3jqgig"))))
507 (build-system gnu-build-system)
508 (arguments
509 '(#:configure-flags '("--with-external-db" ;use the system's bdb
510 "--enable-python"
511 "--without-lua")
512 #:phases (modify-phases %standard-phases
513 (add-before 'configure 'set-nspr-search-path
514 (lambda* (#:key inputs #:allow-other-keys)
515 ;; nspr.pc contains the right -I flag pointing to
516 ;; 'include/nspr', but unfortunately 'configure' doesn't
517 ;; use 'pkg-config'. Thus, augment CPATH.
518 ;; Likewise for NSS.
519 (let ((nspr (assoc-ref inputs "nspr"))
520 (nss (assoc-ref inputs "nss")))
521 (setenv "CPATH"
522 (string-append (getenv "C_INCLUDE_PATH") ":"
523 nspr "/include/nspr:"
524 nss "/include/nss"))
525 (setenv "LIBRARY_PATH"
526 (string-append (getenv "LIBRARY_PATH") ":"
527 nss "/lib/nss"))
528 #t)))
529 (add-after 'install 'fix-rpm-symlinks
530 (lambda* (#:key outputs #:allow-other-keys)
531 ;; 'make install' gets these symlinks wrong. Fix them.
532 (let* ((out (assoc-ref outputs "out"))
533 (bin (string-append out "/bin")))
534 (with-directory-excursion bin
535 (for-each (lambda (file)
536 (delete-file file)
537 (symlink "rpm" file))
538 '("rpmquery" "rpmverify"))
539 #t)))))))
540 (native-inputs
541 `(("pkg-config" ,pkg-config)))
542 (inputs
543 `(("python" ,python-2)
544 ("xz" ,xz)
545 ("bdb" ,bdb)
546 ("popt" ,popt)
547 ("nss" ,nss)
548 ("nspr" ,nspr)
549 ("libarchive" ,libarchive)
550 ("nettle" ,nettle) ;XXX: actually a dependency of libarchive
551 ("file" ,file)
552 ("bzip2" ,bzip2)
553 ("zlib" ,zlib)
554 ("cpio" ,cpio)))
555 (home-page "http://www.rpm.org/")
556 (synopsis "The RPM Package Manager")
557 (description
558 "The RPM Package Manager (RPM) is a command-line driven package
559 management system capable of installing, uninstalling, verifying, querying,
560 and updating computer software packages. Each software package consists of an
561 archive of files along with information about the package like its version, a
562 description. There is also a library permitting developers to manage such
563 transactions from C or Python.")
564
565 ;; The whole is GPLv2+; librpm itself is dual-licensed LGPLv2+ | GPLv2+.
566 (license license:gpl2+)))
567
568 (define-public diffoscope
569 (package
570 (name "diffoscope")
571 (version "100")
572 (source (origin
573 (method url-fetch)
574 (uri (pypi-uri name version))
575 (sha256
576 (base32
577 "0sh7g26i5ndpa8l7xq6rnijbi3jz5izjn0b98zcnm6wpgghszw48"))))
578 (build-system python-build-system)
579 (arguments
580 `(#:phases (modify-phases %standard-phases
581 ;; setup.py mistakenly requires python-magic from PyPi, even
582 ;; though the Python bindings of `file` are sufficient.
583 ;; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815844
584 (add-after 'unpack 'dependency-on-python-magic
585 (lambda _
586 (substitute* "setup.py"
587 (("'python-magic',") ""))))
588 (add-after 'unpack 'embed-tool-references
589 (lambda* (#:key inputs #:allow-other-keys)
590 (substitute* "diffoscope/comparators/utils/compare.py"
591 (("\\['xxd',")
592 (string-append "['" (which "xxd") "',")))
593 (substitute* "diffoscope/comparators/elf.py"
594 (("@tool_required\\('readelf'\\)") "")
595 (("get_tool_name\\('readelf'\\)")
596 (string-append "'" (which "readelf") "'")))
597 (substitute* "diffoscope/comparators/directory.py"
598 (("@tool_required\\('stat'\\)") "")
599 (("@tool_required\\('getfacl'\\)") "")
600 (("\\['stat',")
601 (string-append "['" (which "stat") "',"))
602 (("\\['getfacl',")
603 (string-append "['" (which "getfacl") "',")))
604 #t))
605 (add-before 'check 'delete-failing-test
606 (lambda _
607 (delete-file "tests/test_tools.py") ;this requires /sbin to be on the path
608 #t)))))
609 (inputs `(("rpm" ,rpm) ;for rpm-python
610 ("python-file" ,python-file)
611 ("python-debian" ,python-debian)
612 ("python-libarchive-c" ,python-libarchive-c)
613 ("python-tlsh" ,python-tlsh)
614 ("acl" ,acl) ;for getfacl
615 ("colordiff" ,colordiff)
616 ("xxd" ,xxd)
617
618 ;; Below are modules used for tests.
619 ("python-pytest" ,python-pytest)
620 ("python-chardet" ,python-chardet)))
621 (home-page "https://diffoscope.org/")
622 (synopsis "Compare files, archives, and directories in depth")
623 (description
624 "Diffoscope tries to get to the bottom of what makes files or directories
625 different. It recursively unpacks archives of many kinds and transforms
626 various binary formats into more human readable forms to compare them. It can
627 compare two tarballs, ISO images, or PDFs just as easily.")
628 (license license:gpl3+)))
629
630 (define-public python-anaconda-client
631 (package
632 (name "python-anaconda-client")
633 (version "1.6.3")
634 (source
635 (origin
636 (method url-fetch)
637 (uri (string-append "https://github.com/Anaconda-Platform/"
638 "anaconda-client/archive/" version ".tar.gz"))
639 (file-name (string-append name "-" version ".tar.gz"))
640 (sha256
641 (base32
642 "1wv4wi6k5jz7rlwfgvgfdizv77x3cr1wa2aj0k1595g7fbhkjhz2"))))
643 (build-system python-build-system)
644 (propagated-inputs
645 `(("python-pyyaml" ,python-pyyaml)
646 ("python-requests" ,python-requests)
647 ("python-clyent" ,python-clyent)))
648 (native-inputs
649 `(("python-pytz" ,python-pytz)
650 ("python-dateutil" ,python-dateutil)
651 ("python-mock" ,python-mock)
652 ("python-coverage" ,python-coverage)
653 ("python-pillow" ,python-pillow)))
654 (arguments
655 `(#:phases
656 (modify-phases %standard-phases
657 ;; This is needed for some tests.
658 (add-before 'check 'set-up-home
659 (lambda* _ (setenv "HOME" "/tmp") #t))
660 (add-before 'check 'remove-network-tests
661 (lambda* _
662 ;; Remove tests requiring a network connection
663 (let ((network-tests '("tests/test_upload.py"
664 "tests/test_authorizations.py"
665 "tests/test_login.py"
666 "tests/test_whoami.py"
667 "utils/notebook/tests/test_data_uri.py"
668 "utils/notebook/tests/test_base.py"
669 "utils/notebook/tests/test_downloader.py"
670 "inspect_package/tests/test_conda.py")))
671 (with-directory-excursion "binstar_client"
672 (for-each delete-file network-tests)))
673 #t)))))
674 (home-page "https://github.com/Anaconda-Platform/anaconda-client")
675 (synopsis "Anaconda Cloud command line client library")
676 (description
677 "Anaconda Cloud command line client library provides an interface to
678 Anaconda Cloud. Anaconda Cloud is useful for sharing packages, notebooks and
679 environments.")
680 (license license:bsd-3)))
681
682 (define-public python2-anaconda-client
683 (package-with-python2 python-anaconda-client))
684
685 (define-public python-conda
686 (package
687 (name "python-conda")
688 (version "4.3.16")
689 (source
690 (origin
691 (method url-fetch)
692 (uri (string-append "https://github.com/conda/conda/archive/"
693 version ".tar.gz"))
694 (file-name (string-append name "-" version ".tar.gz"))
695 (sha256
696 (base32
697 "1jq8hyrc5npb5sf4vw6s6by4602yj8f79vzpbwdfgpkn02nfk1dv"))))
698 (build-system python-build-system)
699 (arguments
700 `(#:phases
701 (modify-phases %standard-phases
702 (add-before 'build 'create-version-file
703 (lambda _
704 (with-output-to-file "conda/.version"
705 (lambda () (display ,version)))
706 #t))
707 (add-before 'check 'remove-failing-tests
708 (lambda _
709 ;; These tests require internet/network access
710 (let ((network-tests '("test_cli.py"
711 "test_create.py"
712 "test_export.py"
713 "test_fetch.py"
714 "test_history.py"
715 "test_info.py"
716 "test_install.py"
717 "test_priority.py"
718 "conda_env/test_cli.py"
719 "conda_env/test_create.py"
720 "conda_env/specs/test_notebook.py"
721 "conda_env/utils/test_notebooks.py"
722 "core/test_index.py"
723 "core/test_repodata.py")))
724 (with-directory-excursion "tests"
725 (for-each delete-file network-tests)
726
727 ;; FIXME: This test creates a file, then deletes it and tests
728 ;; that the file was deleted. For some reason it fails when
729 ;; building with guix, but does not when you run it in the
730 ;; directory left when you build with the --keep-failed
731 ;; option
732 (delete-file "gateways/disk/test_delete.py")
733 #t))))
734 (replace 'check
735 (lambda _
736 (setenv "HOME" "/tmp")
737 (zero? (system* "py.test")))))))
738 (native-inputs
739 `(("python-ruamel.yaml" ,python-ruamel.yaml)
740 ("python-requests" ,python-requests)
741 ("python-pycosat" ,python-pycosat)
742 ("python-pytest" ,python-pytest)
743 ("python-responses" ,python-responses)
744 ("python-pyyaml" ,python-pyyaml)
745 ("python-anaconda-client" ,python-anaconda-client)))
746 (home-page "https://github.com/conda/conda")
747 (synopsis "Cross-platform, OS-agnostic, system-level binary package manager")
748 (description
749 "Conda is a cross-platform, Python-agnostic binary package manager. It
750 is the package manager used by Anaconda installations, but it may be used for
751 other systems as well. Conda makes environments first-class citizens, making
752 it easy to create independent environments even for C libraries. Conda is
753 written entirely in Python.
754
755 This package provides Conda as a library.")
756 (license license:bsd-3)))
757
758 (define-public python2-conda
759 (let ((base (package-with-python2
760 (strip-python2-variant python-conda))))
761 (package (inherit base)
762 (native-inputs
763 `(("python2-enum34" ,python2-enum34)
764 ,@(package-native-inputs base))))))
765
766 (define-public conda
767 (package (inherit python-conda)
768 (name "conda")
769 (arguments
770 (substitute-keyword-arguments (package-arguments python-conda)
771 ((#:phases phases)
772 `(modify-phases ,phases
773 (replace 'build
774 (lambda* (#:key outputs #:allow-other-keys)
775 ;; This test fails when run before installation.
776 (delete-file "tests/test_activate.py")
777
778 ;; Fix broken defaults
779 (substitute* "conda/base/context.py"
780 (("return sys.prefix")
781 (string-append "return \"" (assoc-ref outputs "out") "\""))
782 (("return (prefix_is_writable\\(self.root_prefix\\))" _ match)
783 (string-append "return False if self.root_prefix == self.conda_prefix else "
784 match)))
785
786 ;; The util/setup-testing.py is used to build conda in
787 ;; application form, rather than the default, library form.
788 ;; With this, we are able to run commands like `conda --help`
789 ;; directly on the command line
790 (zero? (system* "python" "utils/setup-testing.py" "build_py"))))
791 (replace 'install
792 (lambda* (#:key inputs outputs #:allow-other-keys)
793 (let* ((out (assoc-ref outputs "out"))
794 (target (string-append out "/lib/python"
795 ((@@ (guix build python-build-system)
796 get-python-version)
797 (assoc-ref inputs "python"))
798 "/site-packages/")))
799 ;; The installer aborts if the target directory is not on
800 ;; PYTHONPATH.
801 (setenv "PYTHONPATH"
802 (string-append target ":" (getenv "PYTHONPATH")))
803
804 ;; And it aborts if the directory doesn't exist.
805 (mkdir-p target)
806 (zero? (system* "python" "utils/setup-testing.py" "install"
807 (string-append "--prefix=" out))))))
808 ;; The "activate" and "deactivate" scripts don't need wrapping.
809 ;; They also break when they are renamed.
810 (add-after 'wrap 'undo-wrap
811 (lambda* (#:key outputs #:allow-other-keys)
812 (with-directory-excursion (string-append (assoc-ref outputs "out") "/bin/")
813 (delete-file "deactivate")
814 (rename-file ".deactivate-real" "deactivate")
815 (delete-file "activate")
816 (rename-file ".activate-real" "activate")
817 #t)))))))
818 (description
819 "Conda is a cross-platform, Python-agnostic binary package manager. It
820 is the package manager used by Anaconda installations, but it may be used for
821 other systems as well. Conda makes environments first-class citizens, making
822 it easy to create independent environments even for C libraries. Conda is
823 written entirely in Python.")))
824
825 (define-public gwl
826 (package
827 (name "gwl")
828 (version "0.1.1")
829 (source (origin
830 (method url-fetch)
831 (uri (string-append "https://www.guixwl.org/releases/gwl-"
832 version ".tar.gz"))
833 (sha256
834 (base32
835 "06pm967mq1wyggx7l0nfapw5s0k5qc5r9lawk2v3db868br779a7"))))
836 (build-system gnu-build-system)
837 (native-inputs
838 `(("autoconf" ,autoconf)
839 ("automake" ,automake)
840 ("pkg-config" ,pkg-config)))
841 (inputs
842 `(("guile" ,guile-2.2)))
843 (propagated-inputs
844 `(("guix" ,guix)
845 ("guile-commonmark" ,guile-commonmark)))
846 (home-page "https://www.guixwl.org")
847 (synopsis "Workflow management extension for GNU Guix")
848 (description "This project provides two subcommands to GNU Guix and
849 introduces two record types that provide a workflow management extension built
850 on top of GNU Guix.")
851 ;; The Scheme modules in guix/ and gnu/ are licensed GPL3+,
852 ;; the web interface modules in gwl/ are licensed AGPL3+,
853 ;; and the fonts included in this package are licensed OFL1.1.
854 (license (list license:gpl3+ license:agpl3+ license:silofl1.1))))
855
856 (define-public gcab
857 (package
858 (name "gcab")
859 (version "1.1")
860 (source (origin
861 (method url-fetch)
862 (uri (string-append "mirror://gnome/sources/" name "/"
863 version "/" name "-" version ".tar.xz"))
864 (sha256
865 (base32
866 "0l19sr6pg0cfcddmi5n79d08mjjbhn427ip5jlsy9zddq9r24aqr"))
867 ;; gcab 1.1 has a hard dependency on git — even when building
868 ;; from a tarball. Remove it early so ‘guix environment gcab’
869 ;; can actually build what ‘guix build --source gcab’ returns.
870 (modules '((guix build utils)))
871 (snippet
872 '(begin
873 (substitute* "meson.build"
874 (("git_version = .*$") "git_version = []\n"))
875 #t))))
876 (build-system meson-build-system)
877 (native-inputs
878 `(("glib:bin" ,glib "bin") ; for glib-mkenums
879 ("intltool" ,intltool)
880 ("pkg-config" ,pkg-config)
881 ("vala" ,vala)))
882 (inputs
883 `(("glib" ,glib)
884 ("zlib" ,zlib)))
885 (arguments
886 `(#:configure-flags
887 ;; XXX This ‘documentation’ is for developers, and fails informatively:
888 ;; Error in gtkdoc helper script: 'gtkdoc-mkhtml' failed with status 5
889 (list "-Ddocs=false"
890 "-Dintrospection=false")))
891 (home-page "https://wiki.gnome.org/msitools") ; no dedicated home page
892 (synopsis "Microsoft Cabinet file manipulation library")
893 (description
894 "The libgcab library provides GObject functions to read, write, and modify
895 Microsoft cabinet (.@dfn{CAB}) files.")
896 (license (list license:gpl2+ ; tests/testsuite.at
897 license:lgpl2.1+)))) ; the rest
898
899 (define-public msitools
900 (package
901 (name "msitools")
902 (version "0.98")
903 (source (origin
904 (method url-fetch)
905 (uri (string-append "mirror://gnome/sources/" name "/"
906 version "/" name "-" version ".tar.xz"))
907 (sha256
908 (base32
909 "19wb3n3nwkpc6bjr0q3f1znaxsfaqgjbdxxnbx8ic8bb5b49hwac"))))
910 (build-system gnu-build-system)
911 (native-inputs
912 `(("pkg-config" ,pkg-config)))
913 (inputs
914 `(("gcab" ,gcab)
915 ("glib" ,glib)
916 ("libgsf" ,libgsf)
917 ("libxml2" ,libxml2)
918 ("uuid" ,util-linux)))
919 (home-page "https://wiki.gnome.org/msitools")
920 (synopsis "Windows Installer file manipulation tool")
921 (description
922 "msitools is a collection of command-line tools to inspect, extract, build,
923 and sign Windows@tie{}Installer (.@dfn{MSI}) files. It aims to be a solution
924 for packaging and deployment of cross-compiled Windows applications.")
925 (license license:lgpl2.1+)))
926
927 (define-public libostree
928 (package
929 (name "libostree")
930 (version "2018.7")
931 (source (origin
932 (method url-fetch)
933 (uri (string-append
934 "https://github.com/ostreedev/ostree/releases/download/v"
935 version "/libostree-" version ".tar.xz"))
936 (sha256
937 (base32
938 "1nc310lv36psxn5yslkxlgi9gjxwqpwqzkg2pldgpwrlv6gkagj8"))))
939 (build-system gnu-build-system)
940 (arguments
941 '(#:phases
942 (modify-phases %standard-phases
943 (add-before 'check 'pre-check
944 (lambda _
945 ;; Don't try to use the non-existing '/var/tmp' as test
946 ;; directory.
947 (setenv "TEST_TMPDIR" (getenv "TMPDIR"))
948 #t)))
949 ;; XXX: fails with:
950 ;; tap-driver.sh: internal error getting exit status
951 ;; tap-driver.sh: fatal: I/O or internal error
952 #:tests? #f))
953 (native-inputs
954 `(("attr" ,attr) ; for tests
955 ("bison" ,bison)
956 ("glib:bin" ,glib "bin") ; for 'glib-mkenums'
957 ("gobject-introspection" ,gobject-introspection)
958 ("pkg-config" ,pkg-config)
959 ("xsltproc" ,libxslt)))
960 (inputs
961 `(("avahi" ,avahi)
962 ("docbook-xml" ,docbook-xml-4.2)
963 ("docbook-xsl" ,docbook-xsl)
964 ("e2fsprogs" ,e2fsprogs)
965 ("fuse" ,fuse)
966 ("glib" ,glib)
967 ("gpgme" ,gpgme)
968 ("libarchive" ,libarchive)
969 ("libsoup" ,libsoup)
970 ("nettle" ,nettle) ; required by 'libarchive.la'
971 ("util-linux" ,util-linux)))
972 (home-page "https://ostree.readthedocs.io/en/latest/")
973 (synopsis "Operating system and container binary deployment and upgrades")
974 (description
975 "@code{libostree} is both a shared library and suite of command line
976 tools that combines a \"git-like\" model for committing and downloading
977 bootable filesystem trees, along with a layer for deploying them and managing
978 the bootloader configuration.")
979 (license license:lgpl2.0+)))