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