From 2ee4bc9605e8e54b9348a33dbac4f69afda46466 Mon Sep 17 00:00:00 2001 From: Gerfried Fuchs Date: Thu, 4 Mar 2010 21:36:09 +0100 Subject: [PATCH] Imported Debian patch 0.52-8 --- debian/README.source | 2 + debian/changelog | 17 +- debian/control | 2 +- debian/copyright | 10 +- debian/netris-sample-robot.6 | 2 +- debian/patches/01_multi-games-with-scoring | 5 +- debian/patches/02_line-count-patch | 2 +- debian/patches/04_robot-close-fixup | 2 + debian/patches/05_init-static-vars | 2 + debian/patches/08_various-fixes | 3 + debian/patches/09_ipv6 | 208 +++++++++++++++++++++ debian/patches/series | 1 + debian/postinst | 8 +- debian/postrm | 8 +- debian/rules | 68 ++++--- 15 files changed, 295 insertions(+), 45 deletions(-) create mode 100644 debian/README.source create mode 100644 debian/patches/09_ipv6 diff --git a/debian/README.source b/debian/README.source new file mode 100644 index 0000000..3556bbc --- /dev/null +++ b/debian/README.source @@ -0,0 +1,2 @@ +This package uses quilt for its patch management, see +/usr/share/doc/quilt/README.source if you are unfamiliar with it. diff --git a/debian/changelog b/debian/changelog index 46ef7fe..10bfeb6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,18 @@ +netris (0.52-8) unstable; urgency=low + + * The "once every two years" release. + * Applied patch from Mats Erik Andersson for supporting ipv6 + (closes: #561977) + * Added at least Description header into all patches. + * Fix spelling error noticed by lintian in changelog. + * Add debian/README.source referencing quilt's file. + * Update Standards-Version to 3.8.4. + * Update DEB_BUILD_OPTIONS handling according to policy. + * Switched packaging licensing to BSD style. + * set -e in post{rm,inst} instead of passing -e on hashbang line. + + -- Gerfried Fuchs Thu, 04 Mar 2010 21:36:09 +0100 + netris (0.52-7) unstable; urgency=low * The "once every release" release. @@ -16,7 +31,7 @@ netris (0.52-7) unstable; urgency=low * New patches: - various-fixes: various small changes to fix compile warnings * Linked to GPL-2 in copyright file directly, added hint for later versions. - * Added copyright informations into the debianization scripts. + * Added copyright information into the debianization scripts. * Added Homepage: control field. * Updated package to Standards-Version 3.7.3, updating menu section for that. * Don't ignore make clean errors anymore. diff --git a/debian/control b/debian/control index 11d13ab..24a5b08 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: games Priority: optional Maintainer: Gerfried Fuchs Build-Depends: libncurses5-dev, quilt -Standards-Version: 3.7.3 +Standards-Version: 3.8.4 Homepage: http://netris.org/ Package: netris diff --git a/debian/copyright b/debian/copyright index 4f411d7..18e2947 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,6 +1,7 @@ -This package was first debianized by Gergely Madarasz on -Wed, 6 Aug 1997 22:10:42 +0200. -It is maintained since 2002 by Gerfried Fuchs . +This package was first debianized by Gergely Madarasz +on Wed, 6 Aug 1997 22:10:42 +0200. It is maintained since 2002 by +Gerfried Fuchs . The packaging is licensed under BSD style, +see /usr/share/common-licenses/BSD for the complete text. It was downloaded from ftp://ftp.netris.org/pub/netris/ @@ -24,6 +25,3 @@ It was downloaded from ftp://ftp.netris.org/pub/netris/ On Debian GNU/Linux systems, the complete text of the GNU General Public License version 2 can be found in `/usr/share/common-licenses/GPL-2', later versions can be found in the same directory. - -The Debian packaging is (C) 2002-2008 Gerfried Fuchs , -licensed the same way as netris itself. diff --git a/debian/netris-sample-robot.6 b/debian/netris-sample-robot.6 index 552e0ee..9435317 100644 --- a/debian/netris-sample-robot.6 +++ b/debian/netris-sample-robot.6 @@ -2,7 +2,7 @@ .SH "NAME" netris\-sample\-robot \- sample robot for netris .SH "SYNOPSIS" -.B netris-sample-robot +.B netris\-sample\-robot .RB [\| \-l \|] .SH "DESCRIPTION" The netris\-sample\-robot is a sample implementation of the robot protocol. It diff --git a/debian/patches/01_multi-games-with-scoring b/debian/patches/01_multi-games-with-scoring index 3d08e9c..8501b12 100644 --- a/debian/patches/01_multi-games-with-scoring +++ b/debian/patches/01_multi-games-with-scoring @@ -1,3 +1,6 @@ +Author: Tomas Berndtsson vim:ft=diff: +Description: Add multi game support with scoring + Index: netris-0.52/curses.c =================================================================== --- netris-0.52.orig/curses.c @@ -11,7 +14,7 @@ Index: netris-0.52/curses.c move(boardYPos[scr] - y, boardXPos[scr] + 2 * boardWidth[scr]); addch('|'); } -@@ -256,6 +258,23 @@ ExtFunc void PlotUnderline(int scr, int +@@ -256,6 +258,23 @@ ExtFunc void PlotUnderline(int scr, int ExtFunc void ShowDisplayInfo(void) { diff --git a/debian/patches/02_line-count-patch b/debian/patches/02_line-count-patch index eefc7b4..fa3490b 100644 --- a/debian/patches/02_line-count-patch +++ b/debian/patches/02_line-count-patch @@ -5,7 +5,7 @@ Index: netris-0.52/curses.c =================================================================== --- netris-0.52.orig/curses.c +++ netris-0.52/curses.c -@@ -258,6 +258,12 @@ ExtFunc void PlotUnderline(int scr, int +@@ -258,6 +258,12 @@ ExtFunc void PlotUnderline(int scr, int ExtFunc void ShowDisplayInfo(void) { diff --git a/debian/patches/04_robot-close-fixup b/debian/patches/04_robot-close-fixup index 74cfec4..a24062c 100644 --- a/debian/patches/04_robot-close-fixup +++ b/debian/patches/04_robot-close-fixup @@ -1,3 +1,5 @@ +Description: Small fix for CloseRobot function to close only if a robot is used + Index: netris-0.52/robot.c =================================================================== --- netris-0.52.orig/robot.c diff --git a/debian/patches/05_init-static-vars b/debian/patches/05_init-static-vars index cf3bec3..2b4ebe3 100644 --- a/debian/patches/05_init-static-vars +++ b/debian/patches/05_init-static-vars @@ -1,3 +1,5 @@ +Description: Initialize lostConn and gotEndConn static var in InitNet function + Index: netris-0.52/inet.c =================================================================== --- netris-0.52.orig/inet.c diff --git a/debian/patches/08_various-fixes b/debian/patches/08_various-fixes index a145ee8..b55848a 100644 --- a/debian/patches/08_various-fixes +++ b/debian/patches/08_various-fixes @@ -1,3 +1,6 @@ +Author: Gerfried Fuchs vim:ft=diff: +Description: various small changes to fix compile warnings + Index: netris-0.52/game.c =================================================================== --- netris-0.52.orig/game.c diff --git a/debian/patches/09_ipv6 b/debian/patches/09_ipv6 new file mode 100644 index 0000000..6870768 --- /dev/null +++ b/debian/patches/09_ipv6 @@ -0,0 +1,208 @@ +Description: Implement capability for IPv6. + Migration to 'getaddrinfo()' and 'struct sockaddr_storage' + make both address families AF_INET and AF_INET6 viable. + . + The preferred form of a port is as a string value in getaddrinfo(), + so named ports are no possible, alongside numerical ports. + . + The goto statement is left because the previous code enforced + a similar construct. It should really be removed. +Author: Mats Erik Andersson +Forwarded: no +Last-Updated: 2010-03-03 + +Index: netris-0.52/inet.c +=================================================================== +--- netris-0.52.orig/inet.c ++++ netris-0.52/inet.c +@@ -49,32 +49,60 @@ ExtFunc void InitNet(void) + + ExtFunc int WaitForConnection(char *portStr) + { +- struct sockaddr_in addr; +- struct hostent *host; +- int sockListen; ++ struct sockaddr_storage addr; ++ struct sockaddr_in *sa4 = (struct sockaddr_in *) &addr; ++ struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *) &addr; ++ struct hostent *host = NULL; ++ struct addrinfo hints, *ai, *aiptr; ++ char portStrDef[12]; ++ int sockListen, status; + socklen_t addrLen; +- short port; + int val1; + struct linger val2; + +- if (portStr) +- port = atoi(portStr); /* XXX Error checking */ +- else +- port = DEFAULT_PORT; +- memset(&addr, 0, sizeof(addr)); +- addr.sin_family = AF_INET; +- addr.sin_addr.s_addr = htonl(INADDR_ANY); +- addr.sin_port = htons(port); +- sockListen = socket(AF_INET, SOCK_STREAM, 0); +- if (sockListen < 0) ++ if (!portStr || !strlen(portStr)) { ++ snprintf(portStrDef, sizeof(portStrDef), "%u", DEFAULT_PORT); ++ portStr = portStrDef; ++ } ++ /* XXX Error checking of port string. */ ++ ++ memset(&hints, 0, sizeof(hints)); ++ hints.ai_family = AF_INET6; ++ hints.ai_socktype = SOCK_STREAM; ++ hints.ai_flags = AI_PASSIVE; ++ ++ if ( (status = getaddrinfo(NULL, portStr, &hints, &ai)) ) { ++ fprintf(stderr, "getaddrinfo() failed: %s\n", ++ gai_strerror(status)); ++ die("getaddrinfo"); ++ } ++ ++ for (aiptr = ai; aiptr; aiptr = aiptr->ai_next) { ++ if ( (sockListen = socket(aiptr->ai_family, ++ aiptr->ai_socktype, ++ aiptr->ai_protocol)) ++ < 0 ) ++ continue; ++ ++ val1 = 1; ++ setsockopt(sockListen, SOL_SOCKET, SO_REUSEADDR, ++ (void *)&val1, sizeof(val1)); ++ val1 = 0; ++ setsockopt(sockListen, IPPROTO_IPV6, IPV6_V6ONLY, ++ (void *)&val1, sizeof(val1)); ++ ++ if ( bind(sockListen, aiptr->ai_addr, aiptr->ai_addrlen) ++ == 0 ) ++ if ( listen(sockListen, 1) >= 0 ) ++ break; ++ ++ close(sockListen); ++ } ++ ++ freeaddrinfo(ai); ++ if (aiptr == NULL) + die("socket"); +- val1 = 1; +- setsockopt(sockListen, SOL_SOCKET, SO_REUSEADDR, +- (void *)&val1, sizeof(val1)); +- if (bind(sockListen, (struct sockaddr *)&addr, sizeof(addr)) < 0) +- die("bind"); +- if (listen(sockListen, 1) < 0) +- die("listen"); ++ + addrLen = sizeof(addr); + sock = accept(sockListen, (struct sockaddr *)&addr, &addrLen); + if (sock < 0) +@@ -86,13 +114,18 @@ ExtFunc int WaitForConnection(char *port + (void *)&val2, sizeof(val2)); + netGen.fd = sock; + strcpy(opponentHost, "???"); +- if (addr.sin_family == AF_INET) { +- host = gethostbyaddr((void *)&addr.sin_addr, +- sizeof(struct in_addr), AF_INET); +- if (host) { +- strncpy(opponentHost, host->h_name, sizeof(opponentHost)-1); +- opponentHost[sizeof(opponentHost)-1] = 0; +- } ++ switch (addr.ss_family) { ++ case AF_INET6: ++ host = gethostbyaddr((void *)&sa6->sin6_addr, ++ sizeof(struct in6_addr), addr.ss_family); ++ break; ++ case AF_INET: ++ host = gethostbyaddr((void *)&sa4->sin_addr, ++ sizeof(struct in_addr), addr.ss_family); ++ } ++ if (host) { ++ strncpy(opponentHost, host->h_name, sizeof(opponentHost)-1); ++ opponentHost[sizeof(opponentHost)-1] = 0; + } + AddEventGen(&netGen); + isServer = 1; +@@ -101,36 +134,54 @@ ExtFunc int WaitForConnection(char *port + + ExtFunc int InitiateConnection(char *hostStr, char *portStr) + { +- struct sockaddr_in addr; +- struct hostent *host; +- short port; +- int mySock; +- +- if (portStr) +- port = atoi(portStr); /* XXX Error checking */ +- else +- port = DEFAULT_PORT; +- host = gethostbyname(hostStr); +- if (!host) +- die("gethostbyname"); +- assert(host->h_addrtype == AF_INET); +- strncpy(opponentHost, host->h_name, sizeof(opponentHost)-1); +- opponentHost[sizeof(opponentHost)-1] = 0; +- again: +- memset(&addr, 0, sizeof(addr)); +- addr.sin_family = host->h_addrtype; +- memcpy(&addr.sin_addr, host->h_addr, host->h_length); +- addr.sin_port = htons(port); +- mySock = socket(AF_INET, SOCK_STREAM, 0); +- if (mySock < 0) +- die("socket"); +- if (connect(mySock, (struct sockaddr *)&addr, sizeof(addr)) < 0) { +- if (errno != ECONNREFUSED) +- die("connect"); ++ struct addrinfo hints, *ai, *aiptr; ++ char portStrDef[12]; ++ int mySock, status; ++ ++ if (!portStr || !strlen(portStr)) { ++ snprintf(portStrDef, sizeof(portStrDef), "%u", DEFAULT_PORT); ++ portStr = portStrDef; ++ } ++ /* XXX Error checking of port string. */ ++ ++ memset(&hints, 0, sizeof(hints)); ++ hints.ai_family = AF_UNSPEC; ++ hints.ai_socktype = SOCK_STREAM; ++ hints.ai_flags = AI_ADDRCONFIG | AI_CANONNAME; ++ ++ if ( (status = getaddrinfo(hostStr, portStr, &hints, &ai)) ) { ++ fprintf(stderr, "getaddrinfo() failed: %s\n", ++ gai_strerror(status)); ++ die("getaddrinfo"); ++ } ++ ++ for (aiptr = ai; aiptr; aiptr = aiptr->ai_next) { ++again: ++ if ( (mySock = socket(aiptr->ai_family, aiptr->ai_socktype, ++ aiptr->ai_protocol)) ++ < 0 ) ++ continue; ++ while ( (status = connect(mySock, aiptr->ai_addr, ++ aiptr->ai_addrlen)) < 0 ++ && errno == ECONNREFUSED ) { ++ close(mySock); ++ sleep(1); ++ goto again; ++ } ++ if (status >= 0) ++ break; ++ /* Failure to connect. */ + close(mySock); +- sleep(1); +- goto again; + } ++ ++ if (aiptr == NULL) { ++ freeaddrinfo(ai); ++ die("socket/connect"); ++ } ++ ++ strncpy(opponentHost, aiptr->ai_canonname, sizeof(opponentHost)-1); ++ opponentHost[sizeof(opponentHost)-1] = 0; ++ freeaddrinfo(ai); + netGen.fd = sock = mySock; + AddEventGen(&netGen); + return 0; diff --git a/debian/patches/series b/debian/patches/series index 0ebda8e..885489d 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -6,3 +6,4 @@ 06_curses.c-include-term.h 07_curses.c-include-time.h 08_various-fixes +09_ipv6 diff --git a/debian/postinst b/debian/postinst index 2487d92..10af7f8 100644 --- a/debian/postinst +++ b/debian/postinst @@ -1,7 +1,9 @@ -#!/bin/sh -e +#!/bin/sh # postinst script for netris -# copyright 2002++ by Gerfried Fuchs -# Licenced the same way as netris itself +# copyright 2002-2010 by Gerfried Fuchs +# Licenced under BSD style + +set -e if [ "$1" != configure ]; then exit 0 diff --git a/debian/postrm b/debian/postrm index ca83453..a2ec7df 100644 --- a/debian/postrm +++ b/debian/postrm @@ -1,7 +1,9 @@ -#!/bin/sh -e +#!/bin/sh # postrm script for netris -# copyright 2002++ by Gerfried Fuchs -# Licenced the same way as netris itself +# copyright 2002-2010 by Gerfried Fuchs +# Licenced under BSD style + +set -e if [ -x /usr/bin/update-menus ]; then update-menus diff --git a/debian/rules b/debian/rules index 3816853..5dd0031 100755 --- a/debian/rules +++ b/debian/rules @@ -1,7 +1,10 @@ #!/usr/bin/make -f # rules file for netris -# copyright 2002++ by Gerfried Fuchs -# Licenced the same way as netris itself +# copyright 2002-2010 by Gerfried Fuchs +# Licenced under BSD style + +PKG = netris +TMP = $(CURDIR)/debian/$(PKG) COPT = -g INSTALL = install @@ -10,22 +13,28 @@ INSTALL_PROGRAM = $(INSTALL) -p -oroot -groot -m755 INSTALL_SCRIPT = $(INSTALL) -p -oroot -groot -m755 INSTALL_DIR = $(INSTALL) -p -d -oroot -groot -m755 -ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) +ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) COPT += -O0 else COPT += -O2 endif -ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) +ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s + STRIP = true +endif +ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) + NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) + MAKEFLAGS += -j$(NUMJOBS) endif + include /usr/share/quilt/quilt.make clean: unpatch $(checkdir) $(checkroot) - -rm -rf debian/netris debian/substvars debian/files \ + -rm -rf $(TMP) debian/substvars debian/files \ build-stamp install-stamp config.h .depend [ ! -f Makefile ] || $(MAKE) clean -rm -rf Makefile @@ -43,19 +52,22 @@ install: install-stamp install-stamp: build $(checkdir) $(checkroot) - -rm -rf debian/netris - $(INSTALL_DIR) debian/netris - cd debian/netris && $(INSTALL_DIR) usr/games usr/share/man/man6 \ - usr/share/doc/netris/examples - $(INSTALL_PROGRAM) netris debian/netris/usr/games - $(INSTALL_PROGRAM) sr debian/netris/usr/games/netris-sample-robot - $(INSTALL_FILE) debian/netris*.6 debian/netris/usr/share/man/man6 - $(INSTALL_FILE) FAQ robot_desc debian/netris/usr/share/doc/netris - $(INSTALL_FILE) sr.c debian/netris/usr/share/doc/netris/examples - gzip -9 debian/netris/usr/share/man/man6/netris*.6 \ - debian/netris/usr/share/doc/netris/FAQ \ - debian/netris/usr/share/doc/netris/robot_desc \ - debian/netris/usr/share/doc/netris/examples/sr.c + -rm -rf $(TMP) + $(INSTALL_DIR) $(TMP) + cd $(TMP) && $(INSTALL_DIR) usr/games usr/share/man/man6 \ + usr/share/doc/$(PKG)/examples + $(INSTALL_PROGRAM) netris $(TMP)/usr/games + $(INSTALL_PROGRAM) sr $(TMP)/usr/games/netris-sample-robot + test "$(STRIP)" != true || strip \ + --remove-section=.comment --remove-section=.note \ + $(TMP)/usr/games/* + $(INSTALL_FILE) debian/netris*.6 $(TMP)/usr/share/man/man6 + $(INSTALL_FILE) FAQ robot_desc $(TMP)/usr/share/doc/$(PKG) + $(INSTALL_FILE) sr.c $(TMP)/usr/share/doc/$(PKG)/examples + gzip -9 $(TMP)/usr/share/man/man6/netris*.6 \ + $(TMP)/usr/share/doc/$(PKG)/FAQ \ + $(TMP)/usr/share/doc/$(PKG)/robot_desc \ + $(TMP)/usr/share/doc/$(PKG)/examples/sr.c touch install-stamp @@ -68,22 +80,22 @@ binary-indep: build binary-arch: build install $(checkdir) $(checkroot) - $(INSTALL_DIR) debian/netris/DEBIAN debian/netris/usr/share/menu - $(INSTALL_FILE) debian/menu debian/netris/usr/share/menu/netris + $(INSTALL_DIR) $(TMP)/DEBIAN $(TMP)/usr/share/menu + $(INSTALL_FILE) debian/menu $(TMP)/usr/share/menu/$(PKG) $(INSTALL_FILE) debian/copyright debian/README.Debian \ - debian/netris/usr/share/doc/netris + $(TMP)/usr/share/doc/$(PKG) $(INSTALL_FILE) debian/changelog \ - debian/netris/usr/share/doc/netris/changelog.Debian - gzip -9 debian/netris/usr/share/doc/netris/changelog.Debian + $(TMP)/usr/share/doc/$(PKG)/changelog.Debian + gzip -9 $(TMP)/usr/share/doc/$(PKG)/changelog.Debian $(INSTALL_SCRIPT) debian/postinst debian/postrm \ - debian/netris/DEBIAN + $(TMP)/DEBIAN dpkg-shlibdeps -Tdebian/substvars -dDepends \ - debian/netris/usr/games/netris* + $(TMP)/usr/games/netris* dpkg-gencontrol -ldebian/changelog -isp -Tdebian/substvars -pnetris \ - -Pdebian/netris - cd debian/netris && find * -type f ! -regex '^DEBIAN/.*' -print0 | \ + -P$(TMP) + cd $(TMP) && find * -type f ! -regex '^DEBIAN/.*' -print0 | \ xargs -r0 md5sum > DEBIAN/md5sums - dpkg --build debian/netris .. + dpkg --build $(TMP) .. binary: binary-indep binary-arch -- 2.39.2