- Update to release 0.7.4 .

- Add support for qemu.

PR:		ports/158752
Submitted by:	Olivier Cochard-Labbe <olivier@cochard.me> (maintainer)
This commit is contained in:
Juergen Lock 2011-07-13 20:06:49 +00:00
parent 85c8cc458d
commit 7c2e3f3563
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=277649
8 changed files with 123 additions and 12 deletions

View File

@ -6,8 +6,7 @@
#
PORTNAME= gns3
PORTVERSION= 0.7.3
PORTREVISION= 1
PORTVERSION= 0.7.4
CATEGORIES= emulators
MASTER_SITES= SF/gns-3/GNS3/${PORTVERSION}
DISTNAME= GNS3-${PORTVERSION}-src
@ -15,18 +14,36 @@ DISTNAME= GNS3-${PORTVERSION}-src
MAINTAINER= olivier@cochard.me
COMMENT= Graphical Cisco network simulator
LICENSE= GPLv2
BUILD_DEPENDS= qemu:${PORTSDIR}/emulators/qemu
RUN_DEPENDS= ${PYTHON_SITELIBDIR}/PyQt4/QtGui.so:${PORTSDIR}/x11-toolkits/py-qt4-gui \
${PYTHON_SITELIBDIR}/PyQt4/QtSvg.so:${PORTSDIR}/graphics/py-qt4-svg \
${PYTHON_SITELIBDIR}/PyQt4/QtNetwork.so:${PORTSDIR}/net/py-qt4-network \
dynamips:${PORTSDIR}/emulators/dynamips-community \
dynagen:${PORTSDIR}/emulators/dynagen \
qemu>=0.11:${PORTSDIR}/emulators/qemu
qemu:${PORTSDIR}/emulators/qemu
USE_PYTHON= 2.5+
USE_PYTHON= 2.6+
USE_PYDISTUTILS= yes
PYDISTUTILS_PKGNAME= GNS3
MAN1= gns3.1
LICENSE= GPLv2
.include <bsd.port.pre.mk>
post-patch:
${REINPLACE_CMD} \
"s|%%PREFIX%%|${PREFIX}|;s|%%LOCALBASE%%|${LOCALBASE}|" \
${WRKSRC}/src/GNS3/Ui/ConfigurationPages/*.py
.if !defined(NO_IGNORE)
pre-configure:
@if qemu -help | ${GREP} -q -- "-net udp" >/dev/null 2>&1; then \
: ; \
else \
${ECHO_MSG} "===> ${PKGNAME} must be used with a gns3 patched qemu"; exit 1; \
fi
.endif
post-install:
.if !defined(NO_INSTALL_MANPAGES)
@ -35,4 +52,5 @@ post-install:
${INSTALL_SCRIPT} ${WRKSRC}/qemuwrapper/qemuwrapper.py \
${PREFIX}/bin/qemuwrapper.py
@${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>
.include <bsd.port.post.mk>

View File

@ -1,2 +1,2 @@
SHA256 (GNS3-0.7.3-src.tar.gz) = 352e8a076d83992269ec4a12fb33ab2431f14f968c0facc0571d7e6dd83521de
SIZE (GNS3-0.7.3-src.tar.gz) = 4418850
SHA256 (GNS3-0.7.4-src.tar.gz) = 77a2c9b251d199a435ba85936349a1f8b1760df14a2594b68f8c1fee36f9588d
SIZE (GNS3-0.7.4-src.tar.gz) = 4512420

View File

@ -0,0 +1,11 @@
--- src/GNS3/Ui/ConfigurationPages/Page_PreferencesCapture.py.orig 2011-07-03 00:10:04.000000000 +0200
+++ src/GNS3/Ui/ConfigurationPages/Page_PreferencesCapture.py 2011-07-03 00:10:29.000000000 +0200
@@ -52,7 +52,7 @@
elif sys.platform.startswith('win'):
self.conf.cap_cmd = unicode("C:\Program Files\Wireshark\wireshark.exe %c")
else:
- self.conf.cap_cmd = unicode("/usr/bin/wireshark %c")
+ self.conf.cap_cmd = unicode("%%LOCALBASE%%/bin/wireshark %c")
if self.conf.workdir == '':
if os.environ.has_key("TEMP"):

View File

@ -0,0 +1,13 @@
--- src/GNS3/Ui/ConfigurationPages/Page_PreferencesDynamips.py.orig 2011-07-03 00:11:46.000000000 +0200
+++ src/GNS3/Ui/ConfigurationPages/Page_PreferencesDynamips.py 2011-07-03 00:32:42.000000000 +0200
@@ -55,7 +55,9 @@
# Default path to dynamips executable
if self.conf.path == '' and sys.platform.startswith('win'):
self.conf.path = unicode('dynamips-wxp.exe')
-
+ else:
+ self.conf.path = unicode('%%LOCALBASE%%/bin/dynamips')
+
# Default path to working directory
if self.conf.workdir == '':
if os.environ.has_key("TEMP"):

View File

@ -0,0 +1,11 @@
--- src/GNS3/Ui/ConfigurationPages/Page_PreferencesQemu.py.orig 2011-07-03 00:06:36.000000000 +0200
+++ src/GNS3/Ui/ConfigurationPages/Page_PreferencesQemu.py 2011-07-03 00:07:26.000000000 +0200
@@ -97,7 +97,7 @@
if sys.platform.startswith('win'):
self.conf.qemuwrapper_path = unicode('qemuwrapper.exe')
else:
- path = os.getcwd() + '/qemuwrapper/qemuwrapper.py'
+ path = '%%PREFIX%%/bin/qemuwrapper.py'
self.conf.qemuwrapper_path = unicode(path, errors='replace')
# Default path to working directory

View File

@ -0,0 +1,52 @@
--- qemuwrapper/qemuwrapper.py.orig
+++ qemuwrapper/qemuwrapper.py
@@ -45,6 +45,7 @@ import SocketServer
import time
import random
import pemubin
+import ctypes
__author__ = 'Thomas Pani and Jeremy Grossmann'
@@ -118,6 +119,33 @@ class xEMUInstance(object):
def unbase_disk(self):
pass
+ def preexec(self):
+ # FreeBSD preexec_fn hack to unblock signals in child processes
+ # to work around the bug in this PR:
+ # http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/153167
+ # inspired by:
+ # http://stackoverflow.com/questions/3791398/how-to-stop-python-from-propagating-signals-to-subprocesses
+
+ # Get the size of the array used to
+ # represent the signal mask
+ SIGSET_NWORDS = 1024 / (8 * ctypes.sizeof(ctypes.c_uint))
+
+ # Define the sigset_t structure
+ class SIGSET(ctypes.Structure):
+ _fields_ = [
+ ('val', ctypes.c_uint * SIGSET_NWORDS)
+ ]
+
+ # Create a new sigset_t to mask out SIGINT
+ sigs = (ctypes.c_uint * SIGSET_NWORDS)()
+ mask = SIGSET(sigs)
+
+ SIG_SETMASK = 3
+ libc = ctypes.CDLL('libc.so')
+
+ # Unblock all signals
+ libc.sigprocmask(SIG_SETMASK, ctypes.pointer(mask), 0)
+
def start(self):
command = self._build_command()
@@ -125,6 +152,7 @@ class xEMUInstance(object):
try:
self.process = subprocess.Popen(command,
stdin=subprocess.PIPE,
+ preexec_fn=self.preexec,
cwd=self.workdir)
except OSError, e:
print >> sys.stderr, "Unable to start instance", self.name, "of", self.__class__

View File

@ -1,6 +1,5 @@
===============================================================================
=====================================
GNS3 FreeBSD limitations :
There are some limitations with GNS3 under FreeBSD because qemu port isn't
patched for suppporting PIX/ASA and UDP communications with Dynamips.
===============================================================================
pemu (PIX emulator) is not available
=====================================

View File

@ -94,6 +94,9 @@ bin/qemuwrapper.py
%%PYTHON_SITELIBDIR%%/GNS3/HypervisorManager.py
%%PYTHON_SITELIBDIR%%/GNS3/HypervisorManager.pyc
%%PYTHON_SITELIBDIR%%/GNS3/HypervisorManager.pyo
%%PYTHON_SITELIBDIR%%/GNS3/IDLEPCDialog.py
%%PYTHON_SITELIBDIR%%/GNS3/IDLEPCDialog.pyc
%%PYTHON_SITELIBDIR%%/GNS3/IDLEPCDialog.pyo
%%PYTHON_SITELIBDIR%%/GNS3/IOSDialog.py
%%PYTHON_SITELIBDIR%%/GNS3/IOSDialog.pyc
%%PYTHON_SITELIBDIR%%/GNS3/IOSDialog.pyo
@ -109,6 +112,7 @@ bin/qemuwrapper.py
%%PYTHON_SITELIBDIR%%/GNS3/Langs/Lang_es.qm
%%PYTHON_SITELIBDIR%%/GNS3/Langs/Lang_fa.qm
%%PYTHON_SITELIBDIR%%/GNS3/Langs/Lang_fr.qm
%%PYTHON_SITELIBDIR%%/GNS3/Langs/Lang_gr.qm
%%PYTHON_SITELIBDIR%%/GNS3/Langs/Lang_it.qm
%%PYTHON_SITELIBDIR%%/GNS3/Langs/Lang_jp.qm
%%PYTHON_SITELIBDIR%%/GNS3/Langs/Lang_kr.qm
@ -357,6 +361,9 @@ bin/qemuwrapper.py
%%PYTHON_SITELIBDIR%%/GNS3/Ui/Form_About.py
%%PYTHON_SITELIBDIR%%/GNS3/Ui/Form_About.pyc
%%PYTHON_SITELIBDIR%%/GNS3/Ui/Form_About.pyo
%%PYTHON_SITELIBDIR%%/GNS3/Ui/Form_IDLEPCDialog.py
%%PYTHON_SITELIBDIR%%/GNS3/Ui/Form_IDLEPCDialog.pyc
%%PYTHON_SITELIBDIR%%/GNS3/Ui/Form_IDLEPCDialog.pyo
%%PYTHON_SITELIBDIR%%/GNS3/Ui/Form_IOSDialog.py
%%PYTHON_SITELIBDIR%%/GNS3/Ui/Form_IOSDialog.pyc
%%PYTHON_SITELIBDIR%%/GNS3/Ui/Form_IOSDialog.pyo