I've played around with gdesklets (patch included for interested parties)

Jeremy Messenger mezz7 at cox.net
Sat Sep 6 18:12:54 PDT 2003


On Sun, 7 Sep 2003 01:05:46 +0200, Alexander Leidinger 
<Alexander at Leidinger.net> wrote:

> On Sat, 06 Sep 2003 14:05:33 -0500
> Jeremy Messenger <mezz7 at cox.net> wrote:
>
>> > I've played a little bit around, but I have no time to proceed
>> > further...
>>
>> What's version of FreeBSD do you have? Here on 5.1-CURRENT, a day before
>> ATAng went in the tree. I am having the problem with the refresh here, I
>
> I'm a little bit more current, it's a week old.
>
>> had to do it manual. Your patch works great, but I have to refresh
>> weather, network and others by manual. Strange, the clock is only one 
>> that
>> doesn't has the refresh problem. I can't figure how I can get them fix.
>
> The clock is the only applet which I've seen (ok, I've also seen the
> weather applet, but it wasn't able to find the city I specified).

Ok, so you don't have the refresh problem with Network?

As for weather applet, I had to get it works by put zip code in city and 
state in country. I think, it might not like space 'Garden City' and need 
to be convert to 'Garden%20City', but I don't use weather since it doesn't 
work on the refresh very well.

<snip>
> My suggestions:
>  - remove post-extract & do-patch
>  - add do-build and run Install... from there (technically it's an
>    extraction, but you can also think about it as "creating the files
>    you want to install in WRKSRC", so do-build applies)
>  - for "network" only: rename the __init__.py patch (no "patch-" at
>    the beginning, patch it by hand in do-build after running Install...

Thanks, that's good idea! I like it and I have changed it, so here's an 
attach of it.

> Does the build really depends upon gdesklets? I haven't found the string
> "desk" as a run dependency in the Install*.bin.

Yes, because I want gdesklets to take care of Displays and Sensors 
directories rather than I put the 'mkdir' in the each applets. The 
BUILD_DEPENDS will create Displays and Sensors, before install the 
applets. If you disagree, go ahead make your suggest. ;-)

> Regarding the pkg-message, I would just write:
> ---snip---
> This is just a sensor, to actually see the data it collects, you have
> to install an appropriate display plugin.
> ---snip---

Thanks again, I have changed it. I am not very good on English, but I have 
been try to work on the improvement on English. :-)

Cheers,
Mezz

> I will try them after a little bit of sleep.
>
> Bye,
> Alexander.


-- 
bsdforums.org 's moderator, mezz.
-------------- next part --------------
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	gdesklets-network
#	gdesklets-network/distinfo
#	gdesklets-network/Makefile
#	gdesklets-network/files
#	gdesklets-network/files/patch-Install_Network_Sensor.bin
#	gdesklets-network/files/Network::__init__.py
#	gdesklets-network/pkg-plist
#	gdesklets-network/pkg-message
#	gdesklets-network/pkg-descr
#
echo c - gdesklets-network
mkdir -p gdesklets-network > /dev/null 2>&1
echo x - gdesklets-network/distinfo
sed 's/^X//' >gdesklets-network/distinfo << 'END-of-gdesklets-network/distinfo'
XMD5 (Network-0.1.4.tar.bz2) = d65cc4a3b62d0a29c4635693f62dcb76
END-of-gdesklets-network/distinfo
echo x - gdesklets-network/Makefile
sed 's/^X//' >gdesklets-network/Makefile << 'END-of-gdesklets-network/Makefile'
X# New ports collection makefile for:	gdesklets-network
X# Date created:				02 September 2003
X# Whom:					Mezz <mezz7 at cox.net>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	gdesklets-network
XPORTVERSION=	0.1.4
XCATEGORIES=	net gnome
XMASTER_SITES=	http://gdesklets.gnomedesktop.org/files/
XDISTNAME=	Network-${PORTVERSION}
X
XMAINTAINER=	mezz7 at cox.net
XCOMMENT=	The configurator allows to choose the interface to monitor network
X
XBUILD_DEPENDS=	${X11BASE}/libdata/pkgconfig/gdesklets-core.pc:${PORTSDIR}/deskutils/gdesklets
XRUN_DEPENDS=	${X11BASE}/libdata/pkgconfig/gdesklets-core.pc:${PORTSDIR}/deskutils/gdesklets
X
XUSE_BZIP2=	yes
XUSE_X_PREFIX=	yes
XNAME=		Network
X
Xdo-build:
X	@${WRKSRC}/Install_${NAME}_Sensor.bin --nomsg ${WRKSRC}
X	@${PATCH} ${WRKSRC}/${NAME}/__init__.py < ${FILESDIR}/${NAME}::__init__.py
X	@${FIND} ${WRKSRC} -name '*.orig' -delete
X
Xdo-install:
X	@${CP} -Rp ${WRKSRC}/${NAME} ${PREFIX}/share/gnome/gdesklets/Sensors/
X	@${CP} ${WRKSRC}/README ${PREFIX}/share/gnome/gdesklets/Sensors/${NAME}/
X
Xpost-install:
X	@${CAT} ${PKGMESSAGE}
X
X.include <bsd.port.mk>
END-of-gdesklets-network/Makefile
echo c - gdesklets-network/files
mkdir -p gdesklets-network/files > /dev/null 2>&1
echo x - gdesklets-network/files/patch-Install_Network_Sensor.bin
sed 's/^X//' >gdesklets-network/files/patch-Install_Network_Sensor.bin << 'END-of-gdesklets-network/files/patch-Install_Network_Sensor.bin'
X--- Install_Network_Sensor.bin.orig	Sat Sep  6 13:07:37 2003
X+++ Install_Network_Sensor.bin	Sat Sep  6 13:08:05 2003
X@@ -75,15 +75,9 @@
X     else:
X         cmd = "mkdir -p %(destination)s; cd %(destination)s; " \
X               "LANG=C tar -xzvf %(tmp)s 2>&1"
X-    fail, out = commands.getstatusoutput(cmd % vars())
X+    commands.getstatusoutput(cmd % vars())
X     os.unlink(tmp)
X     
X-    if (fail):
X-        if (no_message): print ERROR_TAR + out
X-        else: message(ERROR_TAR + out, "error")
X-        sys.exit(1)
X-
X-    print out
X     if (not list_only):
X         if (no_message): print SUCCESS
X         else: message(SUCCESS, "info")
END-of-gdesklets-network/files/patch-Install_Network_Sensor.bin
echo x - gdesklets-network/files/Network::__init__.py
sed 's/^X//' >gdesklets-network/files/Network::__init__.py << 'END-of-gdesklets-network/files/Network::__init__.py'
X--- Network/__init__.py.orig	Sat Sep  6 13:10:12 2003
X+++ Network/__init__.py	Sat Sep  6 13:15:17 2003
X@@ -18,7 +18,7 @@
X 
X class Network(Sensor):
X 
X-	def __init__(self, interface = "eth0", interval = "1000"):
X+	def __init__(self, interface = "lo0", interval = "1000"):
X 		
X 		global _; _ = i18n.Translator("memory-sensor")
X 		
X@@ -45,7 +45,7 @@
X 		self._add_thread(self.__command_thread)
X 		
X 		
X-		fd = open("/proc/net/dev", "r")
X+		fd = os.popen("ifconfig -a | grep mtu", "r")
X 		data = fd.read()
X 		fd.close()
X 		data = data.splitlines()
X@@ -60,7 +60,7 @@
X 			continue
X 
X 	def __get_net_ip(self,device) :
X-		fd = open("/proc/net/arp", "r")
X+		fd = popen("ifconfig " + device, "r")
X 		data = fd.read()
X 		fd.close()
X 		lines = data.splitlines()
X@@ -69,24 +69,22 @@
X 			l = l.strip()
X 			fields = l.split()
X 			
X-			if fields[5]==device:
X-				return fields[0]
X+			if fields[0]=="inet":
X+				return fields[1]
X 			
X 		return "(no ip for this interface)"
X 
X 	def __get_net_in_out(self,device) :
X-		fd = open("/proc/net/dev", "r")
X+		fd = popen("netstat -b -I " + device + " | grep Link", "r")
X 		data = fd.read()
X 		fd.close()
X 		lines = data.splitlines()
X 		
X 		for l in lines[:]:
X 			l = l.strip()
X-			l = l.replace(":"," ")
X 			fields = l.split()
X 			
X-			if fields[0]==device:
X-				return int(fields[1]),int(fields[9])
X+			return int(fields[6]),int(fields[8])
X 				
X 		print "device not found"
X 		return 0,0
END-of-gdesklets-network/files/Network::__init__.py
echo x - gdesklets-network/pkg-plist
sed 's/^X//' >gdesklets-network/pkg-plist << 'END-of-gdesklets-network/pkg-plist'
Xshare/gnome/gdesklets/Sensors/Network/README
Xshare/gnome/gdesklets/Sensors/Network/__init__.py
X at dirrm share/gnome/gdesklets/Sensors/Network
END-of-gdesklets-network/pkg-plist
echo x - gdesklets-network/pkg-message
sed 's/^X//' >gdesklets-network/pkg-message << 'END-of-gdesklets-network/pkg-message'
X##
XTo view the README, do the command following:
X
X	cat ${PREFIX}/share/gnome/gdesklets/Sensors/${name}/README
X
XThis is just a sensor, to actually see the data it collects, you have to install
Xan appropriate display plugin.
X##
END-of-gdesklets-network/pkg-message
echo x - gdesklets-network/pkg-descr
sed 's/^X//' >gdesklets-network/pkg-descr << 'END-of-gdesklets-network/pkg-descr'
XThe configurator allows to choose the interface to monitor, the update
Xinterval, and to enable or disable the format change for In/Out.
X
XAvailable data : 'in', 'out', 'speed_in', 'speed_out', 'speed_in_max',
X'speed_out_max', 'speed_in_percent', 'speed_out_percent', 'ip', and
X'interface'.
X
XWWW: http://gdesklets.gnomedesktop.org
END-of-gdesklets-network/pkg-descr
exit



More information about the freebsd-gnome mailing list