2009-08-05 Brian Cameron <
[email protected]>
* base-specs/moovida.spec, patches/moovida-04-pidof.diff: Add
back reworked patch - it is still needed.
--- a/ChangeLog Thu Aug 06 16:18:40 2009 +0000
+++ b/ChangeLog Thu Aug 06 16:30:48 2009 +0000
@@ -1,3 +1,8 @@
+2009-08-05 Brian Cameron <[email protected]>
+
+ * base-specs/moovida.spec, patches/moovida-04-pidof.diff: Add
+ back reworked patch - it is still needed.
+
2009-08-05 Brian Cameron <[email protected]>
* SFEmoovida-plugins.spec, base-specs/moovida.spec,
--- a/base-specs/moovida.spec Thu Aug 06 16:18:40 2009 +0000
+++ b/base-specs/moovida.spec Thu Aug 06 16:30:48 2009 +0000
@@ -29,6 +29,8 @@
Patch2: moovida-02-noautoupdate.diff
#date:2008-11-26 owner:yippi type:branding
Patch3: moovida-03-manpage.diff
+#date:2009-08-06 owner:yippi type:bug bugid:400134
+Patch4: moovida-04-pidof.diff
%description
Moovida is an open source cross-platform media center solution.
@@ -42,6 +44,7 @@
%patch1 -p1
%patch2 -p1
%patch3 -p1
+%patch4 -p1
%build
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/moovida-04-pidof.diff Thu Aug 06 16:30:48 2009 +0000
@@ -0,0 +1,55 @@
+--- elisa-1.0.6/elisa/core/utils/misc.py-orig 2009-08-06 11:25:58.307494000 -0500
++++ elisa-1.0.6/elisa/core/utils/misc.py 2009-08-06 11:26:55.181318000 -0500
+@@ -25,6 +25,7 @@ reasonnably small.
+ import platform
+ import os, re
+ import subprocess
++import threading
+
+ from twisted.trial.unittest import SkipTest
+
+@@ -209,17 +210,30 @@ def get_os_name():
+ else:
+ return platform.system().lower()
+
+-def linux_pidof(program_name):
++def unix_pidof(program_name):
+ """
+- Get the Linux process id of the given program name. Because
++ Get the UNIX process id of the given program name. Because
+ multiple processes can exist, we return a list of the pids.
+
+ @rtype: C{list} of C{int}
+ @returns: the list of running pids of given program name
+ """
+- output = subprocess.Popen(["pidof", program_name],
+- stderr=subprocess.STDOUT,
+- stdout=subprocess.PIPE).communicate()[0]
++ try:
++ lock = threading.Lock()
++ lock.acquire()
++ if platform.system() == 'SunOS':
++ output = subprocess.Popen(["/bin/sh", "-c", "/usr/bin/pgrep -u `whoami` %s" % program_name],
++ stderr=subprocess.STDOUT,
++ stdout=subprocess.PIPE,
++ close_fds=True).communicate()[0]
++ else:
++ output = subprocess.Popen(["pidof", program_name],
++ stderr=subprocess.STDOUT,
++ stdout=subprocess.PIPE,
++ close_fds=True).communicate()[0]
++ finally:
++ lock.release()
++
+ return [int(pid) for pid in output.split()]
+
+ def get_user_desktop_name():
+@@ -255,7 +269,7 @@ def get_user_desktop_name():
+ 'xfwm4': 'xfce',
+ }
+ for prog, name in progs.iteritems():
+- if linux_pidof(prog) != []:
++ if unix_pidof(prog) != []:
+ desktop_name = name
+ break
+ if desktop_name is None: