[odb-api] 09/14: Patch to find libOdb.so.0d in python module via multiarch path

Alastair McKinstry mckinstry at moszumanska.debian.org
Sun Nov 5 16:23:06 UTC 2017


This is an automated email from the git hooks/post-receive script.

mckinstry pushed a commit to branch debian/master
in repository odb-api.

commit cf1a891369c65ff3c5f30b9bcd643d7d4097e218
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Sun Nov 5 08:42:01 2017 +0000

    Patch to find libOdb.so.0d in python module via multiarch path
---
 debian/changelog                      |  1 +
 debian/patches/python-multiarch.patch | 60 +++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index d329664..62c9717 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,7 @@ odb-api (0.17.4-1) UNRELEASED; urgency=medium
   * Set DISABLE_OS_CHECK=On. Closes: #880681
   * Sanitise build path in cmake files for reproducibility.
   * Fix for unsigned long convert to size_t on 32-bit systems. Closes: #880680
+  * Patch to find libOdb.so.0d in python module via multiarch path
 
  -- Alastair McKinstry <mckinstry at debian.org>  Fri, 03 Nov 2017 13:28:15 +0000
 
diff --git a/debian/patches/python-multiarch.patch b/debian/patches/python-multiarch.patch
new file mode 100644
index 0000000..723307d
--- /dev/null
+++ b/debian/patches/python-multiarch.patch
@@ -0,0 +1,60 @@
+Description: Find the libOdb.so.0d library in the appropriate place on Debian
+Author: Alastair McKinstry <mckinstry at debian.org>
+Last-Updated: 2017-11-04
+Forwarded: not-needed
+
+Index: odb-api-0.17.4/odb_api/src/python/odb/odbql.py
+===================================================================
+--- odb-api-0.17.4.orig/odb_api/src/python/odb/odbql.py
++++ odb-api-0.17.4/odb_api/src/python/odb/odbql.py
+@@ -58,8 +58,20 @@ def connect(file_name):
+     """
+     return Connection(file_name)
+ 
++def multiarch_path():
++    """ Return the multiarch path to check on Debian"""
++    import subprocess
++    (ecode, res) = subprocess.getstatusoutput('dpkg-architecture')
++    if ecode != 0:
++        raise Exception("Failed to execute dpkg-architecture: is this a Debian system?")
++    for line in res.split():
++        var, val = line.split('=')
++        if var == 'DEB_HOST_MULTIARCH':
++            return '/usr/lib/' + val
++    raise Exception("DEB_HOST_MULTIARCH not defined")
++    
+ def lib_extension():
+-    if 'linux' in platform: return '.so'
++    if 'linux' in platform: return '.so.0d'
+     if 'darwin' in platform: return '.dylib'
+     if 'win' in platform: return '.DLL'
+     raise Exception("Don't know lib extension for platform " + platform)
+@@ -67,19 +79,23 @@ def lib_extension():
+ def __find_lib(paths, lib='libOdb', extension = lib_extension()):
+     file_name = lib + extension
+     for p in paths:
+-        path = p.split(os.sep)[:-1]
++        path = p.split(os.sep)
++        pth = os.sep.join(path + [file_name])
++        try:
++            r = CDLL(pth)
++            return r
++        except OSError:
++            pass
+         for i in range(len(path)):
+-            pth = os.sep.join(path + ['..'] * i + ['lib', file_name])
++            pth = os.sep.join(path[:-1] + ['..'] * i + ['lib', file_name])
+             try:
+                 r = CDLL(pth)
+-                #print '__find_libOdb: FOUND', pth
+                 return r
+             except OSError:
+-                #print '__find_libOdb: not found: ', pth
+                 pass
+     raise Exception("Can't find " + file_name)
+ 
+-libodb = __find_lib([__file__, '/tmp/build/bundle/debug/bin'])
++libodb = __find_lib([__file__, multiarch_path()])
+ 
+ # odbql prototypes
+ odbql_open = libodb.odbql_open

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/odb-api.git



More information about the debian-science-commits mailing list