| 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 | #:use-module (gnu packages python-xyz)) |
| 37 | |
| 38 | (define-public wicd |
| 39 | (package |
| 40 | (name "wicd") |
| 41 | (version "1.7.4") |
| 42 | (source |
| 43 | (origin |
| 44 | (method url-fetch) |
| 45 | (uri (string-append "https://launchpad.net/wicd/" |
| 46 | (version-major+minor version) "/" version |
| 47 | "/+download/wicd-" version ".tar.gz")) |
| 48 | (sha256 |
| 49 | (base32 "0qpbwwsrqdp40mm3a8djpn2d055rxxspdhwijwsdnws700a9d637")) |
| 50 | (patches (search-patches |
| 51 | "wicd-bitrate-none-fix.patch" |
| 52 | "wicd-get-selected-profile-fix.patch" |
| 53 | "wicd-urwid-1.3.patch" |
| 54 | "wicd-wpa2-ttls.patch")))) |
| 55 | (build-system python-build-system) |
| 56 | (native-inputs `(("gettext" ,gettext-minimal))) |
| 57 | (inputs `(("dbus-glib" ,dbus-glib) |
| 58 | ("python2-dbus" ,python2-dbus) |
| 59 | ("python2-pygtk" ,python2-pygtk) |
| 60 | ("python2-urwid" ,python2-urwid) |
| 61 | ("python2-babel" ,python2-babel) |
| 62 | ("wireless-tools" ,wireless-tools) |
| 63 | ("wpa-supplicant" ,wpa-supplicant) |
| 64 | ("net-tools" ,net-tools) |
| 65 | ("isc-dhcp" ,isc-dhcp) |
| 66 | ("iproute" ,iproute) |
| 67 | ("hicolor-icon-theme" ,hicolor-icon-theme))) |
| 68 | (arguments |
| 69 | `(#:python ,python-2 |
| 70 | #:tests? #f ; test suite requires networking |
| 71 | ;; wicd directly extends distutils command classes, |
| 72 | ;; we can't easily make setup.py use setuptools. |
| 73 | #:use-setuptools? #f |
| 74 | #:phases |
| 75 | (modify-phases %standard-phases |
| 76 | (add-before 'build 'configure |
| 77 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 78 | (let ((out (assoc-ref outputs "out")) |
| 79 | (python (assoc-ref inputs "python"))) |
| 80 | (define (which* cmd) |
| 81 | (cond ((string=? cmd "ping") |
| 82 | "/run/setuid-programs/ping") |
| 83 | ((which cmd) |
| 84 | => identity) |
| 85 | (else |
| 86 | (format (current-error-port) |
| 87 | "WARNING: Unable to find absolute path for ~s~%" |
| 88 | cmd) |
| 89 | #f))) |
| 90 | (substitute* "setup.py" |
| 91 | ;; The handling of unrecognized distros in setup.py is |
| 92 | ;; broken. Work around the problem. |
| 93 | (("\\('init=', " all) |
| 94 | (string-append "#" all)) |
| 95 | ;; Inhibit attempts to install in /var or /etc. |
| 96 | (("\\(wpath\\.(log|etc|networks|.*scripts), " all) |
| 97 | (string-append "#" all))) |
| 98 | |
| 99 | ;; Patch references to subprograms with absolute pathnames. |
| 100 | (substitute* "wicd/wnettools.py" |
| 101 | (("(misc\\.Run\\(\\[?[\"'])([^\"' ]*)" all pre cmd) |
| 102 | (string-append pre (which* cmd))) |
| 103 | (("(self\\._find_program_path|misc\\.find_path)\\([\"']([^\"']*)[\"']\\)" |
| 104 | all dummy cmd) |
| 105 | (let ((pathname (which* cmd))) |
| 106 | (if pathname |
| 107 | (string-append "'" pathname "'") |
| 108 | "None"))) |
| 109 | (("([\"'])(ifconfig|route|wpa_cli|wpa_supplicant|iwconfig|iwpriv|iwlist|ping)" |
| 110 | all open-quote cmd) |
| 111 | (string-append open-quote (which* cmd)))) |
| 112 | |
| 113 | ;; setup.py cannot cope without LANG |
| 114 | (setenv "LANG" "C") |
| 115 | |
| 116 | (let ((params |
| 117 | (list |
| 118 | (string-append "--python=" python "/bin/python") |
| 119 | "--no-install-init" |
| 120 | "--no-install-docs" |
| 121 | "--no-install-acpi" |
| 122 | "--no-install-pmutils" |
| 123 | "--no-install-kde" |
| 124 | "--no-install-gnome-shell-extensions" |
| 125 | |
| 126 | "--distro=guixsd" |
| 127 | "--wicdgroup=netdev" |
| 128 | "--loggroup=root" |
| 129 | "--logperms=0640" |
| 130 | |
| 131 | ;; XXX setup.py configure asks us to pass --init=, |
| 132 | ;; but if we do it says "no such option 'init'". |
| 133 | ;; (string-append "--init=" out "/etc/init.d") |
| 134 | |
| 135 | (string-append "--initfile=" out "/etc/init.d/wicd") |
| 136 | (string-append "--lib=" out "/lib/wicd") |
| 137 | (string-append "--share=" out "/share/wicd") |
| 138 | |
| 139 | "--etc=/etc/wicd" |
| 140 | "--scripts=/etc/wicd/scripts" |
| 141 | "--pmutils=/etc/pm-utils/sleep.d" |
| 142 | |
| 143 | (string-append "--encryption=" |
| 144 | out "/etc/encryption/templates") |
| 145 | (string-append "--bin=" out "/bin") |
| 146 | (string-append "--sbin=" out "/sbin") |
| 147 | (string-append "--daemon=" out "/share/wicd/daemon") |
| 148 | (string-append "--backends=" out "/share/wicd/backends") |
| 149 | (string-append "--curses=" out "/share/wicd/curses") |
| 150 | (string-append "--gtk=" out "/share/wicd/gtk") |
| 151 | (string-append "--cli=" out "/share/wicd/cli") |
| 152 | (string-append "--gnome-shell-extensions=" |
| 153 | out "/share/gnome-shell-extensions") |
| 154 | (string-append "--icons=" out "/share/icons/hicolor") |
| 155 | (string-append "--pixmaps=" out "/share/pixmaps") |
| 156 | (string-append "--images=" out "/share/icons") |
| 157 | (string-append "--dbus=" out "/etc/dbus-1/system.d") |
| 158 | (string-append "--dbus-service=" |
| 159 | out "/share/dbus-1/system-services") |
| 160 | (string-append "--systemd=" out "/lib/systemd/system") |
| 161 | (string-append "--logrotate=" out "/etc/logrotate.d") |
| 162 | (string-append "--desktop=" out "/share/applications") |
| 163 | (string-append "--translations=" out "/share/locale") |
| 164 | (string-append "--autostart=" out "/etc/xdg/autostart") |
| 165 | (string-append "--docdir=" out "/share/doc/wicd") |
| 166 | (string-append "--mandir=" out "/share/man") |
| 167 | (string-append "--kdedir=" out "/share/autostart")))) |
| 168 | (format #t |
| 169 | "running ~s with command ~s and parameters ~s~%" |
| 170 | "python setup.py" "configure" params) |
| 171 | (apply invoke "python" "setup.py" "configure" params))))) |
| 172 | (add-after 'install 'post-install |
| 173 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 174 | (let ((out (assoc-ref outputs "out"))) |
| 175 | ;; wicd's installer tries to put dhclient.conf.template.default |
| 176 | ;; in /etc/wicd/other, which is not available in the build |
| 177 | ;; environment, so here we install it manually in the output |
| 178 | ;; directory. |
| 179 | (let ((dest-dir (string-append out "/etc/wicd")) |
| 180 | (name "dhclient.conf.template.default")) |
| 181 | (install-file (string-append "other/" name) dest-dir)) |
| 182 | |
| 183 | ;; Copy index.theme from hicolor-icon-theme. This is needed to |
| 184 | ;; allow wicd-gtk to find its icons. |
| 185 | (let ((hicolor (assoc-ref inputs "hicolor-icon-theme")) |
| 186 | (name "/share/icons/hicolor/index.theme")) |
| 187 | (install-file (string-append hicolor name) |
| 188 | (string-append out "/share/icons/hicolor"))) |
| 189 | #t)))))) |
| 190 | (synopsis "Network connection manager") |
| 191 | (description "Wicd is a network manager that aims to simplify wired and |
| 192 | wireless networking.") |
| 193 | (home-page "https://launchpad.net/wicd") |
| 194 | (license gpl2+))) |