Bug#911988: reintroduce fixed python2 package for rdepends

2018-10-26 Thread Julian Taylor
Package: txtorcon
Version:  18.0.2-2
Severity: important

The removal of the python2 package in #905253 due to a packaging bug
made its reverse dependencies RC buggy.
As upstream still supports python2 [0], it is tested in the package
build and its rdepends and buster will still ship with python2 please
reintroduce the python2 package.

Attached a debdiff that fixes the installation of the python3 only file
in the python2 package.


[0] https://github.com/meejah/txtorcon
diff --git a/debian/changelog b/debian/changelog
index f266461..b644918 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+txtorcon (18.0.2-3) unstable; urgency=medium
+
+  * reintroduce fixed Python 2 package needed by reverse dependencies
+Closes: #911271
+
+ -- Julian Taylor   Fri, 26 Oct 2018 22:30:43 
+0200
+
 txtorcon (18.0.2-2) unstable; urgency=medium
 
   * No longer builds a Python 2 package (Closes: #905253)
diff --git a/debian/control b/debian/control
index 0eac5fa..a20741c 100644
--- a/debian/control
+++ b/debian/control
@@ -8,6 +8,14 @@ Build-Depends: debhelper (>= 9),
dh-python,
graphviz,
lsof,
+   python-all,
+   python-geoip,
+   python-ipaddress,
+   python-mock,
+   python-repoze.sphinx.autointerface,
+   python-setuptools,
+   python-sphinx,
+   python-twisted,
python3-all,
python3-geoip,
python3-mock,
@@ -21,6 +29,29 @@ Vcs-Browser: 
https://salsa.debian.org/pkg-privacy-team/txtorcon
 Vcs-Git: https://salsa.debian.org/pkg-privacy-team/txtorcon.git
 Homepage: https://github.com/meejah/txtorcon
 
+Package: python-txtorcon
+Architecture: all
+Depends: python-geoip,
+ python-ipaddress,
+ python-twisted,
+ python-zope.interface,
+ ${misc:Depends},
+ ${python:Depends}
+Suggests: tor
+Provides: ${python:Provides}
+Description: Twisted-based asynchronous Tor control protocol implementation 
(Python 2)
+ txtorcon main feature is to present an asynchronous API to speak the Tor
+ client protocol in Python. It also provides abstractions to track and get
+ updates about Tor's state and current configuration (including writing it to
+ Tor or disk), along with helpers to asynchronously launch slave instances of
+ Tor including Twisted endpoint support.
+ .
+ Twisted is an event-driven networking engine written in Python and Tor is an
+ onion-routing network designed to improve people's privacy and anonymity on 
the
+ Internet.
+ .
+ This package contains the Python 2 module.
+
 Package: python3-txtorcon
 Architecture: all
 Depends: python3-geoip,
diff --git a/debian/rules b/debian/rules
index a334f92..aa0b193 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,7 +3,7 @@
 export PYBUILD_NAME=txtorcon
 
 %:
-   dh $@ --with=python3,sphinxdoc --buildsystem=pybuild
+   dh $@ --with=python2,python3,sphinxdoc --buildsystem=pybuild
 
 override_dh_auto_build:
PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -bhtml docs/ 
docs/_build/html # HTML generator
@@ -11,17 +11,28 @@ override_dh_auto_build:
 
 override_dh_auto_install:
dh_auto_install -O--buildsystem=pybuild
+   # don't install py3 files in py2 as they don't compile during 
installation
+   find debian/python-txtorcon/ -name controller_py3.py -delete
+   mkdir -p debian/python-txtorcon/usr/share/doc/python-txtorcon
mkdir -p debian/python3-txtorcon/usr/share/doc/python3-txtorcon
set -e && \
+   for data_src in README.rst TODO examples; do \
+   mv debian/python-txtorcon/usr/share/txtorcon/$$data_src \
+   debian/python-txtorcon/usr/share/doc/python-txtorcon; \
+   done
+   set -e && \
for data_src in README.rst TODO examples; do \
mv debian/python3-txtorcon/usr/share/txtorcon/$$data_src \
debian/python3-txtorcon/usr/share/doc/python3-txtorcon; 
\
done
+   chmod 644 
debian/python-txtorcon/usr/share/doc/python-txtorcon/examples/*.py
chmod 644 
debian/python3-txtorcon/usr/share/doc/python3-txtorcon/examples/*.py
+   rm -r debian/python-txtorcon/usr/share/txtorcon
rm -r debian/python3-txtorcon/usr/share/txtorcon
 
 override_dh_compress:
dh_compress -Xlaunch_tor_with_simplehttpd.py -O--buildsystem=pybuild
 
 override_dh_auto_test:
+   PYTHONPATH=. trial --reporter=text test
PYTHONPATH=. trial3 --reporter=text test


Bug#911988: reintroduce fixed python2 package for rdepends

2018-10-26 Thread Julian Taylor
tags 911988 + patch
thanks

Ops I forgot to adapt a runtime check, attached a fixed debdiff
diff --git a/debian/changelog b/debian/changelog
index f266461..a94e1bb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+txtorcon (18.0.2-3) unstable; urgency=medium
+
+  * reintroduce fixed Python 2 package needed by reverse dependencies
+do not install python3 files to avoid failure during installation
+add fix-controller-py3check.patch to correct the python3 runtime check
+Closes: #911271
+
+ -- Julian Taylor   Fri, 26 Oct 2018 22:30:43 
+0200
+
 txtorcon (18.0.2-2) unstable; urgency=medium
 
   * No longer builds a Python 2 package (Closes: #905253)
diff --git a/debian/control b/debian/control
index 0eac5fa..a20741c 100644
--- a/debian/control
+++ b/debian/control
@@ -8,6 +8,14 @@ Build-Depends: debhelper (>= 9),
dh-python,
graphviz,
lsof,
+   python-all,
+   python-geoip,
+   python-ipaddress,
+   python-mock,
+   python-repoze.sphinx.autointerface,
+   python-setuptools,
+   python-sphinx,
+   python-twisted,
python3-all,
python3-geoip,
python3-mock,
@@ -21,6 +29,29 @@ Vcs-Browser: 
https://salsa.debian.org/pkg-privacy-team/txtorcon
 Vcs-Git: https://salsa.debian.org/pkg-privacy-team/txtorcon.git
 Homepage: https://github.com/meejah/txtorcon
 
+Package: python-txtorcon
+Architecture: all
+Depends: python-geoip,
+ python-ipaddress,
+ python-twisted,
+ python-zope.interface,
+ ${misc:Depends},
+ ${python:Depends}
+Suggests: tor
+Provides: ${python:Provides}
+Description: Twisted-based asynchronous Tor control protocol implementation 
(Python 2)
+ txtorcon main feature is to present an asynchronous API to speak the Tor
+ client protocol in Python. It also provides abstractions to track and get
+ updates about Tor's state and current configuration (including writing it to
+ Tor or disk), along with helpers to asynchronously launch slave instances of
+ Tor including Twisted endpoint support.
+ .
+ Twisted is an event-driven networking engine written in Python and Tor is an
+ onion-routing network designed to improve people's privacy and anonymity on 
the
+ Internet.
+ .
+ This package contains the Python 2 module.
+
 Package: python3-txtorcon
 Architecture: all
 Depends: python3-geoip,
diff --git a/debian/patches/fix-controller-py3check.patch 
b/debian/patches/fix-controller-py3check.patch
new file mode 100644
index 000..3e38df3
--- /dev/null
+++ b/debian/patches/fix-controller-py3check.patch
@@ -0,0 +1,20 @@
+Description: adapt python3 check for missing file
+Author: Julian Taylor 
+
+The file is not installed in python2 to avoid pycompile trying to compile it
+with python2.
+For this the runtime check needs to be adapted.
+
+Index: txtorcon/txtorcon/controller.py
+===
+--- txtorcon.orig/txtorcon/controller.py
 txtorcon/txtorcon/controller.py
+@@ -42,7 +42,7 @@ from .interface import ITor
+ try:
+ from .controller_py3 import _AsyncOnionAuthContext
+ HAVE_ASYNC = True
+-except SyntaxError:
++except Exception:
+ HAVE_ASYNC = False
+ 
+ if sys.platform in ('linux', 'linux2', 'darwin'):
diff --git a/debian/patches/series b/debian/patches/series
index ed80250..6bfd16d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
+fix-controller-py3check.patch
 disable_test_for_invalid_geoip.patch
 remove-privacy-infringing-buttons.patch
 remove-privacy-infringing-JS.patch
diff --git a/debian/rules b/debian/rules
index a334f92..aa0b193 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,7 +3,7 @@
 export PYBUILD_NAME=txtorcon
 
 %:
-   dh $@ --with=python3,sphinxdoc --buildsystem=pybuild
+   dh $@ --with=python2,python3,sphinxdoc --buildsystem=pybuild
 
 override_dh_auto_build:
PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -bhtml docs/ 
docs/_build/html # HTML generator
@@ -11,17 +11,28 @@ override_dh_auto_build:
 
 override_dh_auto_install:
dh_auto_install -O--buildsystem=pybuild
+   # don't install py3 files in py2 as they don't compile during 
installation
+   find debian/python-txtorcon/ -name controller_py3.py -delete
+   mkdir -p debian/python-txtorcon/usr/share/doc/python-txtorcon
mkdir -p debian/python3-txtorcon/usr/share/doc/python3-txtorcon
set -e && \
+   for data_src in README.rst TODO examples; do \
+   mv debian/python-txtorcon/usr/share/txtorcon/$$data_src \
+   debian/python-txtorcon/usr/share/doc/python-txtorcon; \
+   done
+   set -e && \
for data_src in README.rst TODO examples; do \
mv debian/python3-txtorcon/usr/share/txtorcon/$$data_src \
debian/python3-txtorcon/usr/share/doc/python3-txtorc