Bug#889059: FTBFS with (miniupnpc) 2.0.20171212 (warzone2100)

peter green plugwash at p10link.net
Thu Feb 22 19:48:14 UTC 2018


> to build with multiple versions of libminiupnpc-dev, replace
I think your suggested replacement is a bit over the top. I don't think there is any mileage in debian patches adding support for very old versions of miniupnpc.

Also your suggested fix seems to have a couple of issues. Firstly it seems to be missing a newline and secondly
it seems to have a wrong variable name in it.

Finally it seems that warzone2100 upstream was using the "API 14+" version of the call. Debian then patched it to support the API 8-13 version of the call and broke support for API 14+.

So taking this all into account I whipped up a patch to support both the API 14+ version of that call and the API 8-13 version but not the older versions.

Unfortunately after doing so it seems that the package still failed to build in Raspbian buster, the next error was:

> netplay.cpp:978:106: error: too few arguments to function ‘void* miniwget_getaddr(const char*, int*, char*, int, unsigned int, int*)’
>     descXML = (char *)miniwget_getaddr(dev->descURL, &descXMLsize, lanaddr, sizeof(lanaddr), dev->scope_id);

Some searching lead me to https://github.com/miniupnp/miniupnp/commit/c4991916e5c12a7754e935e71a5313e75af6aeb9#diff-9813014a8c763f65cfbd4caec9552ddd and based on the changes to the testminiwget code in that commit I whipped up a patch.

With these fixes I was able to get a succesful build in Raspbian buster.

Debdiff attatched and uploaded to Raspbian, no intent to NMU in Debian.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-games-devel/attachments/20180222/4d62f582/attachment-0001.html>
-------------- next part --------------
diff -Nru warzone2100-3.2.1/debian/changelog warzone2100-3.2.1/debian/changelog
--- warzone2100-3.2.1/debian/changelog	2016-11-28 19:51:47.000000000 +0000
+++ warzone2100-3.2.1/debian/changelog	2018-02-22 18:35:47.000000000 +0000
@@ -1,3 +1,10 @@
+warzone2100 (3.2.1-2+rpi1) buster-staging; urgency=medium
+
+  * Fix build with miniupnpc API 16 (Closes: 889059)
+    + Replace fix-upnpDiscover.patch with new patch miniupnpc-api.patch
+
+ -- Peter Michael Green <plugwash at raspbian.org>  Thu, 22 Feb 2018 18:35:47 +0000
+
 warzone2100 (3.2.1-2) unstable; urgency=medium
 
   * Team upload.
diff -Nru warzone2100-3.2.1/debian/patches/fix-upnpDiscover.patch warzone2100-3.2.1/debian/patches/fix-upnpDiscover.patch
--- warzone2100-3.2.1/debian/patches/fix-upnpDiscover.patch	2016-11-28 19:51:47.000000000 +0000
+++ warzone2100-3.2.1/debian/patches/fix-upnpDiscover.patch	1970-01-01 00:00:00.000000000 +0000
@@ -1,23 +0,0 @@
-From: Russell Coker <russell at coker.com.au>
-Date: Mon, 19 Sep 2016 23:24:25 +0200
-Subject: fix-upnpDiscover
-
-remove extra arg from upnpDiscover()
-Forwarded: no
----
- lib/netplay/netplay.cpp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/netplay/netplay.cpp b/lib/netplay/netplay.cpp
-index 6c14dde..14266db 100644
---- a/lib/netplay/netplay.cpp
-+++ b/lib/netplay/netplay.cpp
-@@ -951,7 +951,7 @@ static int upnp_init(void *asdf)
- 	if (NetPlay.isUPNP)
- 	{
- 		debug(LOG_NET, "Searching for UPnP devices for automatic port forwarding...");
--		devlist = upnpDiscover(3000, NULL, NULL, 0, 0, 2, &result);
-+		devlist = upnpDiscover(3000, NULL, NULL, 0, 0, &result);
- 		debug(LOG_NET, "UPnP device search finished.");
- 		if (devlist)
- 		{
diff -Nru warzone2100-3.2.1/debian/patches/miniupnpc-api.patch warzone2100-3.2.1/debian/patches/miniupnpc-api.patch
--- warzone2100-3.2.1/debian/patches/miniupnpc-api.patch	1970-01-01 00:00:00.000000000 +0000
+++ warzone2100-3.2.1/debian/patches/miniupnpc-api.patch	2018-02-22 18:24:14.000000000 +0000
@@ -0,0 +1,49 @@
+support both mininupnp API
+versions 14+ and the version previously used in Debian.
+
+Thanks to Thomas Bernard for pointing out what the problem with upnpDiscover
+was and providing the #if conditions to use.
+
+miniwget fix based on changes to testminiwget.c at 
+https://github.com/miniupnp/miniupnp/commit/c4991916e5c12a7754e935e71a5313e75af6aeb9#diff-9813014a8c763f65cfbd4caec9552ddd
+
+This patch replaces fix-upnpDiscover.patch by Russel corker <russell at coker.com.au>
+which made the package build with the version of miniupnpc in Debian at the time 
+but broke support for API version 14+
+
+Author: Peter Michael Green <plugwash at debian.org>
+Bug-debian: http://bugs.debian.org/889059
+
+Index: warzone2100-3.2.1/lib/netplay/netplay.cpp
+===================================================================
+--- warzone2100-3.2.1.orig/lib/netplay/netplay.cpp
++++ warzone2100-3.2.1/lib/netplay/netplay.cpp
+@@ -951,7 +951,11 @@ static int upnp_init(void *asdf)
+ 	if (NetPlay.isUPNP)
+ 	{
+ 		debug(LOG_NET, "Searching for UPnP devices for automatic port forwarding...");
++#if defined(MINIUPNPC_API_VERSION) && (MINIUPNPC_API_VERSION >= 14)
+ 		devlist = upnpDiscover(3000, NULL, NULL, 0, 0, 2, &result);
++#else
++		devlist = upnpDiscover(3000, NULL, NULL, 0, 0, &result);
++#endif
+ 		debug(LOG_NET, "UPnP device search finished.");
+ 		if (devlist)
+ 		{
+@@ -971,7 +975,16 @@ static int upnp_init(void *asdf)
+ 
+ 			debug(LOG_NET, "UPnP device found: %s %s\n", dev->descURL, dev->st);
+ 
++#if defined(MINIUPNPC_API_VERSION) && (MINIUPNPC_API_VERSION >= 16)
++			int status_code = -1;
++			descXML = (char *)miniwget_getaddr(dev->descURL, &descXMLsize, lanaddr, sizeof(lanaddr), dev->scope_id, &status_code);
++			if (descXML && (status_code != 200)) {
++				free(descXML);
++				descXML = NULL;
++			}
++#else
+ 			descXML = (char *)miniwget_getaddr(dev->descURL, &descXMLsize, lanaddr, sizeof(lanaddr), dev->scope_id);
++#endif
+ 			debug(LOG_NET, "LAN address: %s", lanaddr);
+ 			if (descXML)
+ 			{
diff -Nru warzone2100-3.2.1/debian/patches/series warzone2100-3.2.1/debian/patches/series
--- warzone2100-3.2.1/debian/patches/series	2016-11-28 19:51:47.000000000 +0000
+++ warzone2100-3.2.1/debian/patches/series	2018-02-22 18:12:25.000000000 +0000
@@ -3,8 +3,8 @@
 revert-e397b24d4724d835d6cdc39a92800e64c0551dab.patch
 fix-yacc.patch
 redefinition-FTBFS.patch
-fix-upnpDiscover.patch
 add-needed-const.patch
 appdata.patch
 quickstartguide.patch
 openssl-1.1.patch
+miniupnpc-api.patch


More information about the Pkg-games-devel mailing list