Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 06 Sep 2003 20:19:11 -0500
From:      Jeremy Messenger <mezz7@cox.net>
To:        Alexander Leidinger <Alexander@Leidinger.net>
Cc:        gnome@freebsd.org
Subject:   Re: I've played around with gdesklets (patch included for interested parties)
Message-ID:  <opru3u99wv8ckrg5@smtp.central.cox.net>
In-Reply-To: <opru3ux3fx8ckrg5@smtp.central.cox.net>
References:  <20030906164808.3cd86d76.Alexander@Leidinger.net> <opru3dzjxv8ckrg5@smtp.central.cox.net> <20030907010546.4bb425a5.Alexander@Leidinger.net> <opru3ux3fx8ckrg5@smtp.central.cox.net>

next in thread | previous in thread | raw e-mail | index | archive | help
------------8lW5NOrt9JColhgyVHHzvD
Content-Type: text/plain; format=flowed; charset=utf-8
Content-Transfer-Encoding: 8bit

On Sat, 06 Sep 2003 20:11:53 -0500, Jeremy Messenger <mezz7@cox.net> wrote:

> On Sun, 7 Sep 2003 01:05:46 +0200, Alexander Leidinger
> <Alexander@Leidinger.net> wrote:
>
>> On Sat, 06 Sep 2003 14:05:33 -0500
>> Jeremy Messenger <mezz7@cox.net> wrote:
>>
<snip>
> <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.
<snip>

Ahh, forget about previous attach because it has old patch (should be 
popen -> os.popen) in it. Here's yet another attach that has the update 
patch.

Cheers,
Mezz


-- 
bsdforums.org 's moderator, mezz.
------------8lW5NOrt9JColhgyVHHzvD
Content-Disposition: attachment; filename=gdesklets-network.shar
Content-Type: text/plain; name=gdesklets-network.shar
Content-Transfer-Encoding: 8bit

# 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@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@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 = os.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 = os.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@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


------------8lW5NOrt9JColhgyVHHzvD--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?opru3u99wv8ckrg5>