diff --git a/pkgs/tools/networking/wicd/default.nix b/pkgs/tools/networking/wicd/default.nix index ded85cd80fb9..47e417ffd8a2 100644 --- a/pkgs/tools/networking/wicd/default.nix +++ b/pkgs/tools/networking/wicd/default.nix @@ -1,6 +1,6 @@ {stdenv, fetchurl, python, pygobject, pycairo, pyGtkGlade, pythonDBus, wpa_supplicant, dhcp, dhcpcd, wirelesstools, nettools, openresolv, iproute, iputils, - locale ? "C" }: + pythonPackages, locale ? "C" }: # Wicd has a ncurses interface that we do not build because it depends # on urwid which has not been packaged at this time (2009-12-27). @@ -14,9 +14,16 @@ stdenv.mkDerivation rec { sha256 = "15ywgh60xzmp5z8l1kzics7yi95isrjg1paz42dvp7dlpdfzpzfw"; }; - buildInputs = [ python ]; + buildInputs = [ python pythonPackages.Babel ]; - patches = [ ./no-var-install.patch ./no-trans.patch ./mkdir-networks.patch ./pygtk.patch ./no-optimization.patch ]; + patches = [ + ./no-var-install.patch + ./pygtk.patch + ./no-optimization.patch + ./dhclient.patch + ./fix-app-icon.patch + ./fix-gtk-issues.patch + ]; # Should I be using pygtk's propogated build inputs? # !!! Should use makeWrapper. @@ -28,13 +35,13 @@ stdenv.mkDerivation rec { sed -i "2iexport PATH=\$PATH\$\{PATH:+:\}${python}/bin:${wpa_supplicant}/sbin:${dhcpcd}/sbin:${dhcp}/sbin:${wirelesstools}/sbin:${nettools}/sbin:${nettools}/bin:${iputils}/bin:${openresolv}/sbin:${iproute}/sbin" in/scripts=wicd.in sed -i "3iexport PYTHONPATH=\$PYTHONPATH\$\{PYTHONPATH:+:\}$(toPythonPath $out):$(toPythonPath ${pygobject}):$(toPythonPath ${pythonDBus})" in/scripts=wicd.in - sed -i "4iexport LC_ALL=\\\"${locale}\\\"" in/scripts=wicd.in sed -i "2iexport PATH=\$PATH\$\{PATH:+:\}${python}/bin" in/scripts=wicd-client.in sed -i "3iexport PYTHONPATH=\$PYTHONPATH\$\{PYTHONPATH:+:\}$(toPythonPath $out):$(toPythonPath ${pyGtkGlade})/gtk-2.0:$(toPythonPath ${pygobject}):$(toPythonPath ${pygobject})/gtk-2.0:$(toPythonPath ${pycairo}):$(toPythonPath ${pythonDBus})" in/scripts=wicd-client.in sed -i "2iexport PATH=\$PATH\$\{PATH:+:\}${python}/bin" in/scripts=wicd-gtk.in sed -i "3iexport PYTHONPATH=\$PYTHONPATH\$\{PYTHONPATH:+:\}$(toPythonPath $out):$(toPythonPath ${pyGtkGlade})/gtk-2.0:$(toPythonPath ${pygobject}):$(toPythonPath ${pygobject})/gtk-2.0:$(toPythonPath ${pycairo}):$(toPythonPath ${pythonDBus})" in/scripts=wicd-gtk.in sed -i "2iexport PATH=\$PATH\$\{PATH:+:\}${python}/bin" in/scripts=wicd-cli.in sed -i "3iexport PYTHONPATH=\$PYTHONPATH\$\{PYTHONPATH:+:\}$(toPythonPath $out):$(toPythonPath ${pyGtkGlade})/gtk-2.0:$(toPythonPath ${pygobject}):$(toPythonPath ${pycairo}):$(toPythonPath ${pythonDBus})" in/scripts=wicd-cli.in + rm po/ast.po ''; configurePhase = '' @@ -62,7 +69,7 @@ stdenv.mkDerivation rec { --systemd=$out/lib/systemd/ \ --logrotate=$out/etc/logrotate.d/ \ --desktop=$out/share/applications/ \ - --icons=$out/share/icons/hicolour/ \ + --icons=$out/share/icons/hicolor/ \ --translations=$out/share/locale/ \ --autostart=$out/etc/xdg/autostart/ \ --varlib=$out/var/lib/ \ diff --git a/pkgs/tools/networking/wicd/dhclient.patch b/pkgs/tools/networking/wicd/dhclient.patch new file mode 100644 index 000000000000..52d91846518f --- /dev/null +++ b/pkgs/tools/networking/wicd/dhclient.patch @@ -0,0 +1,101 @@ +diff -ruN wicd-1.7.2.4.orig/wicd/wnettools.py wicd-1.7.2.4/wicd/wnettools.py +--- wicd-1.7.2.4.orig/wicd/wnettools.py 2013-03-30 21:47:19.804907552 +0000 ++++ wicd-1.7.2.4/wicd/wnettools.py 2013-03-31 08:44:37.572792110 +0000 +@@ -37,6 +37,7 @@ + import time + from string import maketrans, translate + ++import tempfile + import wpath + import misc + from misc import find_path +@@ -216,6 +217,7 @@ + self.flush_tool = None + self.link_detect = None + self.dhcp_object = None ++ self.dhclient_conf_path = None; + + def SetDebugMode(self, value): + """ If True, verbose output is enabled. """ +@@ -277,12 +279,6 @@ + cmd = "" + return (client, cmd) + +- # probably /var/lib/wicd/dhclient.conf with defaults +- dhclient_conf_path = os.path.join( +- wpath.varlib, +- 'dhclient.conf' +- ) +- + client_dict = { + "dhclient" : + {'connect' : r"%(cmd)s -cf %(dhclientconf)s %(iface)s", +@@ -307,41 +303,44 @@ + } + (client_name, cmd) = get_client_name(self.DHCP_CLIENT) + +- # cause dhclient doesn't have a handy dandy argument +- # for specifing the hostname to be sent +- if client_name == "dhclient" and flavor: +- if hostname == None: +- # will use the system hostname +- # we'll use that if there is hostname passed +- # that shouldn't happen, though +- hostname = '' +- print 'attempting to set hostname with dhclient' +- print 'using dhcpcd or another supported client may work better' +- dhclient_template = \ +- open(os.path.join(wpath.etc, 'dhclient.conf.template'), 'r') +- +- output_conf = open(dhclient_conf_path, 'w') +- +- for line in dhclient_template.readlines(): +- line = line.replace('$_HOSTNAME', hostname) +- output_conf.write(line) +- +- output_conf.close() +- dhclient_template.close() +- os.chmod(dhclient_conf_path, 0644) +- + if not client_name or not cmd: + print "WARNING: Failed to find a valid dhcp client!" + return "" + + if flavor == "connect": ++ # cause dhclient doesn't have a handy dandy argument ++ # for specifing the hostname to be sent ++ if client_name == "dhclient" and flavor: ++ if hostname == None: ++ # will use the system hostname ++ # we'll use that if there is hostname passed ++ # that shouldn't happen, though ++ hostname = '' ++ print 'attempting to set hostname with dhclient' ++ print 'using dhcpcd or another supported client may work better' ++ if not self.dhclient_conf_path: ++ _,self.dhclient_conf_path = tempfile.mkstemp() ++ print 'New dhclient conf path: %s ' % self.dhclient_conf_path ++ dhclient_template = \ ++ open(os.path.join(wpath.etc, 'dhclient.conf.template'), 'r') ++ ++ output_conf = open(self.dhclient_conf_path, 'w') ++ ++ for line in dhclient_template.readlines(): ++ line = line.replace('$_HOSTNAME', hostname) ++ output_conf.write(line) ++ ++ output_conf.close() ++ dhclient_template.close() ++ os.chmod(self.dhclient_conf_path, 0644) ++ + if not hostname: + hostname = os.uname()[1] + return client_dict[client_name]['connect'] % \ + { "cmd" : cmd, + "iface" : self.iface, + "hostname" : hostname, +- 'dhclientconf' : dhclient_conf_path } ++ 'dhclientconf' : self.dhclient_conf_path } + elif flavor == "release": + return client_dict[client_name]['release'] % {"cmd":cmd, "iface":self.iface} + else: diff --git a/pkgs/tools/networking/wicd/fix-app-icon.patch b/pkgs/tools/networking/wicd/fix-app-icon.patch new file mode 100644 index 000000000000..31b47bb45881 --- /dev/null +++ b/pkgs/tools/networking/wicd/fix-app-icon.patch @@ -0,0 +1,19 @@ +Someone forgot to pack wicd.png icon. We will replace it with existing one. + +diff -ruN wicd-1.7.2.4.orig/gtk/gui.py wicd-1.7.2.4/gtk/gui.py +--- wicd-1.7.2.4.orig/gtk/gui.py 2013-03-30 21:47:19.802907553 +0000 ++++ wicd-1.7.2.4/gtk/gui.py 2013-03-31 08:13:32.876871673 +0000 +@@ -205,8 +205,10 @@ + + self.status_area.hide_all() + +- if os.path.exists(os.path.join(wpath.images, "wicd.png")): +- self.window.set_icon_from_file(os.path.join(wpath.images, "wicd.png")) ++ if os.path.exists(os.path.join(wpath.images, "../../icons/hicolour/128x128/apps/wicd-gtk.png")): ++ self.window.set_icon_from_file(os.path.join(wpath.images, "../../icons/hicolor/128x128/apps/wicd-gtk.png")) ++ else: ++ print 'icon doesn\'t exist %s' % os.path.join(wpath.images, "../../icons/hicolor/128x128/apps/wicd-gtk.png") + self.statusID = None + self.first_dialog_load = True + self.is_visible = True + diff --git a/pkgs/tools/networking/wicd/fix-gtk-issues.patch b/pkgs/tools/networking/wicd/fix-gtk-issues.patch new file mode 100644 index 000000000000..31e553b46b50 --- /dev/null +++ b/pkgs/tools/networking/wicd/fix-gtk-issues.patch @@ -0,0 +1,47 @@ +diff -ruN wicd-1.7.2.4.orig/gtk/gui.py wicd-1.7.2.4/gtk/gui.py +--- wicd-1.7.2.4.orig/gtk/gui.py 2013-03-31 17:01:29.367001288 +0000 ++++ wicd-1.7.2.4/gtk/gui.py 2013-03-31 17:55:20.826028396 +0000 +@@ -35,7 +35,7 @@ + from wicd import misc + from wicd import wpath + from wicd import dbusmanager +-from wicd.misc import noneToString ++from wicd.misc import noneToString, _status_dict + from wicd.translations import _, language + import prefs + from prefs import PreferencesDialog +@@ -250,7 +250,7 @@ + + def handle_connection_results(self, results): + if results not in ['success', 'aborted'] and self.is_visible: +- error(self.window, language[results], block=False) ++ error(self.window, misc._status_dict[results], block=False) + + def create_adhoc_network(self, widget=None): + """ Shows a dialog that creates a new adhoc network. """ +diff -ruN wicd-1.7.2.4.orig/po/ru.po wicd-1.7.2.4/po/ru.po +--- wicd-1.7.2.4.orig/po/ru.po 2013-03-31 17:01:29.362001288 +0000 ++++ wicd-1.7.2.4/po/ru.po 2013-03-31 17:43:37.909022515 +0000 +@@ -173,7 +173,7 @@ + + #: wicd/misc.py:79 + msgid "Connection Failed: Bad password" +-msgstr "Ошибка соединения: Неверный пароль:" ++msgstr "Ошибка соединения: Неверный пароль" + + #: wicd/misc.py:89 + msgid "Connection Failed: No DHCP offers received." +diff -ruN wicd-1.7.2.4.orig/wicd/misc.py wicd-1.7.2.4/wicd/misc.py +--- wicd-1.7.2.4.orig/wicd/misc.py 2013-03-31 17:01:29.369001288 +0000 ++++ wicd-1.7.2.4/wicd/misc.py 2013-03-31 17:23:56.822012593 +0000 +@@ -430,7 +430,9 @@ + """ Sanitize property names to be used in config-files. """ + allowed = string.ascii_letters + '_' + string.digits + table = string.maketrans(allowed, ' ' * len(allowed)) +- return s.translate(None, table) ++ #return s.translate(None, table) ++ #return s.translate(table) ++ return s + + def sanitize_escaped(s): + """ Sanitize double-escaped unicode strings. """ diff --git a/pkgs/tools/networking/wicd/mkdir-networks.patch b/pkgs/tools/networking/wicd/mkdir-networks.patch deleted file mode 100644 index 01563fd55dab..000000000000 --- a/pkgs/tools/networking/wicd/mkdir-networks.patch +++ /dev/null @@ -1,12 +0,0 @@ -wicd normally makes the NETWORKS directory and install the dhclient.conf.template.default at install time, -but we cannot do that, so we make it at runtime instead. - ---- wicd-1.7.0/in/scripts=wicd.in 2010-01-14 23:49:11.000000000 -0500 -+++ wicd-1.7.0/in/scripts=wicd.in 2010-11-16 22:35:50.272555487 -0500 -@@ -1,3 +1,6 @@ - #!/bin/bash - -+mkdir -p %NETWORKS% -+ln -sf @TEMPLATE-DEFAULT@ %ETC%dhclient.conf.template.default -+ - exec %PYTHON% -O %SHARE%daemon/wicd-daemon.py $@ diff --git a/pkgs/tools/networking/wicd/no-trans.patch b/pkgs/tools/networking/wicd/no-trans.patch deleted file mode 100644 index a4c5018e181c..000000000000 --- a/pkgs/tools/networking/wicd/no-trans.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- wicd-1.7.2.4/setup.py 2013-03-14 21:28:21.360580941 +0100 -+++ wicd-1.7.2.4/setup.py 2013-03-14 21:22:50.125721943 +0100 -@@ -599,12 +599,6 @@ - if not wpath.no_install_pmutils: - data.append((wpath.pmutils, ['other/55wicd'])) - print 'Using pid path', os.path.basename(wpath.pidfile) -- print 'Language support for', -- for pofile in glob('po/*.po'): -- language = pofile.replace('po/', '').replace('.po', '') -- print language, -- data.append((wpath.translations + language + '/LC_MESSAGES/', -- ['translations/' + language + '/LC_MESSAGES/wicd.mo'])) - print - except Exception, e: - print str(e)