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