Package: src:ldb
Version: 1.1.24-1
Tags: patch

build ldb python3 bindings. note that the two changed .install files need the x bit set.

  * Build Python3 bindings.
  * Bump debhelper and standards version.
  * Do not generate symbols for the extension module
  * Do not encode the SOABI and the multiarch string into the pytalloc-util
    library, just append a '-py3'.
  * Make the build log a bit more verbose.
  * Remove empty maintainer script.

diff -Nru ldb-1.1.24/debian/compat ldb-1.1.24/debian/compat
--- ldb-1.1.24/debian/compat	2015-12-16 02:23:26.000000000 +0100
+++ ldb-1.1.24/debian/compat	2016-02-18 18:19:41.000000000 +0100
@@ -1 +1 @@
-8
+9
diff -Nru ldb-1.1.24/debian/control ldb-1.1.24/debian/control
--- ldb-1.1.24/debian/control	2015-12-16 02:23:26.000000000 +0100
+++ ldb-1.1.24/debian/control	2016-02-19 10:52:21.000000000 +0100
@@ -3,7 +3,9 @@
 Priority: optional
 Maintainer: Debian Samba Maintainers <[email protected]>
 Uploaders: Jelmer Vernooij <[email protected]>
-Build-Depends: debhelper (>> 8.1.3),
+Build-Depends: debhelper (>= 9),
+               dh-python,
+               dh-exec,
                docbook-xml,
                docbook-xsl,
                libldap2-dev,
@@ -12,11 +14,12 @@
                libtdb-dev (>= 1.3.8~),
                libtevent-dev (>= 0.9.26~),
                pkg-config,
-               python (>= 2.6.6-3),
-               python-all-dbg (>= 2.6.6-3),
-               python-all-dev (>= 2.6.6-3),
+               python-dev (>= 2.6.6-3),
                python-talloc-dev (>= 2.1.5~),
                python-tdb (>= 1.3.8~),
+               python3-dev,
+               python3-talloc-dev,
+               python3-tdb,
                xsltproc
 Homepage: http://ldb.samba.org/
 Standards-Version: 3.9.6
@@ -134,3 +137,48 @@
  ldb is a LDAP-like embedded database built on top of TDB.
  .
  This package contains the Python debug extension.
+
+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.
+
+Package: python3-ldb-dbg
+Section: debug
+Priority: extra
+Architecture: any
+Depends: python3-ldb (= ${binary:Version}), ${misc:Depends}, ${python3:Depends}
+Provides: ${python3:Provides}
+Recommends: python3-dbg, python3-talloc-dbg, python3-tdb-dbg
+Description: Python3 bindings for LDB - debug extension
+ ldb is a LDAP-like embedded database built on top of TDB.
+ .
+ This package contains the Python3 debug symbols.
diff -Nru ldb-1.1.24/debian/libldb1.postinst ldb-1.1.24/debian/libldb1.postinst
--- ldb-1.1.24/debian/libldb1.postinst	2015-12-16 02:23:26.000000000 +0100
+++ ldb-1.1.24/debian/libldb1.postinst	1970-01-01 01:00:00.000000000 +0100
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-set -e
-
-#DEBHELPER#
-
-exit 0
diff -Nru ldb-1.1.24/debian/patches/pass-waf-flags.diff ldb-1.1.24/debian/patches/pass-waf-flags.diff
--- ldb-1.1.24/debian/patches/pass-waf-flags.diff	1970-01-01 01:00:00.000000000 +0100
+++ ldb-1.1.24/debian/patches/pass-waf-flags.diff	2016-02-18 18:34:21.000000000 +0100
@@ -0,0 +1,17 @@
+# Allow to pass flags to waf
+
+--- talloc-2.1.5.orig/Makefile
++++ talloc-2.1.5/Makefile
+@@ -3,10 +3,10 @@
+ WAF=WAF_MAKE=1 PATH=buildtools/bin:../../buildtools/bin:$$PATH waf
+ 
+ all:
+-	$(WAF) build
++	$(WAF) build $(WAFFLAGS)
+ 
+ install:
+-	$(WAF) install
++	$(WAF) install $(WAFFLAGS)
+ 
+ uninstall:
+ 	$(WAF) uninstall
diff -Nru ldb-1.1.24/debian/patches/pyldb-util-name.diff ldb-1.1.24/debian/patches/pyldb-util-name.diff
--- ldb-1.1.24/debian/patches/pyldb-util-name.diff	1970-01-01 01:00:00.000000000 +0100
+++ ldb-1.1.24/debian/patches/pyldb-util-name.diff	2016-02-18 18:27:48.000000000 +0100
@@ -0,0 +1,21 @@
+# Don't encode the multiarch name into the pyldb-util library name
+
+Index: b/buildtools/wafsamba/samba_python.py
+===================================================================
+--- a/buildtools/wafsamba/samba_python.py
++++ b/buildtools/wafsamba/samba_python.py
+@@ -122,7 +122,13 @@ Build.BuildContext.SAMBA_PYTHON = SAMBA_
+ 
+ 
+ def pyembed_libname(bld, name, extrapython=False):
+-    return name + bld.env['PYTHON_SO_ABI_FLAG']
++    abi_flag = bld.env['PYTHON_SO_ABI_FLAG']
++    # do we really want the version encoded in the library name?
++    #if bld.env['IS_EXTRA_PYTHON'] and 'DEB_HOST_MULTIARCH' in os.environ:
++    #    abi_flag = abi_flag.replace('-%s' % os.environ['DEB_HOST_MULTIARCH'], '')
++    if bld.env['IS_EXTRA_PYTHON']:
++        abi_flag = '-py3'
++    return name + abi_flag
+ 
+ Build.BuildContext.pyembed_libname = pyembed_libname
+ 
diff -Nru ldb-1.1.24/debian/patches/series ldb-1.1.24/debian/patches/series
--- ldb-1.1.24/debian/patches/series	2015-12-16 13:40:33.000000000 +0100
+++ ldb-1.1.24/debian/patches/series	2016-02-18 18:34:48.000000000 +0100
@@ -1,2 +1,4 @@
 01_manpage_dates
 02_hurd
+pass-waf-flags.diff
+pyldb-util-name.diff
diff -Nru ldb-1.1.24/debian/python3-ldb-dev.install ldb-1.1.24/debian/python3-ldb-dev.install
--- ldb-1.1.24/debian/python3-ldb-dev.install	1970-01-01 01:00:00.000000000 +0100
+++ ldb-1.1.24/debian/python3-ldb-dev.install	2016-02-18 18:29:45.000000000 +0100
@@ -0,0 +1,4 @@
+#! /usr/bin/dh-exec
+usr/include/pyldb.h ${DEB_PY3_INCDIR}
+usr/lib/*/libpyldb-util-py3.so
+usr/lib/*/pkgconfig/pyldb-util.pc
diff -Nru ldb-1.1.24/debian/python3-ldb.install ldb-1.1.24/debian/python3-ldb.install
--- ldb-1.1.24/debian/python3-ldb.install	1970-01-01 01:00:00.000000000 +0100
+++ ldb-1.1.24/debian/python3-ldb.install	2016-02-18 18:29:53.000000000 +0100
@@ -0,0 +1,2 @@
+usr/lib/*/libpyldb-util-py3.so.*
+usr/lib/python3*
diff -Nru ldb-1.1.24/debian/python3-ldb.lintian-overrides ldb-1.1.24/debian/python3-ldb.lintian-overrides
--- ldb-1.1.24/debian/python3-ldb.lintian-overrides	1970-01-01 01:00:00.000000000 +0100
+++ ldb-1.1.24/debian/python3-ldb.lintian-overrides	2016-02-18 19:12:35.000000000 +0100
@@ -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 -Nru ldb-1.1.24/debian/python3-ldb.symbols ldb-1.1.24/debian/python3-ldb.symbols
--- ldb-1.1.24/debian/python3-ldb.symbols	1970-01-01 01:00:00.000000000 +0100
+++ ldb-1.1.24/debian/python3-ldb.symbols	2016-02-18 19:05:40.000000000 +0100
@@ -0,0 +1,4 @@
+libpyldb-util-py3.so.1 #PACKAGE# #MINVER#
+ PYLDB_UTIL_PY3_1.1.24@PYLDB_UTIL_PY3_1.1.24 2:1.1.24
+ pyldb_Dn_FromDn@PYLDB_UTIL_PY3_1.1.24 2:1.1.24
+ pyldb_Object_AsDn@PYLDB_UTIL_PY3_1.1.24 2:1.1.24
diff -Nru ldb-1.1.24/debian/python-ldb-dev.install ldb-1.1.24/debian/python-ldb-dev.install
--- ldb-1.1.24/debian/python-ldb-dev.install	2015-12-16 02:23:26.000000000 +0100
+++ ldb-1.1.24/debian/python-ldb-dev.install	2016-02-18 18:30:49.000000000 +0100
@@ -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 -Nru ldb-1.1.24/debian/python-ldb.install ldb-1.1.24/debian/python-ldb.install
--- ldb-1.1.24/debian/python-ldb.install	2015-12-16 02:23:26.000000000 +0100
+++ ldb-1.1.24/debian/python-ldb.install	2016-02-18 18:24:51.000000000 +0100
@@ -1,2 +1,2 @@
 usr/lib/*/libpyldb-util.so.*
-usr/lib/python*
+usr/lib/python2*
diff -Nru ldb-1.1.24/debian/rules ldb-1.1.24/debian/rules
--- ldb-1.1.24/debian/rules	2015-12-16 02:23:26.000000000 +0100
+++ ldb-1.1.24/debian/rules	2016-02-18 19:07:58.000000000 +0100
@@ -6,34 +6,29 @@
 LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
 
 CFLAGS += -Wall
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-CFLAGS += -O0
-else
-CFLAGS += -O2
-endif
-
 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 \
+		-v
 
 get-packaged-orig-source:
 	./debian/build-orig.sh
@@ -50,7 +45,7 @@
 		third_party/waf/wafadmin/Tools/*.pyc
 
 override_dh_auto_build:
-	$(WAF) build
+	$(WAF) build -vv
 
 override_dh_auto_test:
 ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
@@ -60,6 +55,11 @@
 override_dh_python2:
 	dh_python2 --no-guessing-versions
 
+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 --list-missing
+
 override_dh_auto_install:
 	DESTDIR=$(DESTDIR) $(WAF) install
 	rm $(DESTDIR)/usr/lib/python*/dist-packages/_tevent.so
@@ -70,8 +70,9 @@
 override_dh_strip:
 	dh_strip -pldb-tools
 	dh_strip -ppython-ldb --dbg-package=python-ldb-dbg
+	dh_strip -ppython3-ldb --dbg-package=python3-ldb-dbg
 	dh_strip -plibldb1 --dbg-package=libldb1-dbg
 
 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

Reply via email to