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>
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 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 (srfi srfi-1)
56 #:use-module (ice-9 match))
58 (define (boot-guile-uri arch)
59 "Return the URI for the bootstrap Guile tarball for ARCH."
60 (cond ((string=? "armhf" arch)
61 (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
63 "/20150101/guile-2.0.11.tar.xz"))
64 ((string=? "aarch64" arch)
65 (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
66 arch "-linux/20170217/guile-2.0.14.tar.xz"))
68 (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
70 "/20131110/guile-2.0.9.tar.xz"))))
73 ;; Latest version of Guix, which may or may not correspond to a release.
74 ;; Note: the 'update-guix-package.scm' script expects this definition to
75 ;; start precisely like this.
76 (let ((version "0.13.0")
77 (commit "a6d728b7aaee09892b0b420d07ed2dbb7de5e63f")
82 (version (if (zero? revision)
84 (string-append version "-"
85 (number->string revision)
86 "." (string-take commit 7))))
90 (url "https://git.savannah.gnu.org/r/guix.git")
94 "1nrskyk8z6w5i9cdfh5zxfgsrqf744sb30ssqi2g5xhijwagr1yq"))
95 (file-name (string-append "guix-" version "-checkout"))))
96 (build-system gnu-build-system)
98 `(#:configure-flags (list
99 "--localstatedir=/var"
101 (string-append "--with-bash-completion-dir="
102 (assoc-ref %outputs "out")
103 "/etc/bash_completion.d")
104 (string-append "--with-libgcrypt-prefix="
105 (assoc-ref %build-inputs
108 ;; Set 'DOT_USER_PROGRAM' to the empty string so
109 ;; we don't keep a reference to Graphviz, whose
110 ;; closure is pretty big (too big for the GuixSD
111 ;; installation image.)
112 "ac_cv_path_DOT_USER_PROGRAM=dot"
114 ;; To avoid problems with the length of shebangs,
115 ;; choose a fixed-width and short directory name
117 "ac_cv_guix_test_root=/tmp/guix-tests")
118 #:parallel-tests? #f ;work around <http://bugs.gnu.org/21097>
120 #:modules ((guix build gnu-build-system)
125 #:phases (modify-phases %standard-phases
126 (add-after 'unpack 'bootstrap
128 ;; Make sure 'msgmerge' can modify the PO files.
129 (for-each (lambda (po)
131 (find-files "." "\\.po$"))
133 (zero? (system* "sh" "bootstrap"))))
135 'configure 'copy-bootstrap-guile
136 (lambda* (#:key system inputs #:allow-other-keys)
137 (define (boot-guile-version arch)
138 (cond ((string=? "armhf" arch) "2.0.11")
139 ((string=? "aarch64" arch) "2.0.14")
143 (let ((guile (assoc-ref inputs
144 (string-append "boot-guile/"
146 (target (string-append "gnu/packages/bootstrap/"
149 (boot-guile-version arch)
151 (mkdir-p (dirname target)) ;XXX: eventually unneeded
152 (copy-file guile target)))
161 'unpack 'disable-container-tests
162 ;; XXX FIXME: These tests fail within the build container.
164 (substitute* "tests/syscalls.scm"
165 (("^\\(test-(assert|equal) \"(clone|setns|pivot-root)\"" all)
166 (string-append "(test-skip 1)\n" all)))
167 (substitute* "tests/containers.scm"
168 (("^\\(test-(assert|equal)" all)
169 (string-append "(test-skip 1)\n" all)))
170 (when (file-exists? "tests/guix-environment-container.sh")
171 (substitute* "tests/guix-environment-container.sh"
172 (("guix environment --version")
175 (add-before 'check 'set-SHELL
177 ;; 'guix environment' tests rely on 'SHELL' having a
178 ;; correct value, so set it.
179 (setenv "SHELL" (which "sh"))
181 (add-after 'install 'wrap-program
182 (lambda* (#:key inputs outputs #:allow-other-keys)
183 ;; Make sure the 'guix' command finds GnuTLS and
184 ;; Guile-JSON automatically.
185 (let* ((out (assoc-ref outputs "out"))
186 (guile (assoc-ref inputs "guile"))
187 (json (assoc-ref inputs "guile-json"))
188 (ssh (assoc-ref inputs "guile-ssh"))
189 (gnutls (assoc-ref inputs "gnutls"))
192 (open-pipe* OPEN_READ
193 (string-append guile "/bin/guile")
194 "-c" "(display (effective-version))")))
196 json "/share/guile/site/" effective ":"
197 ssh "/share/guile/site/" effective ":"
198 gnutls "/share/guile/site/" effective)))
200 (wrap-program (string-append out "/bin/guix")
201 `("GUILE_LOAD_PATH" ":" prefix (,path))
202 `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,path)))
205 (native-inputs `(("pkg-config" ,pkg-config)
207 ;; XXX: Keep the development inputs here even though
208 ;; they're unnecessary, just so that 'guix environment
209 ;; guix' always contains them.
210 ("autoconf" ,(autoconf-wrapper))
211 ("automake" ,automake)
212 ("gettext" ,gettext-minimal)
214 ("graphviz" ,graphviz)
215 ("help2man" ,help2man)))
217 (let ((boot-guile (lambda (arch hash)
220 (uri (boot-guile-uri arch))
224 ("zlib" ,zlib) ;for 'guix publish'
227 ("libgcrypt" ,libgcrypt)
233 "0im800m30abgh7msh331pcbjvb4n02smz5cfzf1srv0kpx3csmxp")))
235 ,(boot-guile "x86_64"
237 "1w2p5zyrglzzniqgvyn1b55vprfzhgk8vzbzkkbdgl5248si0yq3")))
238 ("boot-guile/mips64el"
239 ,(boot-guile "mips64el"
241 "0fzp93lvi0hn54acc0fpvhc7bvl0yc853k62l958cihk03q80ilr")))
245 "1mi3brl7l58aww34rawhvja84xc7l1b4hmwdmc36fp9q9mfx0lg5")))
246 ("boot-guile/aarch64"
247 ,(boot-guile "aarch64"
249 "1giy2aprjmn5fp9c4s9r125fljw4wv6ixy5739i5bffw4jgr0f9r"))))))
251 `(("gnutls" ,gnutls/guile-2.2) ;for 'guix download' & co.
252 ("guile-json" ,guile-json)
253 ("guile-ssh" ,guile-ssh)))
255 (home-page "https://www.gnu.org/software/guix/")
256 (synopsis "Functional package manager for installed software packages and versions")
258 "GNU Guix is a functional package manager for the GNU system, and is
259 also a distribution thereof. It includes a virtual machine image. Besides
260 the usual package management features, it also supports transactional
261 upgrades and roll-backs, per-user profiles, and much more. It is based on
262 the Nix package manager.")
264 (properties '((ftp-server . "alpha.gnu.org"))))))
266 ;; Alias for backward compatibility.
267 (define-public guix-devel guix)
269 (define-public guile2.0-guix
272 (name "guile2.0-guix")
274 `(("guile" ,guile-2.0)
275 ,@(alist-delete "guile" (package-inputs guix))))
278 ("guile-json" ,guile2.0-json)
279 ("guile-ssh" ,guile2.0-ssh)))))
281 (define (source-file? file stat)
282 "Return true if FILE is likely a source file, false if it is a typical
284 (define (wrong-extension? file)
285 (or (string-suffix? "~" file)
286 (member (file-extension file)
287 '("o" "a" "lo" "so" "go"))))
289 (match (basename file)
290 ((or ".git" "autom4te.cache" "configure" "Makefile" "Makefile.in" ".libs")
292 ((? wrong-extension?)
297 (define-public current-guix
298 (let ((select? (delay (or (git-predicate
299 (string-append (current-source-directory)
303 "Return a package representing Guix built from the current source tree.
304 This works by adding the current source tree to the store (after filtering it
305 out) and returning a package that uses that as its 'source'."
308 (version (string-append (package-version guix) "+"))
309 (source (local-file "../.." "guix-current"
311 #:select? (force select?)))))))
324 (uri (string-append "http://nixos.org/releases/nix/nix-"
325 version "/nix-" version ".tar.xz"))
328 "1qg7qrfr60dysmyfg3ijgani71l23p1kqadhjs8kz11pgwkkx50f"))))
329 (build-system gnu-build-system)
330 ;; XXX: Should we pass '--with-store-dir=/gnu/store'? But then we'd also
331 ;; need '--localstatedir=/var'. But then! The thing would use /var/nix
332 ;; instead of /var/guix. So in the end, we do nothing special.
335 ;; Set the prefixes of Perl libraries to avoid propagation.
336 (let ((perl-libdir (lambda (p)
338 (assoc-ref %build-inputs p)
339 "/lib/perl5/site_perl"))))
340 (list (string-append "--with-dbi="
341 (perl-libdir "perl-dbi"))
342 (string-append "--with-dbd-sqlite="
343 (perl-libdir "perl-dbd-sqlite"))
344 (string-append "--with-www-curl="
345 (perl-libdir "perl-www-curl"))))))
346 (native-inputs `(("perl" ,perl)
347 ("pkg-config" ,pkg-config)))
348 (inputs `(("curl" ,curl)
353 ("perl-www-curl" ,perl-www-curl)
354 ("perl-dbi" ,perl-dbi)
355 ("perl-dbd-sqlite" ,perl-dbd-sqlite)))
356 (home-page "http://nixos.org/nix/")
357 (synopsis "The Nix package manager")
359 "Nix is a purely functional package manager. This means that it treats
360 packages like values in purely functional programming languages such as
361 Haskell—they are built by functions that don't have side-effects, and they
362 never change after they have been built. Nix stores packages in the Nix
363 store, usually the directory /nix/store, where each package has its own unique
373 (uri (string-append "mirror://gnu/stow/stow-"
377 "1pvky9fayms4r6fhns8jd0vavszd7d979w62vfd5n88v614pdxz2"))))
378 (build-system gnu-build-system)
382 `(("perl-test-simple" ,perl-test-simple)
383 ("perl-test-output" ,perl-test-output)
384 ("perl-capture-tiny" ,perl-capture-tiny)
385 ("perl-io-stringy" ,perl-io-stringy)))
386 (home-page "https://www.gnu.org/software/stow/")
387 (synopsis "Managing installed software packages")
389 "GNU Stow is a symlink manager. It generates symlinks to directories
390 of data and makes them appear to be merged into the same directory. It is
391 typically used for managing software packages installed from source, by
392 letting you install them apart in distinct directories and then create
393 symlinks to the files in a common directory such as /usr/local.")
402 (uri (string-append "http://rpm.org/releases/rpm-4.12.x/rpm-"
406 "0a82ym8phx7g0f3k6smvxnvzh7yv857l42xafk49689kzhld5pbp"))
407 (patches (search-patches "rpm-CVE-2014-8118.patch"))))
408 (build-system gnu-build-system)
410 '(#:configure-flags '("--with-external-db" ;use the system's bdb
413 #:phases (modify-phases %standard-phases
414 (add-before 'configure 'set-nspr-search-path
415 (lambda* (#:key inputs #:allow-other-keys)
416 ;; nspr.pc contains the right -I flag pointing to
417 ;; 'include/nspr', but unfortunately 'configure' doesn't
418 ;; use 'pkg-config'. Thus, augment CPATH.
420 (let ((nspr (assoc-ref inputs "nspr"))
421 (nss (assoc-ref inputs "nss")))
423 (string-append (getenv "C_INCLUDE_PATH") ":"
424 nspr "/include/nspr:"
426 (setenv "LIBRARY_PATH"
427 (string-append (getenv "LIBRARY_PATH") ":"
430 (add-after 'install 'fix-rpm-symlinks
431 (lambda* (#:key outputs #:allow-other-keys)
432 ;; 'make install' gets these symlinks wrong. Fix them.
433 (let* ((out (assoc-ref outputs "out"))
434 (bin (string-append out "/bin")))
435 (with-directory-excursion bin
436 (for-each (lambda (file)
438 (symlink "rpm" file))
439 '("rpmquery" "rpmverify"))
442 `(("pkg-config" ,pkg-config)))
444 `(("python" ,python-2)
450 ("libarchive" ,libarchive)
451 ("nettle" ,nettle) ;XXX: actually a dependency of libarchive
456 (home-page "http://www.rpm.org/")
457 (synopsis "The RPM Package Manager")
459 "The RPM Package Manager (RPM) is a command-line driven package
460 management system capable of installing, uninstalling, verifying, querying,
461 and updating computer software packages. Each software package consists of an
462 archive of files along with information about the package like its version, a
463 description. There is also a library permitting developers to manage such
464 transactions from C or Python.")
466 ;; The whole is GPLv2+; librpm itself is dual-licensed LGPLv2+ | GPLv2+.
469 (define-public diffoscope
475 (uri (pypi-uri name version))
478 "093lxy6zj69i19fxdkj3jnai3b1ajqbksyqcvy8wqj3plaaxjna5"))))
479 (build-system python-build-system)
481 `(#:phases (modify-phases %standard-phases
482 (add-before 'unpack 'n (lambda _ #t))
483 ;; setup.py mistakenly requires python-magic from PyPi, even
484 ;; though the Python bindings of `file` are sufficient.
485 ;; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815844
486 (add-after 'unpack 'dependency-on-python-magic
488 (substitute* "setup.py"
489 (("'python-magic',") ""))))
490 (add-after 'unpack 'embed-tool-references
491 (lambda* (#:key inputs #:allow-other-keys)
492 (substitute* "diffoscope/comparators/utils/compare.py"
494 (string-append "['" (which "xxd") "',")))
495 (substitute* "diffoscope/comparators/elf.py"
496 (("@tool_required\\('readelf'\\)") "")
498 (string-append "['" (which "readelf") "',")))
500 (inputs `(("rpm" ,rpm) ;for rpm-python
501 ("python-file" ,python-file)
502 ("python-debian" ,python-debian)
503 ("python-libarchive-c" ,python-libarchive-c)
504 ("python-tlsh" ,python-tlsh)
505 ("colordiff" ,colordiff)
508 ;; Below are modules used for tests.
509 ("python-pytest" ,python-pytest)
510 ("python-chardet" ,python-chardet)))
511 (home-page "http://diffoscope.org/")
512 (synopsis "Compare files, archives, and directories in depth")
514 "Diffoscope tries to get to the bottom of what makes files or directories
515 different. It recursively unpacks archives of many kinds and transforms
516 various binary formats into more human readable forms to compare them. It can
517 compare two tarballs, ISO images, or PDFs just as easily.")