gnu: Adjust formatting as recommended by 'guix lint'.
[jackhill/guix/guix.git] / gnu / packages / busybox.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages busybox)
20 #:use-module (guix licenses)
21 #:use-module (guix packages)
22 #:use-module (guix download)
23 #:use-module (guix build-system gnu)
24 #:use-module (gnu packages)
25 #:use-module (gnu packages admin)
26 #:use-module (gnu packages perl)
27 #:use-module (gnu packages zip))
28
29 (define-public busybox
30 (package
31 (name "busybox")
32 (version "1.22.1")
33 (source (origin
34 (method url-fetch)
35 (uri (string-append
36 "http://www.busybox.net/downloads/" name "-"
37 version ".tar.bz2"))
38 (sha256
39 (base32
40 "12v7nri79v8gns3inmz4k24q7pcnwi00hybs0wddfkcy1afh42xf"))))
41 (build-system gnu-build-system)
42 (arguments
43 `(#:phases
44 (alist-replace
45 'configure
46 (lambda _ (zero? (system* "make" "defconfig")))
47 (alist-replace
48 'check
49 (lambda _
50 (substitute* '("testsuite/du/du-s-works"
51 "testsuite/du/du-works")
52 (("/bin") "/etc")) ; there is no /bin but there is a /etc
53
54 ;; There is no /usr/bin or /bin - replace it with /gnu/store
55 (substitute* "testsuite/cpio.tests"
56 (("/usr/bin") (%store-directory))
57 (("usr") (car (filter (negate string-null?)
58 (string-split (%store-directory) #\/)))))
59
60 (substitute* "testsuite/date/date-works-1"
61 (("/bin/date") (which "date")))
62
63 ;; The pidof tests assume that pid 1 is called "init" but that is not
64 ;; true in guix build environment
65 (substitute* "testsuite/pidof.tests"
66 (("-s init") "-s $(cat /proc/1/comm)"))
67
68 (substitute* "testsuite/grep.tests"
69 ;; The subject of this test is buggy. It is known by upstream (fixed in git)
70 ;; So mark it with SKIP_KNOWN_BUGS like the others.
71 ;; Presumably it wasn't known at the time of release ...
72 ;; (It is strange that they release software which they know to have bugs)
73 (("testing \"grep -w \\^str doesn't match str not at the beginning\"")
74 "test x\"$SKIP_KNOWN_BUGS\" = x\"\" && testing \"grep -w ^str doesn't match str not at the beginning\""))
75
76 ;; This test cannot possibly pass.
77 ;; It is trying to test that "which ls" returns "/bin/ls" when PATH is not set.
78 ;; However, this relies on /bin/ls existing. Which it does not in guix.
79 (delete-file "testsuite/which/which-uses-default-path")
80 (rmdir "testsuite/which")
81
82 (zero? (system* "make"
83 ;; "V=1"
84 "SKIP_KNOWN_BUGS=1"
85 "SKIP_INTERNET_TESTS=1"
86 "check")))
87 (alist-replace
88 'install
89 (lambda* (#:key outputs #:allow-other-keys)
90 (let ((out (assoc-ref outputs "out")))
91 (zero?
92 (system* "make"
93 (string-append "CONFIG_PREFIX=" out)
94 "install"))))
95 %standard-phases)))))
96 (native-inputs `(("perl" ,perl) ; needed to generate the man pages (pod2man)
97 ;; The following are needed by the tests.
98 ("inetutils" ,inetutils)
99 ("zip" ,zip)))
100 (synopsis "Many common UNIX utilities in a single executable")
101 (description "BusyBox combines tiny versions of many common UNIX utilities
102 into a single small executable. It provides a fairly complete environment for
103 any small or embedded system.")
104 (home-page "http://www.busybox.net")
105 ;; Some files are gplv2+
106 (license gpl2)))