1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
5 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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 build utils) #:select (with-directory-excursion))
29 #:use-module ((guix licenses) #:select (gpl2+ gpl3+ lgpl2.1+ asl2.0))
30 #:use-module (gnu packages)
31 #:use-module (gnu packages guile)
32 #:use-module (gnu packages file)
33 #:use-module (gnu packages backup)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages gnupg)
36 #:use-module (gnu packages databases)
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)
41 #:use-module (gnu packages texinfo)
42 #:use-module (gnu packages nettle)
43 #:use-module (gnu packages perl)
44 #:use-module (gnu packages curl)
45 #:use-module (gnu packages web)
46 #:use-module (gnu packages man)
47 #:use-module (gnu packages emacs)
48 #:use-module (gnu packages bdw-gc)
49 #:use-module (gnu packages python)
50 #:use-module (gnu packages popt)
51 #:use-module (gnu packages gnuzilla)
52 #:use-module (gnu packages cpio)
53 #:use-module (gnu packages tls)
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))
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/"
65 "/20150101/guile-2.0.11.tar.xz")
66 (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
68 "/20131110/guile-2.0.9.tar.xz")))
70 (define-public guix-0.11.0
76 (uri (string-append "ftp://alpha.gnu.org/gnu/guix/guix-"
80 "1cwrbpv4dq7aczwksmcfw9w8r2bzrb5ld9zvjcr90i804hjpcb93"))))
81 (build-system gnu-build-system)
83 `(#:configure-flags (list
84 "--localstatedir=/var"
86 (string-append "--with-bash-completion-dir="
87 (assoc-ref %outputs "out")
88 "/etc/bash_completion.d")
89 (string-append "--with-libgcrypt-prefix="
90 (assoc-ref %build-inputs
92 #:parallel-tests? #f ;work around <http://bugs.gnu.org/21097>
93 #:phases (modify-phases %standard-phases
95 'configure 'copy-bootstrap-guile
96 (lambda* (#:key system inputs #:allow-other-keys)
97 (define (boot-guile-version arch)
98 (if (string=? "armhf" arch)
103 (let ((guile (assoc-ref inputs
104 (string-append "boot-guile/"
106 (target (string-append "gnu/packages/bootstrap/"
109 (boot-guile-version arch)
111 (copy-file guile target)))
119 'unpack 'disable-container-tests
120 ;; XXX FIXME: These tests fail within the build container.
122 (substitute* "tests/syscalls.scm"
123 (("^\\(test-assert \"(clone|setns|pivot-root)\"" all)
124 (string-append "(test-skip 1)\n" all)))
125 (substitute* "tests/containers.scm"
126 (("^\\(test-assert" all)
127 (string-append "(test-skip 1)\n" all)))
128 (when (file-exists? "tests/guix-environment-container.sh")
129 (substitute* "tests/guix-environment-container.sh"
130 (("guix environment --version")
133 (add-before 'check 'set-SHELL
135 ;; 'guix environment' tests rely on 'SHELL' having a
136 ;; correct value, so set it.
137 (setenv "SHELL" (which "sh"))
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"))
146 (gnutls (assoc-ref inputs "gnutls"))
148 json "/share/guile/site/2.0:"
149 gnutls "/share/guile/site/2.0")))
151 ;; Ignore user settings so that a bogus
152 ;; GUILE_LOAD_COMPILED_PATH does not prevent use of
153 ;; 'guix', notably when it contains entries pointing to
154 ;; incompatible .go files as reported at
155 ;; <https://lists.gnu.org/archive/html/guix-devel/2016-03/msg01261.html>.
156 (wrap-program (string-append out "/bin/guix")
157 `("GUILE_LOAD_PATH" ":" prefix (,path))
158 `("GUILE_LOAD_COMPILED_PATH" ":" = (,path)))
161 (native-inputs `(("pkg-config" ,pkg-config)
162 ("emacs" ,emacs-minimal))) ;for guix.el
164 (let ((boot-guile (lambda (arch hash)
167 (uri (boot-guile-uri arch))
171 ("zlib" ,zlib) ;for 'guix publish'
174 ("libgcrypt" ,libgcrypt)
180 "0im800m30abgh7msh331pcbjvb4n02smz5cfzf1srv0kpx3csmxp")))
182 ,(boot-guile "x86_64"
184 "1w2p5zyrglzzniqgvyn1b55vprfzhgk8vzbzkkbdgl5248si0yq3")))
185 ("boot-guile/mips64el"
186 ,(boot-guile "mips64el"
188 "0fzp93lvi0hn54acc0fpvhc7bvl0yc853k62l958cihk03q80ilr")))
192 "1mi3brl7l58aww34rawhvja84xc7l1b4hmwdmc36fp9q9mfx0lg5"))))))
194 `(("gnutls" ,gnutls) ;for 'guix download' & co.
195 ("guile-json" ,guile-json)
196 ("geiser" ,geiser) ;for guix.el
197 ("emacs-magit-popup" ,emacs-magit-popup))) ;for "M-x guix" command
199 (home-page "http://www.gnu.org/software/guix")
200 (synopsis "Functional package manager for installed software packages and versions")
202 "GNU Guix is a functional package manager for the GNU system, and is
203 also a distribution thereof. It includes a virtual machine image. Besides
204 the usual package management features, it also supports transactional
205 upgrades and roll-backs, per-user profiles, and much more. It is based on
206 the Nix package manager.")
208 (properties '((ftp-server . "alpha.gnu.org")))))
211 ;; Development version of Guix.
213 ;; Note: use a very short commit id; with a longer one, the limit on
214 ;; hash-bang lines would be exceeded while running the tests.
215 (let ((commit "4420940f20a2f36f29519f686bca7b85be6be5c9"))
216 (package (inherit guix-0.11.0)
217 (version (string-append "0.11.0-1." (string-take commit 4)))
221 ;; "git://git.sv.gnu.org/guix.git" temporarily
222 ;; unavailable (XXX).
223 (url "http://git.savannah.gnu.org/r/guix.git")
227 "1c1rqsfc4vrclkk03aj1m8r1lzk9pfa61ax9hhhj5nw23bilsixc"))
228 (file-name (string-append "guix-" version "-checkout"))))
230 (substitute-keyword-arguments (package-arguments guix-0.11.0)
231 ((#:configure-flags flags)
232 ;; Set 'DOT_USER_PROGRAM' to the empty string so we don't keep a
233 ;; reference to Graphviz, whose closure is pretty big (too big for
234 ;; the GuixSD installation image.)
235 `(cons "ac_cv_path_DOT_USER_PROGRAM=dot" ,flags))
237 `(modify-phases ,phases
241 ;; Make sure 'msgmerge' can modify the PO files.
242 (for-each (lambda (po)
244 (find-files "." "\\.po$"))
246 (zero? (system* "sh" "bootstrap"))))))))
248 `(("autoconf" ,(autoconf-wrapper))
249 ("automake" ,automake)
250 ("gettext" ,gettext-minimal)
252 ("graphviz" ,graphviz)
253 ("help2man" ,help2man)
254 ,@(package-native-inputs guix-0.11.0))))))
256 (define-public guix guix-devel)
258 (define (source-file? file stat)
259 "Return true if FILE is likely a source file, false if it is a typical
261 (define (wrong-extension? file)
262 (or (string-suffix? "~" file)
263 (member (file-extension file)
264 '("o" "a" "lo" "so" "go"))))
266 (match (basename file)
267 ((or ".git" "autom4te.cache" "configure" "Makefile" "Makefile.in" ".libs")
269 ((? wrong-extension?)
274 (define (make-git-predicate directory)
275 "Return a predicate that returns true if a file is part of the Git checkout
276 living at DIRECTORY. Upon Git failure, return #f instead of a predicate."
277 (define (parent-directory? thing directory)
278 ;; Return #t if DIRECTORY is the parent of THING.
279 (or (string-suffix? thing directory)
280 (and (string-index thing #\/)
281 (parent-directory? (dirname thing) directory))))
283 (let* ((pipe (with-directory-excursion directory
284 (open-pipe* OPEN_READ "git" "ls-files")))
285 (files (let loop ((lines '()))
286 (match (read-line pipe)
290 (loop (cons line lines))))))
291 (status (close-pipe pipe)))
294 (match (stat:type stat)
296 ;; 'git ls-files' does not list directories, only regular files,
297 ;; so we need this special trick.
298 (any (cut parent-directory? <> file) files))
299 ((or 'regular 'symlink)
300 (any (cut string-suffix? <> file) files))
304 (define-public current-guix
305 (let ((select? (delay (or (make-git-predicate
306 (string-append (current-source-directory)
310 "Return a package representing Guix built from the current source tree.
311 This works by adding the current source tree to the store (after filtering it
312 out) and returning a package that uses that as its 'source'."
315 (version (string-append (package-version guix) "+"))
316 (source (local-file "../.." "guix-current"
318 #:select? (force select?)))))))
331 (uri (string-append "http://nixos.org/releases/nix/nix-"
332 version "/nix-" version ".tar.xz"))
335 "1mk9z75gklxcv6kzwwz1h5r2ci5kjy6bh7qwk4m5lf5v9s0k64pw"))))
336 (build-system gnu-build-system)
337 ;; XXX: Should we pass '--with-store-dir=/gnu/store'? But then we'd also
338 ;; need '--localstatedir=/var'. But then! The thing would use /var/nix
339 ;; instead of /var/guix. So in the end, we do nothing special.
342 ;; Set the prefixes of Perl libraries to avoid propagation.
343 (let ((perl-libdir (lambda (p)
345 (assoc-ref %build-inputs p)
346 "/lib/perl5/site_perl"))))
347 (list (string-append "--with-dbi="
348 (perl-libdir "perl-dbi"))
349 (string-append "--with-dbd-sqlite="
350 (perl-libdir "perl-dbd-sqlite"))
351 (string-append "--with-www-curl="
352 (perl-libdir "perl-www-curl"))))))
353 (native-inputs `(("perl" ,perl)
354 ("pkg-config" ,pkg-config)))
355 (inputs `(("curl" ,curl)
360 ("perl-www-curl" ,perl-www-curl)
361 ("perl-dbi" ,perl-dbi)
362 ("perl-dbd-sqlite" ,perl-dbd-sqlite)))
363 (home-page "http://nixos.org/nix/")
364 (synopsis "The Nix package manager")
366 "Nix is a purely functional package manager. This means that it treats
367 packages like values in purely functional programming languages such as
368 Haskell—they are built by functions that don't have side-effects, and they
369 never change after they have been built. Nix stores packages in the Nix
370 store, usually the directory /nix/store, where each package has its own unique
380 (uri (string-append "mirror://gnu/stow/stow-"
384 "1pvky9fayms4r6fhns8jd0vavszd7d979w62vfd5n88v614pdxz2"))))
385 (build-system gnu-build-system)
389 `(("perl-test-simple" ,perl-test-simple)
390 ("perl-test-output" ,perl-test-output)
391 ("perl-capture-tiny" ,perl-capture-tiny)
392 ("perl-io-stringy" ,perl-io-stringy)))
393 (home-page "https://www.gnu.org/software/stow/")
394 (synopsis "Managing installed software packages")
396 "GNU Stow is a symlink manager. It generates symlinks to directories
397 of data and makes them appear to be merged into the same directory. It is
398 typically used for managing software packages installed from source, by
399 letting you install them apart in distinct directories and then create
400 symlinks to the files in a common directory such as /usr/local.")
409 (uri (string-append "http://rpm.org/releases/rpm-4.12.x/rpm-"
413 "0a82ym8phx7g0f3k6smvxnvzh7yv857l42xafk49689kzhld5pbp"))
414 (patches (search-patches "rpm-CVE-2014-8118.patch"))))
415 (build-system gnu-build-system)
417 '(#:configure-flags '("--with-external-db" ;use the system's bdb
420 #:phases (modify-phases %standard-phases
421 (add-before 'configure 'set-nspr-search-path
422 (lambda* (#:key inputs #:allow-other-keys)
423 ;; nspr.pc contains the right -I flag pointing to
424 ;; 'include/nspr', but unfortunately 'configure' doesn't
425 ;; use 'pkg-config'. Thus, augment CPATH.
427 (let ((nspr (assoc-ref inputs "nspr"))
428 (nss (assoc-ref inputs "nss")))
430 (string-append (getenv "C_INCLUDE_PATH") ":"
431 nspr "/include/nspr:"
433 (setenv "LIBRARY_PATH"
434 (string-append (getenv "LIBRARY_PATH") ":"
437 (add-after 'install 'fix-rpm-symlinks
438 (lambda* (#:key outputs #:allow-other-keys)
439 ;; 'make install' gets these symlinks wrong. Fix them.
440 (let* ((out (assoc-ref outputs "out"))
441 (bin (string-append out "/bin")))
442 (with-directory-excursion bin
443 (for-each (lambda (file)
445 (symlink "rpm" file))
446 '("rpmquery" "rpmverify"))
449 `(("pkg-config" ,pkg-config)))
451 `(("python" ,python-2)
457 ("libarchive" ,libarchive)
458 ("nettle" ,nettle) ;XXX: actually a dependency of libarchive
463 (home-page "http://www.rpm.org/")
464 (synopsis "The RPM Package Manager")
466 "The RPM Package Manager (RPM) is a command-line driven package
467 management system capable of installing, uninstalling, verifying, querying,
468 and updating computer software packages. Each software package consists of an
469 archive of files along with information about the package like its version, a
470 description. There is also a library permitting developers to manage such
471 transactions from C or Python.")
473 ;; The whole is GPLv2+; librpm itself is dual-licensed LGPLv2+ | GPLv2+.
476 (define-public diffoscope
482 (uri (pypi-uri name version))
485 "1qpk2l6p9z58s61jfx6adm96f5r21ns128db0876zd6b6h34411p"))))
486 (build-system python-build-system)
488 `(#:phases (modify-phases %standard-phases
489 ;; setup.py mistakenly requires python-magic from PyPi, even
490 ;; though the Python bindings of `file` are sufficient.
491 ;; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815844
492 (add-after 'unpack 'dependency-on-python-magic
494 (substitute* "setup.py"
495 (("'python-magic',") ""))))
496 (add-before 'build 'disable-egg-zipping
498 ;; Leave the .egg file uncompressed.
499 (let ((port (open-file "setup.cfg" "a")))
500 (display "\n[easy_install]\nzip_ok = 0\n"
504 (inputs `(("rpm" ,rpm) ;for rpm-python
505 ("python-file" ,python-file)
506 ("python-debian" ,python-debian)
507 ("python-libarchive-c" ,python-libarchive-c)
508 ("python-tlsh" ,python-tlsh)
510 ;; Below are modules used for tests.
511 ("python-pytest" ,python-pytest)
512 ("python-chardet" ,python-chardet)))
513 (home-page "http://diffoscope.org/")
514 (synopsis "Compare files, archives, and directories in depth")
516 "Diffoscope tries to get to the bottom of what makes files or directories
517 different. It recursively unpacks archives of many kinds and transforms
518 various binary formats into more human readable forms to compare them. It can
519 compare two tarballs, ISO images, or PDFs just as easily.")