Here's an updated patch, though I'm not sure why it doesn't complain
about missing python3-ldb.symbols.


-- 
t
From 2c87ebd5dcad2e874630c79a6b06f51f3cffc063 Mon Sep 17 00:00:00 2001
From: Timo Aaltonen <tjaal...@debian.org>
Date: Fri, 25 May 2018 15:33:56 +0300
Subject: [PATCH] Add py3 support

---
 debian/control                       | 37 ++++++++++++++++++++++++++++
 debian/python-ldb-dev.install        |  3 ++-
 debian/python-ldb.install            |  2 +-
 debian/python-ldb.symbols            |  3 ---
 debian/python3-ldb-dev.install       |  4 +++
 debian/python3-ldb.install           |  2 ++
 debian/python3-ldb.lintian-overrides |  2 ++
 debian/rules                         | 18 ++++++++++----
 8 files changed, 61 insertions(+), 10 deletions(-)
 mode change 100644 => 100755 debian/python-ldb-dev.install
 create mode 100755 debian/python3-ldb-dev.install
 create mode 100644 debian/python3-ldb.install
 create mode 100644 debian/python3-ldb.lintian-overrides

diff --git a/debian/control b/debian/control
index 9486a1c..74a1a8e 100644
--- a/debian/control
+++ b/debian/control
@@ -5,6 +5,7 @@ Maintainer: Debian Samba Maintainers <pkg-samba-ma...@lists.alioth.debian.org>
 Uploaders: Jelmer Vernooij <jel...@debian.org>,
            Mathieu Parent <sath...@debian.org>
 Build-Depends: debhelper (>> 11),
+               dh-exec,
                dh-python,
                docbook-xml,
                docbook-xsl,
@@ -20,6 +21,9 @@ Build-Depends: debhelper (>> 11),
                python-all-dev (>= 2.6.6-3),
                python-talloc-dev (>= 2.1.11~),
                python-tdb (>= 1.3.15~),
+               python3-dev,
+               python3-talloc-dev,
+               python3-tdb,
                xsltproc
 Homepage: http://ldb.samba.org/
 Standards-Version: 4.1.3
@@ -121,3 +125,36 @@ Description: LDB Python bindings - development files
  database.
  .
  This package contains the development files for the Python bindings.
+
+Package: python3-ldb
+Pre-Depends: ${misc:Pre-Depends}
+Section: python
+Architecture: any
+Depends: libldb1 (= ${binary:Version}),
+         ${misc:Depends},
+         ${python3:Depends},
+         ${shlibs:Depends}
+Provides: ${python3:Provides}
+Breaks: ${python3:Breaks}
+Description: Python3 bindings for LDB
+ ldb is a LDAP-like embedded database built on top of TDB.
+ .
+ This package contains the Python3 bindings.
+
+Package: python3-ldb-dev
+Section: libdevel
+Architecture: any
+Depends: libc6-dev,
+         libldb-dev,
+         pkg-config,
+         python3-ldb (= ${binary:Version}),
+         ${misc:Depends}
+Description: LDB Python3 bindings - development files
+ ldb is a LDAP-like embedded database built on top of TDB.
+ .
+ It is a fast database with an LDAP-like API designed
+ to be used within an application. In some ways it can be seen as a
+ intermediate solution between key-value pair databases and a real LDAP
+ database.
+ .
+ This package contains the development files for the Python3 bindings.
diff --git a/debian/python-ldb-dev.install b/debian/python-ldb-dev.install
old mode 100644
new mode 100755
index 234634f..3b40388
--- a/debian/python-ldb-dev.install
+++ b/debian/python-ldb-dev.install
@@ -1,3 +1,4 @@
-usr/include/pyldb.h
+#! /usr/bin/dh-exec
+usr/include/pyldb.h ${DEB_PY2_INCDIR}
 usr/lib/*/libpyldb-util.so
 usr/lib/*/pkgconfig/pyldb-util.pc
diff --git a/debian/python-ldb.install b/debian/python-ldb.install
index d6f9c1b..7ad4b68 100644
--- a/debian/python-ldb.install
+++ b/debian/python-ldb.install
@@ -1,2 +1,2 @@
 usr/lib/*/libpyldb-util.so.*
-usr/lib/python*
+usr/lib/python2*
diff --git a/debian/python-ldb.symbols b/debian/python-ldb.symbols
index 492e699..b7fd1e1 100644
--- a/debian/python-ldb.symbols
+++ b/debian/python-ldb.symbols
@@ -1,6 +1,3 @@
-ldb.so python-ldb #MINVER#
- PyStr_AsUTF8AndSize@Base 2:1.1.29
- initldb@Base 2:1.1.29
 libpyldb-util.so.1 #PACKAGE# #MINVER#
  PYLDB_UTIL_1.1.2@PYLDB_UTIL_1.1.2 1.1.2~
  PYLDB_UTIL_1.1.3@PYLDB_UTIL_1.1.3 1.1.3
diff --git a/debian/python3-ldb-dev.install b/debian/python3-ldb-dev.install
new file mode 100755
index 0000000..273ba9d
--- /dev/null
+++ b/debian/python3-ldb-dev.install
@@ -0,0 +1,4 @@
+#! /usr/bin/dh-exec
+usr/include/pyldb.h ${DEB_PY3_INCDIR}
+usr/lib/*/libpyldb-util.cpython*.so
+usr/lib/*/pkgconfig/pyldb-util.cpython*.pc
diff --git a/debian/python3-ldb.install b/debian/python3-ldb.install
new file mode 100644
index 0000000..4a3e039
--- /dev/null
+++ b/debian/python3-ldb.install
@@ -0,0 +1,2 @@
+usr/lib/*/libpyldb-util.cpython*.so.*
+usr/lib/python3*
diff --git a/debian/python3-ldb.lintian-overrides b/debian/python3-ldb.lintian-overrides
new file mode 100644
index 0000000..017caf3
--- /dev/null
+++ b/debian/python3-ldb.lintian-overrides
@@ -0,0 +1,2 @@
+python3-ldb binary: binary-or-shlib-defines-rpath * /usr/lib/ldb
+python3-ldb binary: package-name-doesnt-match-sonames libpyldb-util-py3-1
diff --git a/debian/rules b/debian/rules
index 55a5f57..3a802a4 100755
--- a/debian/rules
+++ b/debian/rules
@@ -21,22 +21,22 @@ LDFLAGS += -Wl,--as-needed
 DESTDIR=$(CURDIR)/debian/tmp
 
 export PYTHON=$(shell which `pyversions -d`)
-export PYTHON_CONFIG="$(PYTHON)-config"
 export WAF=$(PYTHON) ./buildtools/bin/waf
 
 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
 
 %:
-	dh $* --with python2
+	dh $* --with python2,python3
 
 override_dh_auto_configure:
-	PYTHON="$(PYTHON)" PYTHON_CONFIG="$(PYTHON_CONFIG)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
+	PYTHON="$(PYTHON)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
 		$(WAF) configure --prefix=/usr --disable-rpath-install \
 		--builtin-libraries=ccan,replace,tdb_compat \
 		--bundled-libraries=NONE,pytevent \
 		--minimum-library-version="$(shell ./debian/autodeps.py --minimum-library-version)" \
 		--libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
-		--with-modulesdir=/usr/lib/$(DEB_HOST_MULTIARCH)/ldb/modules
+		--with-modulesdir=/usr/lib/$(DEB_HOST_MULTIARCH)/ldb/modules \
+		--extra-python=python3
 
 get-packaged-orig-source:
 	./debian/build-orig.sh
@@ -70,9 +70,17 @@ override_dh_auto_install:
 	ar cr libldb.a bin/default/common/*.o
 	mv libldb.a $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)
 
+override_dh_install:
+	DEB_PY2_INCDIR=$(shell python-config --includes | sed 's,^-I\([^ ]*\).*,\1,') \
+	DEB_PY3_INCDIR=$(shell python3-config --includes | sed 's,^-I\([^ ]*\).*,\1,') \
+		dh_install
+
+override_dh_missing:
+	dh_missing --list-missing
+
 override_dh_strip:
 	dh_strip --dbgsym-migration='python-ldb-dbg (<< 2:1.1.27-1~), libldb1-dbg (<< 2:1.1.27-1~)'
 
 override_dh_makeshlibs:
-	dh_makeshlibs -Xldb.so -ppython-ldb -- -c4
+	dh_makeshlibs -Xldb. -X_tevent. -ppython-ldb -ppython3-ldb -- -c3
 	dh_makeshlibs -X/usr/lib/$(DEB_HOST_MULTIARCH)/ldb -plibldb1 -- -c4
-- 
2.17.0

Reply via email to