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 (ice-9 match))
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/"
62 "/20150101/guile-2.0.11.tar.xz")
63 (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
65 "/20131110/guile-2.0.9.tar.xz")))
67 (define-public guix-0.12.0
73 (uri (string-append "ftp://alpha.gnu.org/gnu/guix/guix-"
77 "1jgy5mlygmhxdqhrp6vr8w83ndcm5mk64xfravr8l2d7hq8y40b2"))))
78 (build-system gnu-build-system)
80 `(#:configure-flags (list
81 "--localstatedir=/var"
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
89 #:parallel-tests? #f ;work around <http://bugs.gnu.org/21097>
90 #:phases (modify-phases %standard-phases
92 'configure 'copy-bootstrap-guile
93 (lambda* (#:key system inputs #:allow-other-keys)
94 (define (boot-guile-version arch)
95 (if (string=? "armhf" arch)
100 (let ((guile (assoc-ref inputs
101 (string-append "boot-guile/"
103 (target (string-append "gnu/packages/bootstrap/"
106 (boot-guile-version arch)
108 (copy-file guile target)))
116 'unpack 'disable-container-tests
117 ;; XXX FIXME: These tests fail within the build container.
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")
130 (add-before 'check 'set-SHELL
132 ;; 'guix environment' tests rely on 'SHELL' having a
133 ;; correct value, so set it.
134 (setenv "SHELL" (which "sh"))
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"))
146 json "/share/guile/site/2.0:"
147 ssh "/share/guile/site/2.0:"
148 gnutls "/share/guile/site/2.0")))
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)))
160 (native-inputs `(("pkg-config" ,pkg-config)
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)
169 ("graphviz" ,graphviz)
170 ("help2man" ,help2man)))
172 (let ((boot-guile (lambda (arch hash)
175 (uri (boot-guile-uri arch))
179 ("zlib" ,zlib) ;for 'guix publish'
182 ("libgcrypt" ,libgcrypt)
188 "0im800m30abgh7msh331pcbjvb4n02smz5cfzf1srv0kpx3csmxp")))
190 ,(boot-guile "x86_64"
192 "1w2p5zyrglzzniqgvyn1b55vprfzhgk8vzbzkkbdgl5248si0yq3")))
193 ("boot-guile/mips64el"
194 ,(boot-guile "mips64el"
196 "0fzp93lvi0hn54acc0fpvhc7bvl0yc853k62l958cihk03q80ilr")))
200 "1mi3brl7l58aww34rawhvja84xc7l1b4hmwdmc36fp9q9mfx0lg5"))))))
202 `(("gnutls" ,gnutls) ;for 'guix download' & co.
203 ("guile-json" ,guile-json)
204 ("guile-ssh" ,guile-ssh)))
206 (home-page "http://www.gnu.org/software/guix")
207 (synopsis "Functional package manager for installed software packages and versions")
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.")
215 (properties '((ftp-server . "alpha.gnu.org")))))
218 ;; Development version of Guix.
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)))
228 ;; "git://git.sv.gnu.org/guix.git" temporarily
229 ;; unavailable (XXX).
230 (url "http://git.savannah.gnu.org/r/guix.git")
234 "16pxqbywhayazdgg9l19frigncmyq20j5fvaq4zgvm0iidndhfja"))
235 (file-name (string-append "guix-" version "-checkout"))))
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))
244 `(modify-phases ,phases
248 ;; Make sure 'msgmerge' can modify the PO files.
249 (for-each (lambda (po)
251 (find-files "." "\\.po$"))
253 (zero? (system* "sh" "bootstrap")))))))))))
255 (define-public guix guix-devel)
257 (define (source-file? file stat)
258 "Return true if FILE is likely a source file, false if it is a typical
260 (define (wrong-extension? file)
261 (or (string-suffix? "~" file)
262 (member (file-extension file)
263 '("o" "a" "lo" "so" "go"))))
265 (match (basename file)
266 ((or ".git" "autom4te.cache" "configure" "Makefile" "Makefile.in" ".libs")
268 ((? wrong-extension?)
273 (define-public current-guix
274 (let ((select? (delay (or (git-predicate
275 (string-append (current-source-directory)
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'."
284 (version (string-append (package-version guix) "+"))
285 (source (local-file "../.." "guix-current"
287 #:select? (force select?)))))))
300 (uri (string-append "http://nixos.org/releases/nix/nix-"
301 version "/nix-" version ".tar.xz"))
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.
311 ;; Set the prefixes of Perl libraries to avoid propagation.
312 (let ((perl-libdir (lambda (p)
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)
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")
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
349 (uri (string-append "mirror://gnu/stow/stow-"
353 "1pvky9fayms4r6fhns8jd0vavszd7d979w62vfd5n88v614pdxz2"))))
354 (build-system gnu-build-system)
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")
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.")
378 (uri (string-append "http://rpm.org/releases/rpm-4.12.x/rpm-"
382 "0a82ym8phx7g0f3k6smvxnvzh7yv857l42xafk49689kzhld5pbp"))
383 (patches (search-patches "rpm-CVE-2014-8118.patch"))))
384 (build-system gnu-build-system)
386 '(#:configure-flags '("--with-external-db" ;use the system's bdb
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.
396 (let ((nspr (assoc-ref inputs "nspr"))
397 (nss (assoc-ref inputs "nss")))
399 (string-append (getenv "C_INCLUDE_PATH") ":"
400 nspr "/include/nspr:"
402 (setenv "LIBRARY_PATH"
403 (string-append (getenv "LIBRARY_PATH") ":"
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)
414 (symlink "rpm" file))
415 '("rpmquery" "rpmverify"))
418 `(("pkg-config" ,pkg-config)))
420 `(("python" ,python-2)
426 ("libarchive" ,libarchive)
427 ("nettle" ,nettle) ;XXX: actually a dependency of libarchive
432 (home-page "http://www.rpm.org/")
433 (synopsis "The RPM Package Manager")
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.")
442 ;; The whole is GPLv2+; librpm itself is dual-licensed LGPLv2+ | GPLv2+.
445 (define-public diffoscope
451 (uri (pypi-uri name version))
454 "1bx8i6sx2mcvm166nhw0i5442ld6wigkwav8dsnv22y7gnsl9d7n"))))
455 (build-system python-build-system)
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
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"
469 (string-append "['" (which "xxd") "',")))
470 (substitute* "diffoscope/comparators/elf.py"
471 (("@tool_required\\('readelf'\\)") "")
473 (string-append "['" (which "readelf") "',")))
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)
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")
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.")