Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / wicd.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
3 ;;; Copyright © 2015 Pierre-Antoine Rault <par@rigelk.eu>
4 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
5 ;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages wicd)
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix build-system python)
26 #:use-module (guix licenses)
27 #:use-module (guix utils)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages glib)
30 #:use-module (gnu packages gtk)
31 #:use-module (gnu packages gnome)
32 #:use-module (gnu packages gettext)
33 #:use-module (gnu packages linux)
34 #:use-module (gnu packages admin)
35 #:use-module (gnu packages python))
36
37 (define-public wicd
38 (package
39 (name "wicd")
40 (version "1.7.4")
41 (source
42 (origin
43 (method url-fetch)
44 (uri (string-append "https://launchpad.net/wicd/"
45 (version-major+minor version) "/" version
46 "/+download/wicd-" version ".tar.gz"))
47 (sha256
48 (base32 "0qpbwwsrqdp40mm3a8djpn2d055rxxspdhwijwsdnws700a9d637"))
49 (patches (search-patches
50 "wicd-bitrate-none-fix.patch"
51 "wicd-get-selected-profile-fix.patch"
52 "wicd-urwid-1.3.patch"
53 "wicd-wpa2-ttls.patch"))))
54 (build-system python-build-system)
55 (native-inputs `(("gettext" ,gettext-minimal)))
56 (inputs `(("dbus-glib" ,dbus-glib)
57 ("python2-dbus" ,python2-dbus)
58 ("python2-pygtk" ,python2-pygtk)
59 ("python2-urwid" ,python2-urwid)
60 ("python2-babel" ,python2-babel)
61 ("wireless-tools" ,wireless-tools)
62 ("wpa-supplicant" ,wpa-supplicant)
63 ("net-tools" ,net-tools)
64 ("isc-dhcp" ,isc-dhcp)
65 ("iproute" ,iproute)
66 ("hicolor-icon-theme" ,hicolor-icon-theme)))
67 (arguments
68 `(#:python ,python-2
69 #:tests? #f ; test suite requires networking
70 #:phases
71 (alist-cons-before
72 'build 'configure
73 (lambda* (#:key inputs outputs #:allow-other-keys)
74 (let ((out (assoc-ref outputs "out"))
75 (python (assoc-ref inputs "python")))
76 (define (which* cmd)
77 (cond ((string=? cmd "ping")
78 "/run/setuid-programs/ping")
79 ((which cmd)
80 => identity)
81 (else
82 (format (current-error-port)
83 "WARNING: Unable to find absolute path for ~s~%"
84 cmd)
85 #f)))
86 (substitute* "setup.py"
87 ;; The handling of unrecognized distros in setup.py is
88 ;; broken. Work around the problem.
89 (("\\('init=', " all)
90 (string-append "#" all))
91 ;; Inhibit attempts to install in /var or /etc.
92 (("\\(wpath\\.(log|etc|networks|.*scripts), " all)
93 (string-append "#" all)))
94
95 ;; Patch references to subprograms with absolute pathnames.
96 (substitute* "wicd/wnettools.py"
97 (("(misc\\.Run\\(\\[?[\"'])([^\"' ]*)" all pre cmd)
98 (string-append pre (which* cmd)))
99 (("(self\\._find_program_path|misc\\.find_path)\\([\"']([^\"']*)[\"']\\)"
100 all dummy cmd)
101 (let ((pathname (which* cmd)))
102 (if pathname
103 (string-append "'" pathname "'")
104 "None")))
105 (("([\"'])(ifconfig|route|wpa_cli|wpa_supplicant|iwconfig|iwpriv|iwlist|ping)"
106 all open-quote cmd)
107 (string-append open-quote (which* cmd))))
108
109 ;; setup.py cannot cope without LANG
110 (setenv "LANG" "C")
111
112 (let ((params
113 (list
114 (string-append "--python=" python "/bin/python")
115 "--no-install-init"
116 "--no-install-docs"
117 "--no-install-acpi"
118 "--no-install-pmutils"
119 "--no-install-kde"
120 "--no-install-gnome-shell-extensions"
121
122 "--distro=guixsd"
123 "--wicdgroup=netdev"
124 "--loggroup=root"
125 "--logperms=0640"
126
127 ;; XXX setup.py configure asks us to pass --init=,
128 ;; but if we do it says "no such option 'init'".
129 ;; (string-append "--init=" out "/etc/init.d")
130
131 (string-append "--initfile=" out "/etc/init.d/wicd")
132 (string-append "--lib=" out "/lib/wicd")
133 (string-append "--share=" out "/share/wicd")
134
135 "--etc=/etc/wicd"
136 "--scripts=/etc/wicd/scripts"
137 "--pmutils=/etc/pm-utils/sleep.d"
138
139 (string-append "--encryption="
140 out "/etc/encryption/templates")
141 (string-append "--bin=" out "/bin")
142 (string-append "--sbin=" out "/sbin")
143 (string-append "--daemon=" out "/share/wicd/daemon")
144 (string-append "--backends=" out "/share/wicd/backends")
145 (string-append "--curses=" out "/share/wicd/curses")
146 (string-append "--gtk=" out "/share/wicd/gtk")
147 (string-append "--cli=" out "/share/wicd/cli")
148 (string-append "--gnome-shell-extensions="
149 out "/share/gnome-shell-extensions")
150 (string-append "--icons=" out "/share/icons/hicolor")
151 (string-append "--pixmaps=" out "/share/pixmaps")
152 (string-append "--images=" out "/share/icons")
153 (string-append "--dbus=" out "/etc/dbus-1/system.d")
154 (string-append "--dbus-service="
155 out "/share/dbus-1/system-services")
156 (string-append "--systemd=" out "/lib/systemd/system")
157 (string-append "--logrotate=" out "/etc/logrotate.d")
158 (string-append "--desktop=" out "/share/applications")
159 (string-append "--translations=" out "/share/locale")
160 (string-append "--autostart=" out "/etc/xdg/autostart")
161 (string-append "--docdir=" out "/share/doc/wicd")
162 (string-append "--mandir=" out "/share/man")
163 (string-append "--kdedir=" out "/share/autostart"))))
164 (format #t
165 "running ~s with command ~s and parameters ~s~%"
166 "python setup.py" "configure" params)
167 (zero? (apply system* "python" "setup.py" "configure" params)))))
168 (alist-cons-after
169 'install 'post-install
170 (lambda* (#:key inputs outputs #:allow-other-keys)
171 (let ((out (assoc-ref outputs "out")))
172 ;; wicd's installer tries to put dhclient.conf.template.default
173 ;; in /etc/wicd/other, which is not available in the build
174 ;; environment, so here we install it manually in the output
175 ;; directory.
176 (let ((dest-dir (string-append out "/etc/wicd"))
177 (name "dhclient.conf.template.default"))
178 (install-file (string-append "other/" name) dest-dir))
179
180 ;; Copy index.theme from hicolor-icon-theme. This is needed to
181 ;; allow wicd-gtk to find its icons.
182 (let ((hicolor (assoc-ref inputs "hicolor-icon-theme"))
183 (name "/share/icons/hicolor/index.theme"))
184 (install-file (string-append hicolor name)
185 (string-append out "/share/icons/hicolor")))
186 #t))
187 %standard-phases))))
188 (synopsis "Network connection manager")
189 (description "Wicd is a network manager that aims to simplify wired and
190 wireless networking.")
191 (home-page "https://launchpad.net/wicd")
192 (license gpl2+)))