Subject: Collected Debian patches for pagekite
Author: Sunil Mohan Adapa <sunil@medhas.org>

The pagekite package is maintained in Git rather than maintaining
patches as separate files, and separating the patches doesn't seem to
be worth the effort.  They are therefore all included in this single
Debian patch.

For full commit history and separated commits, see the packaging Git
repository.

--- pagekite-0.5.8a.orig/Makefile
+++ pagekite-0.5.8a/Makefile
@@ -88,28 +88,21 @@ rpm_el6-fc13:
 	                           --requires=python-SocksipyChain
 
 VERSION=`python setup.py --version`
-.debprep: doc/pagekite.1
-	@rm -f setup.cfg
-	@sed -e "s/@VERSION@/$(VERSION)/g" \
-		< debian/control.in >debian/control
-	@sed -e "s/@VERSION@/$(VERSION)/g" \
-		< debian/copyright.in >debian/copyright
-	@sed -e "s/@VERSION@/$(VERSION)/g" \
-	     -e "s/@DATE@/`date -R`/g" \
-		< debian/changelog.in >debian/changelog
-	@ls -1 doc/*.? >debian/pagekite.manpages
-	@ln -fs ../etc/logrotate.d/pagekite.debian debian/pagekite.logrotate
-	@ln -fs ../etc/init.d/pagekite.debian debian/init.d
+DEB_VERSION=`head -n1 debian/changelog | sed -e "s+.*(\(.*\)).*+\1+"`
+.debprep:
+	@ln -sf deb debian
+	if [ "x$(VERSION)" != "x$(DEB_VERSION)" ] ; \
+	then \
+	  dch --maintmaint --newversion $(VERSION) --urgency=low \
+              --distribution=unstable "New release." ; \
+	fi
 
-.targz: .debprep
+.targz:
 	@python setup.py sdist
 
-.deb: .targz
-	@cp -v dist/pagekite*.tar.gz \
-		../pagekite-$(VERSION)_$(VERSION).orig.tar.gz
-	@debuild -i -us -uc -b
+.deb: .debprep
+	@debuild -i -us -uc
 	@mv ../pagekite_*.deb dist/
-	@rm ../pagekite-*.orig.tar.gz
 
 .header: pagekite doc/header.txt
 	@sed -e "s/@VERSION@/$(VERSION)/g" \
@@ -151,6 +144,6 @@ clean:
 	@rm -vf sockschain *.pyc */*.pyc */*/*.pyc scripts/breeder.py .SELF
 	@rm -vf .appver pagekite-tmp.py MANIFEST setup.cfg pagekite_gtk.py
 	@rm -vrf *.egg-info .header doc/pagekite.1 build/
-	@rm -vf debian/files debian/control debian/copyright debian/changelog
-	@rm -vrf debian/pagekite* debian/python* debian/init.d
+	-debuild clean
+	@-rm debian
 
--- pagekite-0.5.8a.orig/doc/pagekite.1
+++ pagekite-0.5.8a/doc/pagekite.1
@@ -1,11 +1,11 @@
 .\" This man page is autogenerated from the pagekite built-in manual.
-.TH PAGEKITE "1" "2015-10-16" "https://pagekite.net/" "Awesome Commands"
+.TH PAGEKITE "1" "2013-07-14" "https://pagekite.net/" "Awesome Commands"
 .nh
 .ad l
 .SH NAME
 
 
-pagekite v0.5.8a \- Make localhost servers publicly visible
+pagekite v0.5.6d \- Make localhost servers publicly visible
 
 .SH SYNOPSIS
 
@@ -234,7 +234,7 @@ described above, but this syntax is used
 
 .TP
 \fB\-\-service_off\fR=\fIproto\fR:\fIkitename\fR:\fIhost\fR:\fIport\fR:\fIsecret\fR
-Same as \-\-service_on, except disabled by default.
+Same as \-\-service, except disabled by default.
 
 .TP
 \fB\-\-service_cfg\fR=\fI...\fR, \fB\-\-webpath\fR=\fI...\fR
@@ -317,7 +317,7 @@ Send the contents of this file to new ba
 \fB\-\-ports\fR=\fIlist\fR   \fR
 Listen on a comma\-separated list of ports.
 .TP
-\fB\-\-portalias\fR=\fIA:B\fRReport port A as port B to backends (because firewalls).
+\fB\-\-portalias\fR=\fIA:B\fRReport port A as port B to backends.
 .TP
 \fB\-\-protos\fR=\fIlist\fR  \fR
 Accept the listed protocols for tunneling.
@@ -328,13 +328,6 @@ Listen for raw connections these ports.
 allows arbitrary ports in HTTP CONNECT.
 
 .TP
-\fB\-\-accept_acl_file\fR=\fI/path/to/file\fR
-Consult an external access control file before accepting an
-incoming connection. Quick'n'dirty for mitigating abuse. The
-format is one rule per line: `rule policy comment` where a
-rule is an IP or regexp and policy is 'allow' or 'deny'.
-
-.TP
 \fB\-\-client_acl\fR=\fIpolicy\fR:\fIregexp\fR, \fB\-\-tunnel_acl\fR=\fIpolicy\fR:\fIregexp\fR
 Add a client connection or tunnel access control rule.
 Policies should be 'allow' or 'deny', the regular expression
@@ -387,7 +380,7 @@ Enable zlib compression in OpenSSL.
 Buffer at most N kB of data before blocking.
 .TP
 \fB\-\-logfile\fR=\fIF\fR   \fR
-Log to file F, \fIstdio\fR means standard output.
+Log to file F.
 .TP
 \fB\-\-daemonize   \fR
 Run as a daemon.
@@ -483,12 +476,11 @@ lapcat(1), <http://pagekite.org/>, <http
 \- Joar Wandborg <http://wandborg.se/>
 .fi
 
-\- Luc\-Pierre Terral
 
 .SH COPYRIGHT AND LICENSE
 
 
-Copyright 2010\-2015, the Beanstalks Project ehf. and Bjarni R. Einarsson.
+Copyright 2010\-2012, the Beanstalks Project ehf. and Bjarni R. Einarsson.
 
 This program is free software: you can redistribute it and/or modify it
 under the terms of the GNU Affero General Public License as published by
--- pagekite-0.5.8a.orig/pagekite/compat.py
+++ pagekite-0.5.8a/pagekite/compat.py
@@ -50,7 +50,7 @@ try:
   import datetime
   ts_to_date = datetime.datetime.fromtimestamp
   def ts_to_iso(ts=None):
-    return datetime.datetime.fromtimestamp(ts).isoformat()
+    return datetime.datetime.utcfromtimestamp(ts).isoformat()
 except ImportError:
   ts_to_date = str
   ts_to_iso = str
--- pagekite-0.5.8a.orig/pagekite/manual.py
+++ pagekite-0.5.8a/pagekite/manual.py
@@ -2,6 +2,7 @@
 """
 The program manual!
 """
+import os
 import re
 import time
 
@@ -9,8 +10,8 @@ from common import *
 from compat import ts_to_iso
 
 MAN_NAME = ("""\
-    pagekite.py v%s - Make localhost servers publicly visible
-""" % APPVER)
+    pagekite.py - Make localhost servers publicly visible
+""")
 MAN_SYNOPSIS = ("""\
     <b>pagekite.py</b> [<a>--options</a>] [<a>service</a>] <a>kite-name</a> [<a>+flags</a>]
 """)
@@ -454,7 +455,7 @@ def MAN(pname=None):
 .TH PAGEKITE "1" "%s" "https://pagekite.net/" "Awesome Commands"
 .nh
 .ad l
-""") % ts_to_iso(time.time()).split('T')[0]
+""") % ts_to_iso(float(os.environ.get('SOURCE_DATE_EPOCH', time.time()))).split('T')[0]
   for h, section, text in MANUAL_TOC:
     man += ('.%s %s\n\n%s\n\n'
             ) % (h, h == 'SH' and section.upper() or section,
