This is an automated email from the git hooks/post-receive script.

showard pushed a commit to branch master
in repository triplea.

commit 1788a5790cbee0b5bd7cd6202587b93397b5b2dc
Author: Scott Howard <[email protected]>
Date:   Thu Oct 10 13:57:22 2013 -0400

    some fixes for upnp library
---
 debian/patches/UPNP_FTBFS.patch       |   13 ++
 debian/patches/launcher_scripts.patch |   10 +-
 debian/patches/not                    |  319 +++++++++++++++++++++++++++++++++
 debian/rules                          |    5 +-
 debian/source/include-binaries        |    2 +
 5 files changed, 342 insertions(+), 7 deletions(-)

diff --git a/debian/patches/UPNP_FTBFS.patch b/debian/patches/UPNP_FTBFS.patch
new file mode 100644
index 0000000..08d6a02
--- /dev/null
+++ b/debian/patches/UPNP_FTBFS.patch
@@ -0,0 +1,13 @@
+Index: triplea/src/games/strategy/net/UniversalPlugAndPlanHelper.java
+===================================================================
+--- triplea.orig/src/games/strategy/net/UniversalPlugAndPlanHelper.java        
2013-05-08 21:23:04.298608496 -0400
++++ triplea/src/games/strategy/net/UniversalPlugAndPlanHelper.java     
2013-05-08 21:23:32.342609162 -0400
+@@ -211,7 +211,7 @@
+               boolean mapped = false;
+               try
+               {
+-                      mapped = m_device.addPortMapping("TripleA Game 
Hosting", "TCP", null, externalPort, m_local.getHostAddress(), internalPort, 0);
++                      mapped = m_device.addPortMapping("TripleA Game 
Hosting", "TCP", 0, externalPort, m_local.getHostAddress(), internalPort, 0);
+               } catch (final IOException e)
+               {
+                       System.out.println("Port Mapping Failed! Please try to 
Forward Ports manually! \r\n " + e.getMessage());
diff --git a/debian/patches/launcher_scripts.patch 
b/debian/patches/launcher_scripts.patch
index 627d875..0745943 100644
--- a/debian/patches/launcher_scripts.patch
+++ b/debian/patches/launcher_scripts.patch
@@ -3,8 +3,8 @@ Author: Scott Howard <[email protected]>
 
 Index: triplea/run-server.sh
 ===================================================================
---- triplea.orig/run-server.sh 2012-06-10 15:09:39.000000000 -0400
-+++ triplea/run-server.sh      2012-12-05 21:24:54.560929551 -0500
+--- triplea.orig/run-server.sh 2013-05-07 15:23:20.507122766 -0400
++++ triplea/run-server.sh      2013-05-07 15:23:20.487122766 -0400
 @@ -1,2 +1,3 @@
 -cd $(dirname $0)
 +#!/bin/sh
@@ -12,8 +12,8 @@ Index: triplea/run-server.sh
  java -server  -Xmx192m -classpath bin/triplea.jar:lib/derby_10_1_2.jar 
-Dtriplea.lobby.port=3303 -Dtriplea.lobby.console=true  
games.strategy.engine.lobby.server.LobbyServer 
 Index: triplea/triplea_unix.sh
 ===================================================================
---- triplea.orig/triplea_unix.sh       2012-12-05 21:03:27.164935807 -0500
-+++ triplea/triplea_unix.sh    2012-12-05 21:24:54.560929551 -0500
+--- triplea.orig/triplea_unix.sh       2013-05-07 15:23:20.507122766 -0400
++++ triplea/triplea_unix.sh    2013-05-07 15:23:20.487122766 -0400
 @@ -7,8 +7,7 @@
  exit
  fi
@@ -23,4 +23,4 @@ Index: triplea/triplea_unix.sh
 +cd /usr/share/triplea
  
  
- java -Xmx640m -cp bin/patch.jar:bin/triplea.jar 
games.strategy.engine.framework.GameRunner
+ java -Xmx768m -cp bin/patch.jar:bin/triplea.jar 
games.strategy.engine.framework.GameRunner
diff --git a/debian/patches/not b/debian/patches/not
new file mode 100644
index 0000000..8004e49
--- /dev/null
+++ b/debian/patches/not
@@ -0,0 +1,319 @@
+Description: <short summary of the patch>
+ TODO: Put a short summary on the line above and replace this paragraph
+ with a longer explanation of this change. Complete the meta-information
+ with other relevant fields (see below for details). To make it easier, the
+ information below has been extracted from the changelog. Adjust it or drop
+ it.
+ .
+ triplea (1.6.1.4-1) unstable; urgency=low
+ .
+   * Merge from experimental to unstable
+   * New upstream release
+Author: Scott Howard <[email protected]>
+
+---
+The information above should follow the Patch Tagging Guidelines, please
+checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Origin: <vendor|upstream|other>, <url of original patch>
+Bug: <url in upstream bugtracker>
+Bug-Debian: http://bugs.debian.org/<bugnumber>
+Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
+Forwarded: <no|not-needed|url proving that it has been forwarded>
+Reviewed-By: <name and email of someone who approved the patch>
+Last-Update: <YYYY-MM-DD>
+
+--- /dev/null
++++ 
triplea-1.6.1.4/home/showard/debian-packaging/triplea-debian-git/triplea/src/games/strategy/net/UniversalPlugAndPlanHelper.java
+@@ -0,0 +1,290 @@
++package games.strategy.net;
++
++import java.awt.Component;
++import java.io.IOException;
++import java.io.InputStream;
++import java.net.Inet4Address;
++import java.net.InetAddress;
++import java.net.NetworkInterface;
++import java.net.ServerSocket;
++import java.net.Socket;
++import java.net.SocketException;
++import java.net.SocketTimeoutException;
++import java.util.Enumeration;
++
++import javax.swing.JOptionPane;
++import javax.swing.JScrollPane;
++import javax.swing.JTextArea;
++
++import net.sbbi.upnp.impls.InternetGatewayDevice;
++import net.sbbi.upnp.messages.UPNPResponseException;
++
++/**
++ * 
++ * @author veqryn
++ * 
++ */
++public class UniversalPlugAndPlanHelper
++{
++      private int m_port = 3300;
++      private InetAddress m_local = null;
++      private InternetGatewayDevice m_device = null;
++      private static UniversalPlugAndPlanHelper s_lastInstance = null;
++      
++      public static void main(final String[] args)
++      {
++              UniversalPlugAndPlanHelper.attemptAddingPortForwarding(null, 
3300);
++      }
++      
++      public UniversalPlugAndPlanHelper(final int port)
++      {
++              m_port = port;
++      }
++      
++      public static UniversalPlugAndPlanHelper getLastInstance()
++      {
++              return s_lastInstance;
++      }
++      
++      public static boolean attemptAddingPortForwarding(final Component 
parent, final int port)
++      {
++              final UniversalPlugAndPlanHelper upnpHelper = new 
UniversalPlugAndPlanHelper(port);
++              final JTextArea textArea = new JTextArea();
++              textArea.setEditable(false);
++              final String error = 
upnpHelper.attemptAddingPortForwarding(textArea);
++              textArea.append("\r\n \r\n \r\n \r\n");
++              final boolean worked = (error == null);
++              final String textResult;
++              if (worked)
++              {
++                      textResult = "It looks like it worked.  This program 
will close now.\r\n"
++                                              + "Please try hosting again, to 
see if it 'really' worked.\r\n"
++                                              + "Remember that your firewall 
must allow TripleA, or else you still won't be able to host.\r\n";
++              }
++              else
++              {
++                      textResult = "It appears TripleA failed to set your 
Port Forwarding.\r\n"
++                                              + "Please make sure UPnP is 
turned on, in your router's settings.\r\n\r\n"
++                                              + "If you still can not get 
TripleA to set them correctly, then you must set them yourself!\r\n"
++                                              + "See 'How To Host...' in the 
help menu, at the top of the lobby screen in order to manually set 
them.\r\n\r\n"
++                                              + "\r\nThis program will close 
now.\r\n";
++              }
++              System.out.println(textResult);
++              textArea.append(textResult);
++              JOptionPane.showMessageDialog(parent, new 
JScrollPane(textArea), "Setting Port Forwarding with UPnP", 
JOptionPane.INFORMATION_MESSAGE);
++              return worked;
++      }
++      
++      public String attemptAddingPortForwarding(final JTextArea textArea)
++      {
++              System.out.println("Starting Universal Plug and Play (UPnP) add 
port forward map script.");
++              textArea.append("Starting Universal Plug and Play (UPnP) add 
port forward map script.\r\n");
++              final String localError = findLocalInetAddress();
++              if (localError != null)
++              {
++                      textArea.append(localError + "\r\n");
++                      return localError;
++              }
++              textArea.append("Found Local IP/Inet Address to use: " + 
m_local + "\r\n");
++              final String gatewayError = findInternetGatewayDevice();
++              if (gatewayError != null)
++              {
++                      textArea.append(gatewayError + "\r\n");
++                      return gatewayError;
++              }
++              textArea.append("Internet Gateway Device (normally a router) 
found!\r\n");
++              final String addPortError = addPortForwardUPNP();
++              if (addPortError != null)
++              {
++                      textArea.append(addPortError + "\r\n");
++                      return addPortError;
++              }
++              textArea.append("Port Forwarding map added successfully.\r\n");
++              /*
++              final String testError = testConnection();
++              if (testError != null)
++              {
++                      textArea.append(testError);
++                      return testError;
++              }
++              textArea.append("Test Connection made!");
++              */
++              s_lastInstance = this;
++              return null;
++      }
++      
++      public String testConnection()
++      {
++              System.out.println("Waiting for a connection");
++              final int internalPort = m_port;
++              boolean connection = false;
++              // boolean bytes = false;
++              ServerSocket ss = null;
++              try
++              {
++                      ss = new ServerSocket(internalPort);
++                      ss.setSoTimeout(5000);
++                      try
++                      {
++                              final Socket s = ss.accept();
++                              connection = true;
++                              final InputStream in = s.getInputStream();
++                              while (in.available() > 0)
++                              {
++                                      System.out.println("byte : " + 
in.read());
++                                      // bytes = true;
++                              }
++                      } catch (final SocketTimeoutException stoe)
++                      {
++                              System.out.println("Connection Test Timed Out. 
Port Forward may still work anyway.");
++                              return "Connection Test Timed Out. Port Forward 
may still work anyway.";
++                      } finally
++                      {
++                              ss.close();
++                      }
++              } catch (final IOException e)
++              {
++                      System.out.println("Connection Test Timed Out. Port 
Forward may still work anyway. \r\n " + e.getMessage());
++                      return "Connection Test Timed Out. Port Forward may 
still work anyway. \r\n " + e.getMessage();
++              } finally
++              {
++                      if (ss != null)
++                              try
++                              {
++                                      ss.close();
++                              } catch (final IOException e)
++                              {
++                                      e.printStackTrace();
++                              }
++              }
++              if (!connection)
++              {
++                      System.out.println("Connection Test Timed Out. Port 
Forward may still work anyway.");
++                      return "Connection Test Timed Out. Port Forward may 
still work anyway.";
++              }
++              System.out.println("Connection made!");
++              return null;
++      }
++      
++      public String removePortForwardUPNP()
++      {
++              System.out.println("Attempting to remove Port Forwarding");
++              final int externalPort = m_port;
++              boolean removed = false;
++              try
++              {
++                      removed = m_device.deletePortMapping(null, 
externalPort, "TCP");
++              } catch (final IOException e)
++              {
++                      System.out.println("Failed to remove port mapping! \r\n 
" + e.getMessage());
++                      return "Failed to remove port mapping! \r\n " + 
e.getMessage();
++              } catch (final UPNPResponseException e)
++              {
++                      System.out.println("Failed to remove port mapping! \r\n 
" + e.getMessage());
++                      return "Failed to remove port mapping! \r\n " + 
e.getMessage();
++              }
++              if (!removed)
++              {
++                      System.out.println("Failed to remove port mapping!");
++                      return "Failed to remove port mapping!";
++              }
++              System.out.println("Success. Port Forwarding map removed.");
++              return null;
++      }
++      
++      private String addPortForwardUPNP()
++      {
++              final int internalPort = m_port;
++              final int externalPort = m_port;
++              // System.out.println("Attempting to map port on " + 
m_device.msgFactory.service.serviceType + " service");
++              System.out.print("Adding mapping from ");
++              try
++              {
++                      System.out.print(m_device.getExternalIPAddress());
++              } catch (final UPNPResponseException e1)
++              {
++              } catch (final IOException e1)
++              {
++              }
++              System.out.println(":" + externalPort);
++              System.out.println("To " + m_local.getHostAddress() + ":" + 
internalPort);
++              boolean mapped = false;
++              try
++              {
++                      mapped = m_device.addPortMapping("TripleA Game 
Hosting", "TCP", null, externalPort, m_local.getHostAddress(), internalPort, 0);
++              } catch (final IOException e)
++              {
++                      System.out.println("Port Mapping Failed! Please try to 
Forward Ports manually! \r\n " + e.getMessage());
++                      return "Port Mapping Failed! Please try to Forward 
Ports manually! \r\n " + e.getMessage();
++              } catch (final UPNPResponseException e)
++              {
++                      System.out.println("Port Mapping Failed! Please try to 
Forward Ports manually! \r\n " + e.getMessage());
++                      return "Port Mapping Failed! Please try to Forward 
Ports manually! \r\n " + e.getMessage();
++              }
++              if (!mapped)
++              {
++                      System.out.println("Port Mapping Failed! Please try to 
Forward Ports manually!");
++                      return "Port Mapping Failed! Please try to Forward 
Ports manually!";
++              }
++              System.out.println("Success. Port Forwarding map added.");
++              return null;
++      }
++      
++      private String findInternetGatewayDevice()
++      {
++              System.out.println("Attempting to find internet gateway device 
(normally a router).");
++              InternetGatewayDevice[] devices = null;
++              try
++              {
++                      devices = InternetGatewayDevice.getDevices(2000);
++              } catch (final IOException e)
++              {
++                      System.out.println("Router/Device UPnP turned off. Or 
no Routers/Devices found.  Please make sure your router's UPNP is turned on! 
\r\n " + e.getMessage());
++                      return "Router/Device UPnP turned off. Or no 
Routers/Devices found.  Please make sure your router's UPNP is turned on! \r\n 
" + e.getMessage();
++              }
++              if (devices == null || 1 > devices.length)
++              {
++                      System.out.println("Router/Device UPnP turned off. Or 
no Routers/Devices found.  Please make sure your router's UPNP is turned on!");
++                      return "Router/Device UPnP turned off. Or no 
Routers/Devices found.  Please make sure your router's UPNP is turned on!";
++              }
++              m_device = devices[0];
++              System.out.println("Device found!");
++              return null;
++      }
++      
++      private String findLocalInetAddress()
++      {
++              m_local = null;
++              System.out.println("Attempting to find local ip/inet address.");
++              try
++              {
++                      final Enumeration<NetworkInterface> ifaces = 
NetworkInterface.getNetworkInterfaces();
++                      while (ifaces.hasMoreElements() && m_local == null)
++                      {
++                              final NetworkInterface iface = 
ifaces.nextElement();
++                              final Enumeration<InetAddress> addresses = 
iface.getInetAddresses();
++                              
++                              while (addresses.hasMoreElements() && m_local 
== null)
++                              {
++                                      final InetAddress addr = 
addresses.nextElement();
++                                      if (addr instanceof Inet4Address && 
!addr.isLoopbackAddress())
++                                      {
++                                              m_local = addr;
++                                      }
++                              }
++                      }
++              } catch (final SocketException e)
++              {
++                      m_local = null;
++                      System.out.println("Could not determine local ip/inet 
address!");
++                      return "Could not determine local ip/inet address! \r\n 
" + e.getMessage();
++              }
++              if (m_local == null)
++              {
++                      System.out.println("Could not determine local ip/inet 
address!");
++                      return "Could not determine local ip/inet address!";
++              }
++              System.out.println("Local Address to use: " + m_local);
++              return null;
++      }
++}
diff --git a/debian/rules b/debian/rules
index b4717e0..dfec5ad 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,7 +5,7 @@
 export JAVA_HOME=/usr/lib/jvm/default-java
 
 # Put depended upon jars in here
-export 
CLASSPATH=/usr/share/java/commons-httpclient.jar:/usr/share/java/commons-logging.jar:/usr/share/java/commons-codec.jar:/usr/share/java/substance.jar:/usr/share/java/laf-widget.jar:/usr/share/java/gnumail.jar
+export 
CLASSPATH=/usr/share/java/commons-httpclient.jar:/usr/share/java/commons-logging.jar:/usr/share/java/commons-codec.jar:/usr/share/java/substance.jar:/usr/share/java/laf-widget.jar:/usr/share/java/gnumail.jar:/usr/share/java/upnp.jar
 
 %:
        dh --with javahelper $@
@@ -37,7 +37,8 @@ override_dh_auto_configure:
        cp icons/triplea_icon.png debian/icons/256x256/apps/triplea.png
        convert icons/triplea_icon.png -resize 32x32 debian/triplea.xpm
 
-
+override_dh_builddeb:
+       dh_builddeb -- -Zxz -z9
 
 get-orig-source:
        uscan --rename --repack --download-current-version
diff --git a/debian/source/include-binaries b/debian/source/include-binaries
new file mode 100644
index 0000000..88fae6c
--- /dev/null
+++ b/debian/source/include-binaries
@@ -0,0 +1,2 @@
+lib/upnp-1.0.4.jar
+lib/upnp.jar

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-java/triplea.git

_______________________________________________
pkg-java-commits mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

Reply via email to