--- a/patches/gdesklets-01-Solaris-support.diff Tue Feb 20 03:34:18 2007 +0000
+++ b/patches/gdesklets-01-Solaris-support.diff Tue Feb 20 03:56:13 2007 +0000
@@ -1,6 +1,6 @@
-diff -Nrup gDesklets-0.35.3/configure.in gDesklets-old/configure.in
---- gDesklets-0.35.3/configure.in 2006-01-11 04:37:54.000000000 +0800
-+++ gDesklets-old/configure.in 2007-01-26 19:19:50.658599000 +0800
+diff -Nrup gDesklets-old/configure.in gDesklets-0.35.3/configure.in
+--- gDesklets-old/configure.in 2006-01-11 04:37:54.000000000 +0800
++++ gDesklets-0.35.3/configure.in 2007-02-14 14:39:40.805129000 +0800
@@ -136,6 +136,7 @@ libdesklets/system/Linux/Makefile
libdesklets/system/Makefile
libdesklets/system/NetBSD/Makefile
@@ -9,9 +9,41 @@
main/Makefile
plugin/Makefile
po/Makefile.in
-diff -Nrup gDesklets-0.35.3/libdesklets/system/Makefile.am gDesklets-old/libdesklets/system/Makefile.am
---- gDesklets-0.35.3/libdesklets/system/Makefile.am 2005-08-01 05:29:36.000000000 +0800
-+++ gDesklets-old/libdesklets/system/Makefile.am 2007-01-26 19:18:00.452263000 +0800
+diff -Nrup gDesklets-old/libdesklets/system/ArchFactory.py gDesklets-0.35.3/libdesklets/system/ArchFactory.py
+--- gDesklets-old/libdesklets/system/ArchFactory.py 2005-01-22 23:33:31.000000000 +0800
++++ gDesklets-0.35.3/libdesklets/system/ArchFactory.py 2007-02-14 14:53:05.619030000 +0800
+@@ -10,7 +10,7 @@ def __detect_arch():
+ if (HAVE_WIN32):
+ import Windows
+ return Windows.Win32()
+-
++
+ import os
+ uname = os.uname()
+
+@@ -49,7 +49,18 @@ def __detect_arch():
+ import NetBSD
+
+ return NetBSD.Generic()
+-
++
++ elif (uname[0] == 'SunOS'):
++
++ import Solaris
++ r = os.popen('/usr/bin/uname -p').read()
++ if (r[:-1] in ('i386')):
++ return Solaris.X86()
++
++ if (r[:-1] in ('sparc')):
++ return Solaris.Sparc()
++
++ return Solaris.Generic()
+
+ log("OS/Architecture not found!")
+
+diff -Nrup gDesklets-old/libdesklets/system/Makefile.am gDesklets-0.35.3/libdesklets/system/Makefile.am
+--- gDesklets-old/libdesklets/system/Makefile.am 2005-08-01 05:29:36.000000000 +0800
++++ gDesklets-0.35.3/libdesklets/system/Makefile.am 2007-02-14 14:40:27.794268000 +0800
@@ -20,6 +20,7 @@ SUBDIRS = \
Linux \
FreeBSD \
@@ -20,9 +52,9 @@
OpenBSD
-diff -Nrup gDesklets-0.35.3/libdesklets/system/Solaris/Generic.py gDesklets-old/libdesklets/system/Solaris/Generic.py
---- gDesklets-0.35.3/libdesklets/system/Solaris/Generic.py 1970-01-01 08:00:00.000000000 +0800
-+++ gDesklets-old/libdesklets/system/Solaris/Generic.py 2007-01-26 19:16:37.374504000 +0800
+diff -Nrup gDesklets-old/libdesklets/system/Solaris/Generic.py gDesklets-0.35.3/libdesklets/system/Solaris/Generic.py
+--- gDesklets-old/libdesklets/system/Solaris/Generic.py 1970-01-01 08:00:00.000000000 +0800
++++ gDesklets-0.35.3/libdesklets/system/Solaris/Generic.py 2007-02-14 14:40:15.314517000 +0800
@@ -0,0 +1,62 @@
+from libdesklets.system.Arch import Arch
+
@@ -37,7 +69,7 @@
+ Arch.__init__(self)
+
+ self.__bogomips = re.compile('^bogomips\s+:\s+(\d+\.\d+)$', re.M)
-+ self.__net_devices = re.compile('^\s*(\w+):.*mtu', re.M)
++ self.__net_devices = re.compile('^\s*(\w+):.*mtu', re.M).findall( os.popen('/usr/sbin/ifconfig -a').read())
+
+
+
@@ -47,7 +79,7 @@
+ @rtype : list
+ """
+
-+ return self.__net_devices.findall( os.popen('/usr/sbin/ifconfig -a').read())
++ return self.__net_devices
+
+
+
@@ -57,7 +89,7 @@
+ @rtype : float
+ """
+
-+ return float(0)
++ return float(5000)
+
+
+
@@ -86,9 +118,9 @@
+ count += 1
+
+ return count
-diff -Nrup gDesklets-0.35.3/libdesklets/system/Solaris/Makefile.am gDesklets-old/libdesklets/system/Solaris/Makefile.am
---- gDesklets-0.35.3/libdesklets/system/Solaris/Makefile.am 1970-01-01 08:00:00.000000000 +0800
-+++ gDesklets-old/libdesklets/system/Solaris/Makefile.am 2007-01-26 19:16:37.355351000 +0800
+diff -Nrup gDesklets-old/libdesklets/system/Solaris/Makefile.am gDesklets-0.35.3/libdesklets/system/Solaris/Makefile.am
+--- gDesklets-old/libdesklets/system/Solaris/Makefile.am 1970-01-01 08:00:00.000000000 +0800
++++ gDesklets-0.35.3/libdesklets/system/Solaris/Makefile.am 2007-02-14 14:40:15.325847000 +0800
@@ -0,0 +1,11 @@
+installdir = ${coredir}/libdesklets/system/Solaris
+
@@ -101,10 +133,10 @@
+EXTRA_DIST = $(install_DATA)
+install_PYTHON = $(install_DATA)
+CLEANFILES = *.pyc
-diff -Nrup gDesklets-0.35.3/libdesklets/system/Solaris/Sparc.py gDesklets-old/libdesklets/system/Solaris/Sparc.py
---- gDesklets-0.35.3/libdesklets/system/Solaris/Sparc.py 1970-01-01 08:00:00.000000000 +0800
-+++ gDesklets-old/libdesklets/system/Solaris/Sparc.py 2007-01-26 19:16:37.381956000 +0800
-@@ -0,0 +1,55 @@
+diff -Nrup gDesklets-old/libdesklets/system/Solaris/Sparc.py gDesklets-0.35.3/libdesklets/system/Solaris/Sparc.py
+--- gDesklets-old/libdesklets/system/Solaris/Sparc.py 1970-01-01 08:00:00.000000000 +0800
++++ gDesklets-0.35.3/libdesklets/system/Solaris/Sparc.py 2007-02-14 14:40:15.326112000 +0800
+@@ -0,0 +1,67 @@
+from Generic import Generic
+
+import os
@@ -123,17 +155,29 @@
+ return m[0]
+
+ def _get_cache():
-+ r = re.compile('^\s+ecache-size:+\s+(.+)$',re.M).findall(os.popen('/usr/sbin/prtconf -vp').read())
-+ return int(r[0],16)
++ r = re.compile('^\s+ecache-size:+\s+(.+)$',re.M)
++ m = r.findall(os.popen('/usr/sbin/prtconf -vp').read())
++ m_int = int(m[0],16)
++ return int(round(m_int/1000))
++
++ def _read_cpu_speed():
++ r = re.compile('clock_MHz\s+(\d+)$', re.M)
++ m = r.findall(self._read_cpuinfo())
++ return float(int(m[0]))
+
+ # CPU model and cache size never changes
+ self.__model_name = _get_model()
+ self.__cache_size = _get_cache()
+
+ # the cpu speed might change (laptops have mobile CPUs)
-+ self.__speed = re.compile('clock_MHz\s+(\d+)$', re.M)
++ self.__speed = _read_cpu_speed()
+
-+
++ def _read_cpuinfo(self):
++ """
++ @return : content of cpu_info
++ @rtype : str
++ """
++ return os.popen('/usr/bin/kstat cpu_info').read()
+
+ def cpu_speed(self):
+ """
@@ -141,17 +185,17 @@
+ @rtype : float
+ """
+
-+ m = self.__speed.search( self._read_cpuinfo() )
-+ return float(int(m[0]))
-+
++ return self.__speed
+
-+ def _read_cpuinfo(self):
-+ """
-+ @return : content of cpu_info
-+ @rtype : str
-+ """
-+ return os.popen('/usr/bin/kstat cpu_info').read()
+
++ def cpu_cache(self):
++ """
++ @return : 2nd level cache of installed processor
++ @rtype : int
++ """
++
++ return self.__cache_size
++
+
+ def cpu_model(self):
+ """
@@ -160,10 +204,10 @@
+ """
+
+ return self.__model_name
-diff -Nrup gDesklets-0.35.3/libdesklets/system/Solaris/X86.py gDesklets-old/libdesklets/system/Solaris/X86.py
---- gDesklets-0.35.3/libdesklets/system/Solaris/X86.py 1970-01-01 08:00:00.000000000 +0800
-+++ gDesklets-old/libdesklets/system/Solaris/X86.py 2007-01-26 19:16:37.386927000 +0800
-@@ -0,0 +1,92 @@
+diff -Nrup gDesklets-old/libdesklets/system/Solaris/X86.py gDesklets-0.35.3/libdesklets/system/Solaris/X86.py
+--- gDesklets-old/libdesklets/system/Solaris/X86.py 1970-01-01 08:00:00.000000000 +0800
++++ gDesklets-0.35.3/libdesklets/system/Solaris/X86.py 2007-02-14 14:40:15.326279000 +0800
+@@ -0,0 +1,96 @@
+from Generic import Generic
+
+import re
@@ -191,12 +235,19 @@
+ m_int = int(m[0],16)
+ return int(round(m_int/1000))
+
++ def _read_cpu_speed():
++
++ r = re.compile('^.*cpu-mhz.*\n\s+value=(.+)$', re.M)
++ m = r.findall(self._read_cpuinfo())
++ return float(int(m[0],16))
++
+ # CPU model and cache size never changes
+ self.__model_name = _get_model()
+ self.__cache_size = _get_cache()
+
+ # the cpu speed might change (laptops have mobile CPUs)
-+ self.__speed = re.compile('^.*cpu-mhz.*\n\s+value=(.+)$', re.M)
++ self.__speed = _read_cpu_speed()
++
+
+ def _read_cpuinfo(self):
+ """
@@ -204,7 +255,6 @@
+ @rtype : str
+ """
+ return os.popen('/usr/sbin/prtconf -v').read()
-+
+
+ def cpu_cache(self):
+ """
@@ -231,9 +281,7 @@
+ @return : current clock of installed processor
+ @rtype : float
+ """
-+
-+ m = self.__speed.findall( self._read_cpuinfo() )
-+ return float(int(m[0],16))
++ return self.__speed
+
+
+
@@ -256,16 +304,16 @@
+
+ return count
+
-diff -Nrup gDesklets-0.35.3/libdesklets/system/Solaris/__init__.py gDesklets-old/libdesklets/system/Solaris/__init__.py
---- gDesklets-0.35.3/libdesklets/system/Solaris/__init__.py 1970-01-01 08:00:00.000000000 +0800
-+++ gDesklets-old/libdesklets/system/Solaris/__init__.py 2007-01-26 19:16:37.382350000 +0800
+diff -Nrup gDesklets-old/libdesklets/system/Solaris/__init__.py gDesklets-0.35.3/libdesklets/system/Solaris/__init__.py
+--- gDesklets-old/libdesklets/system/Solaris/__init__.py 1970-01-01 08:00:00.000000000 +0800
++++ gDesklets-0.35.3/libdesklets/system/Solaris/__init__.py 2007-02-14 14:40:15.326454000 +0800
@@ -0,0 +1,3 @@
+from X86 import X86
+from Sparc import Sparc
+from Generic import Generic
-diff -Nrup gDesklets-0.35.3/shell/plugins/Shell/__init__.py gDesklets-old/shell/plugins/Shell/__init__.py
---- gDesklets-0.35.3/shell/plugins/Shell/__init__.py 2005-03-23 10:07:29.000000000 +0800
-+++ gDesklets-old/shell/plugins/Shell/__init__.py 2007-01-26 19:19:17.252365000 +0800
+diff -Nrup gDesklets-old/shell/plugins/Shell/__init__.py gDesklets-0.35.3/shell/plugins/Shell/__init__.py
+--- gDesklets-old/shell/plugins/Shell/__init__.py 2005-03-23 10:07:29.000000000 +0800
++++ gDesklets-0.35.3/shell/plugins/Shell/__init__.py 2007-02-20 11:51:00.589517000 +0800
@@ -150,5 +150,5 @@ try:
except:
pass