From 139673c71df4698b131b7e99e20efe38e9a3e6e1 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 10 Jul 2011 14:43:41 +0200 Subject: [PATCH] wicd: add patches for python-2.7, fix openrc service. --- srcpkgs/wicd/files/wicd.rc | 1 - .../patches/deepcopy+python27-fixes.patch | 72 +++++++++++++++++++ .../wicd/patches/wicd-scripts-execution.patch | 24 +++++++ srcpkgs/wicd/template | 23 +++--- 4 files changed, 107 insertions(+), 13 deletions(-) create mode 100644 srcpkgs/wicd/patches/deepcopy+python27-fixes.patch create mode 100644 srcpkgs/wicd/patches/wicd-scripts-execution.patch diff --git a/srcpkgs/wicd/files/wicd.rc b/srcpkgs/wicd/files/wicd.rc index 154e135cb86..4370e768312 100644 --- a/srcpkgs/wicd/files/wicd.rc +++ b/srcpkgs/wicd/files/wicd.rc @@ -6,5 +6,4 @@ pidfile=/var/run/wicd/wicd.pid depend() { need dbus - need hal } diff --git a/srcpkgs/wicd/patches/deepcopy+python27-fixes.patch b/srcpkgs/wicd/patches/deepcopy+python27-fixes.patch new file mode 100644 index 00000000000..51a2c8312dc --- /dev/null +++ b/srcpkgs/wicd/patches/deepcopy+python27-fixes.patch @@ -0,0 +1,72 @@ +diff -ur wicd-1.7.0/wicd/configmanager.py wicd-1.7.0.new/wicd/configmanager.py +--- wicd-1.7.0/wicd/configmanager.py 2010-01-15 05:49:11.000000000 +0100 ++++ wicd-1.7.0.new/wicd/configmanager.py 2010-10-08 13:14:22.084345024 +0200 +@@ -35,7 +35,7 @@ + class ConfigManager(RawConfigParser): + """ A class that can be used to manage a given configuration file. """ + def __init__(self, path, debug=False, mark_whitespace="`'`"): +- RawConfigParser.__init__(self) ++ RawConfigParser.__init__(self, allow_no_value=True) + self.config_file = path + self.debug = debug + self.mrk_ws = mark_whitespace +@@ -176,28 +176,35 @@ + + + def _copy_section(self, name): +- # Yes, deepcopy sucks, but it is robust to changes in both +- # this class and RawConfigParser. +- p = copy.deepcopy(self) +- for sname in p.sections(): +- if sname != name: +- p.remove_section(sname) ++ p = ConfigManager("", self.debug, self.mrk_ws) ++ p.add_section(name) ++ for (iname, value) in self.items(name): ++ p.set(name, iname, value) ++ # Store the filename this section was read from. + p.config_file = p.get_option(name, '_filename_', p.config_file) + p.remove_option(name, '_filename_') + return p + + def write(self): + """ Writes the loaded config file to disk. """ +- # Really don't like this deepcopy. +- p = copy.deepcopy(self) +- for sname in p.sections(): +- fname = p.get_option(sname, '_filename_') ++ in_this_file = [] ++ for sname in self.sections(): ++ fname = self.get_option(sname, '_filename_') + if fname and fname != self.config_file: ++ # Write sections from other files + section = self._copy_section(sname) +- p.remove_section(sname) + section._write_one() ++ else: ++ # Save names of local sections ++ in_this_file.append(sname) + +- for sname in p.sections(): ++ # Make an instance with only these sections ++ p = ConfigManager("", self.debug, self.mrk_ws) ++ p.config_file = self.config_file ++ for sname in in_this_file: ++ p.add_section(sname) ++ for (iname, value) in self.items(sname): ++ p.set(sname, iname, value) + p.remove_option(sname, '_filename_') + p._write_one() + +diff -ur wicd-1.7.0/wicd/wicd-daemon.py wicd-1.7.0.new/wicd/wicd-daemon.py +--- wicd-1.7.0/wicd/wicd-daemon.py 2010-01-15 05:49:11.000000000 +0100 ++++ wicd-1.7.0.new/wicd/wicd-daemon.py 2010-10-08 13:11:15.811786603 +0200 +@@ -1802,7 +1802,7 @@ + wicd_bus = dbus.service.BusName('org.wicd.daemon', bus=bus) + daemon = WicdDaemon(wicd_bus, auto_connect=auto_connect) + if not no_poll: +- child_pid = Popen([misc.find_path("python"), "-O", ++ child_pid = Popen([misc.find_path("python2"), "-O", + os.path.join(wpath.daemon, "monitor.py")], + shell=False, close_fds=True).pid + atexit.register(on_exit, child_pid) diff --git a/srcpkgs/wicd/patches/wicd-scripts-execution.patch b/srcpkgs/wicd/patches/wicd-scripts-execution.patch new file mode 100644 index 00000000000..35cf5bb431a --- /dev/null +++ b/srcpkgs/wicd/patches/wicd-scripts-execution.patch @@ -0,0 +1,24 @@ +=== modified file 'wicd/networking.py' +--- wicd-1.7.0.orig/wicd/networking.py 2010-01-15 04:02:10 +0000 ++++ wicd-1.7.0/wicd/networking.py 2010-01-27 19:06:21 +0000 +@@ -215,8 +215,8 @@ + if self.pre_disconnect_script: + print 'Running pre-disconnect script' + misc.ExecuteScript(expand_script_macros(self.pre_disconnect_script, +- 'pre-disconnection', (mac, +- name)), ++ 'pre-disconnection', ++ mac, name), + self.debug) + iface.ReleaseDHCP() + iface.SetAddress('0.0.0.0') +@@ -229,7 +229,7 @@ + print 'Running post-disconnect script' + misc.ExecuteScript(expand_script_macros(self.post_disconnect_script, + 'post-disconnection', +- (mac, name)), ++ mac, name), + self.debug) + + def ReleaseDHCP(self): + diff --git a/srcpkgs/wicd/template b/srcpkgs/wicd/template index 16783ca2faf..e83ff56515c 100644 --- a/srcpkgs/wicd/template +++ b/srcpkgs/wicd/template @@ -1,11 +1,14 @@ # Template file for 'wicd' pkgname=wicd version=1.7.0 -revision=1 +revision=2 +patch_args="-Np1" distfiles="${SOURCEFORGE_SITE}/$pkgname/$pkgname-$version.tar.bz2" build_style=custom-install short_desc="Open source wired and wireless network manager" maintainer="Juan RP " +homepage="http://wicd.sourceforge.net" +license="GPL-2" checksum=14c5692bf8a4c93c9ac083ce9ad677b0d9022b19f84e777854766b2a6f753b32 long_desc=" Wicd is an open source wired and wireless network manager for Linux @@ -46,18 +49,14 @@ Add_dependency full notify-python do_install() { - cd ${wrksrc} || return 1 python setup.py configure --no-install-init \ --resume=/usr/share/wicd/scripts \ - --suspend=/usr/share/wicd/scripts || return 1 - python setup.py install --root=${DESTDIR} || return 1 + --suspend=/usr/share/wicd/scripts + python setup.py install --root=${DESTDIR} - install -D -m755 ${FILESDIR}/wicd.rc \ - ${DESTDIR}/etc/init.d/wicd || return 1 - install -d ${DESTDIR}/usr/share/applications || return 1 - install -m644 ${FILESDIR}/wicd.desktop \ - ${DESTDIR}/usr/share/applications || return 1 - install -d ${DESTDIR}/usr/lib/wicd || return 1 - install -D -m755 build/lib/wicd/*.py \ - ${DESTDIR}/usr/lib/wicd || return 1 + vinstall ${FILESDIR}/wicd.rc 755 etc/init.d wicd + vinstall ${FILESDIR}/wicd.desktop 644 usr/share/applications + vmkdir usr/lib/wicd + vcopy "build/lib/wicd/*.py" usr/lib/wicd + chmod 755 ${DESTDIR}/usr/lib/wicd/*.py }