diff options
author | Simo Sorce <idra@samba.org> | 2008-12-22 16:34:37 -0500 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2008-12-22 19:12:10 -0500 |
commit | c1f88421710e7a90773b481bfa07129fcdd42663 (patch) | |
tree | eb08a52ea2ffc212db8cff1f611e77b218a17599 | |
parent | 41718e315ea78998fab0893fd5f148a49d8faab8 (diff) | |
download | sssd-c1f88421710e7a90773b481bfa07129fcdd42663.tar.gz sssd-c1f88421710e7a90773b481bfa07129fcdd42663.tar.xz sssd-c1f88421710e7a90773b481bfa07129fcdd42663.zip |
Add some build fixes on top of the talloc, tdb, tevent, ldb rebases
-rw-r--r-- | ldb/Makefile.in | 4 | ||||
-rw-r--r-- | ldb/external/libevents.m4 | 6 | ||||
-rw-r--r-- | ldb/include/ldb.h | 4 | ||||
-rw-r--r-- | ldb/include/ldb_includes.h | 2 | ||||
-rw-r--r-- | ldb/ldb.mk | 8 | ||||
-rw-r--r-- | ldb/ldb.pc | 8 | ||||
-rw-r--r-- | ldb/pyldb.c | 2 | ||||
-rw-r--r-- | talloc/Makefile.in | 1 | ||||
-rw-r--r-- | tdb/tdb.i | 328 | ||||
-rw-r--r-- | tdb/tdb.mk | 8 |
10 files changed, 24 insertions, 347 deletions
diff --git a/ldb/Makefile.in b/ldb/Makefile.in index d97ca8bde..3215acb5c 100644 --- a/ldb/Makefile.in +++ b/ldb/Makefile.in @@ -50,11 +50,11 @@ LD_EXPORT_DYNAMIC = @LD_EXPORT_DYNAMIC@ SHLD = @SHLD@ SHLD_FLAGS = @SHLD_FLAGS@ -LDFLAGS = @LDFLAGS@ +LDFLAGS += @LDFLAGS@ LIBS = @LIBS@ PICFLAG = @PICFLAG@ -CFLAGS=-g -I$(srcdir)/include -Iinclude -I$(srcdir) -I$(srcdir)/.. \ +CFLAGS += -I$(srcdir)/include -Iinclude -I$(srcdir) -I$(srcdir)/.. \ $(POPT_CFLAGS) $(TALLOC_CFLAGS) $(TDB_CFLAGS) $(EVENTS_CFLAGS) \ -DLIBDIR=\"$(libdir)\" -DSHLIBEXT=\"$(SHLIBEXT)\" -DUSE_MMAP=1 @CFLAGS@ diff --git a/ldb/external/libevents.m4 b/ldb/external/libevents.m4 index 4fd2e71ec..2aabb06d5 100644 --- a/ldb/external/libevents.m4 +++ b/ldb/external/libevents.m4 @@ -2,6 +2,6 @@ AC_SUBST(EVENTS_OBJ) AC_SUBST(EVENTS_CFLAGS) AC_SUBST(EVENTS_LIBS) -AC_CHECK_HEADER(events.h, - [AC_CHECK_LIB(events, event_context_init, [EVENTS_LIBS="-levents"]) ], - [PKG_CHECK_MODULES(EVENTS, events)]) +AC_CHECK_HEADER(tevent.h, + [AC_CHECK_LIB(tevent, event_context_init, [EVENTS_LIBS="-ltevent"]) ], + [PKG_CHECK_MODULES(EVENTS, tevent)]) diff --git a/ldb/include/ldb.h b/ldb/include/ldb.h index e2ec86987..cb42e8a66 100644 --- a/ldb/include/ldb.h +++ b/ldb/include/ldb.h @@ -46,6 +46,10 @@ #define _LDB_H_ 1 /*! \endcond */ +#include <stdbool.h> +#include <talloc.h> +#include <tevent.h> + /* major restrictions as compared to normal LDAP: diff --git a/ldb/include/ldb_includes.h b/ldb/include/ldb_includes.h index 29c7b2dc5..b55350a9d 100644 --- a/ldb/include/ldb_includes.h +++ b/ldb/include/ldb_includes.h @@ -20,7 +20,7 @@ #include "system/filesys.h" #include "system/time.h" #include "talloc.h" -#include "events.h" +#include "tevent.h" #include "ldb.h" #include "ldb_errors.h" #include "ldb_private.h" diff --git a/ldb/ldb.mk b/ldb/ldb.mk index 9d94434dc..66cdea15c 100644 --- a/ldb/ldb.mk +++ b/ldb/ldb.mk @@ -64,11 +64,11 @@ examples/ldifreader: examples/ldifreader.o # Python bindings build-python:: ldb.$(SHLIBEXT) -ldb_wrap.o: $(ldbdir)/ldb_wrap.c - $(CC) $(PICFLAG) -c $(ldbdir)/ldb_wrap.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags` +pyldb.o: $(ldbdir)/pyldb.c + $(CC) $(PICFLAG) -c $(ldbdir)/pyldb.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags` -ldb.$(SHLIBEXT): ldb_wrap.o - $(SHLD) $(SHLD_FLAGS) -o ldb.$(SHLIBEXT) ldb_wrap.o $(LIB_FLAGS) `$(PYTHON_CONFIG) --ldflags` +ldb.$(SHLIBEXT): pyldb.o + $(SHLD) $(SHLD_FLAGS) -o ldb.$(SHLIBEXT) pyldb.o $(LIB_FLAGS) `$(PYTHON_CONFIG) --ldflags` install-python:: build-python mkdir -p $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"` diff --git a/ldb/ldb.pc b/ldb/ldb.pc index cf986a0f5..0d439df5b 100644 --- a/ldb/ldb.pc +++ b/ldb/ldb.pc @@ -1,16 +1,16 @@ -prefix=/usr/local/samba +prefix=/usr/local exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include -modulesdir=${prefix}/modules +modulesdir=@modulesdir@ Name: ldb Description: An LDAP-like embedded database -Version: 4 +Version: 0.9.2 Requires.private: tdb Requires: talloc Libs: -L${libdir} -lldb -Libs.private: @LDAP_LIBS@ +Libs.private: -llber -lldap Cflags: -I${includedir} Modulesdir: ${modulesdir} URL: http://ldb.samba.org/ diff --git a/ldb/pyldb.c b/ldb/pyldb.c index dfabed54e..725477232 100644 --- a/ldb/pyldb.c +++ b/ldb/pyldb.c @@ -28,7 +28,7 @@ #include <stdint.h> #include <stdbool.h> #include "pyldb.h" -#include "events.h" +#include "tevent.h" #include "ldb.h" #include "ldb_errors.h" #include "ldb_private.h" diff --git a/talloc/Makefile.in b/talloc/Makefile.in index 586a61642..5224b00a7 100644 --- a/talloc/Makefile.in +++ b/talloc/Makefile.in @@ -40,6 +40,7 @@ shared-build: all ln -sf $(TALLOC_SOLIB) $(sharedbuilddir)/lib/libtalloc.so ${INSTALLCMD} -d $(sharedbuilddir)/include ${INSTALLCMD} -m 644 $(srcdir)/talloc.h $(sharedbuilddir)/include + ${INSTALLCMD} -m 644 $(srcdir)/pytalloc.h $(sharedbuilddir)/include check: test diff --git a/tdb/tdb.i b/tdb/tdb.i deleted file mode 100644 index 4b529913d..000000000 --- a/tdb/tdb.i +++ /dev/null @@ -1,328 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - Swig interface to tdb. - - Copyright (C) 2004-2006 Tim Potter <tpot@samba.org> - Copyright (C) 2007 Jelmer Vernooij <jelmer@samba.org> - - ** NOTE! The following LGPL license applies to the tdb - ** library. This does NOT imply that all of Samba is released - ** under the LGPL - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see <http://www.gnu.org/licenses/>. -*/ - -%define DOCSTRING -"TDB is a simple key-value database similar to GDBM that supports multiple writers." -%enddef - -%module(docstring=DOCSTRING) tdb - -%{ - -/* This symbol is used in both includes.h and Python.h which causes an - annoying compiler warning. */ - -#ifdef HAVE_FSTAT -#undef HAVE_FSTAT -#endif - -/* Include tdb headers */ -#include <stdint.h> -#include <signal.h> -#include <tdb.h> -#include <fcntl.h> - -typedef TDB_CONTEXT tdb; -%} - -/* The tdb functions will crash if a NULL tdb context is passed */ - -%import exception.i -%import stdint.i - -%typemap(check,noblock=1) TDB_CONTEXT* { - if ($1 == NULL) - SWIG_exception(SWIG_ValueError, - "tdb context must be non-NULL"); -} - -/* In and out typemaps for the TDB_DATA structure. This is converted to - and from the Python string type which can contain arbitrary binary - data.. */ - -%typemap(in,noblock=1) TDB_DATA { - if ($input == Py_None) { - $1.dsize = 0; - $1.dptr = NULL; - } else if (!PyString_Check($input)) { - PyErr_SetString(PyExc_TypeError, "string arg expected"); - return NULL; - } else { - $1.dsize = PyString_Size($input); - $1.dptr = (uint8_t *)PyString_AsString($input); - } -} - -%typemap(out,noblock=1) TDB_DATA { - if ($1.dptr == NULL && $1.dsize == 0) { - $result = Py_None; - } else { - $result = PyString_FromStringAndSize((const char *)$1.dptr, $1.dsize); - free($1.dptr); - } -} - -/* Treat a mode_t as an unsigned integer */ -typedef int mode_t; - -/* flags to tdb_store() */ -%constant int REPLACE = TDB_REPLACE; -%constant int INSERT = TDB_INSERT; -%constant int MODIFY = TDB_MODIFY; - -/* flags for tdb_open() */ -%constant int DEFAULT = TDB_DEFAULT; -%constant int CLEAR_IF_FIRST = TDB_CLEAR_IF_FIRST; -%constant int INTERNAL = TDB_INTERNAL; -%constant int NOLOCK = TDB_NOLOCK; -%constant int NOMMAP = TDB_NOMMAP; -%constant int CONVERT = TDB_CONVERT; -%constant int BIGENDIAN = TDB_BIGENDIAN; - -enum TDB_ERROR { - TDB_SUCCESS=0, - TDB_ERR_CORRUPT, - TDB_ERR_IO, - TDB_ERR_LOCK, - TDB_ERR_OOM, - TDB_ERR_EXISTS, - TDB_ERR_NOLOCK, - TDB_ERR_LOCK_TIMEOUT, - TDB_ERR_NOEXIST, - TDB_ERR_EINVAL, - TDB_ERR_RDONLY -}; - -%rename(lock_all) tdb_context::lockall; -%rename(unlock_all) tdb_context::unlockall; - -%rename(read_lock_all) tdb_context::lockall_read; -%rename(read_unlock_all) tdb_context::unlockall_read; - -%typemap(default,noblock=1) int tdb_flags { - $1 = TDB_DEFAULT; -} - -%typemap(default,noblock=1) int flags { - $1 = O_RDWR; -} - -%typemap(default,noblock=1) int hash_size { - $1 = 0; -} - -%typemap(default,noblock=1) mode_t mode { - $1 = 0600; -} - -%typemap(default,noblock=1) int flag { - $1 = TDB_REPLACE; -} - -%rename(Tdb) tdb_context; -%feature("docstring") tdb_context "A TDB file."; -%typemap(out,noblock=1) tdb * { - /* Throw an IOError exception from errno if tdb_open() returns NULL */ - if ($1 == NULL) { - PyErr_SetFromErrno(PyExc_IOError); - SWIG_fail; - } - $result = SWIG_NewPointerObj($1, $1_descriptor, 0); -} - -typedef struct tdb_context { - %extend { - %feature("docstring") tdb "S.__init__(name,hash_size=0,tdb_flags=TDB_DEFAULT,flags=O_RDWR,mode=0600)\n" - "Open a TDB file."; - tdb(const char *name, int hash_size, int tdb_flags, int flags, mode_t mode) { - return tdb_open(name, hash_size, tdb_flags, flags, mode); - } - %feature("docstring") error "S.error() -> int\n" - "Find last error number returned by operation on this TDB."; - enum TDB_ERROR error(); - ~tdb() { tdb_close($self); } - %feature("docstring") close "S.close() -> None\n" - "Close the TDB file."; - int close(); - int append(TDB_DATA key, TDB_DATA new_dbuf); - %feature("docstring") errorstr "S.errorstr() -> errorstring\n" - "Obtain last error message."; - const char *errorstr(); - %rename(get) fetch; - %feature("docstring") fetch "S.fetch(key) -> value\n" - "Fetch a value."; - TDB_DATA fetch(TDB_DATA key); - %feature("docstring") delete "S.delete(key) -> None\n" - "Delete an entry."; - int delete(TDB_DATA key); - %feature("docstring") store "S.store(key, value, flag=TDB_REPLACE) -> None\n" - "Store an entry."; - int store(TDB_DATA key, TDB_DATA dbuf, int flag); - %feature("docstring") exists "S.exists(key) -> bool\n" - "Check whether key exists in this database."; - int exists(TDB_DATA key); - %feature("docstring") firstkey "S.firstkey() -> data\n" - "Return the first key in this database."; - TDB_DATA firstkey(); - %feature("docstring") nextkey "S.nextkey(prev) -> data\n" - "Return the next key in this database."; - TDB_DATA nextkey(TDB_DATA key); - %feature("docstring") lockall "S.lockall() -> bool"; - int lockall(); - %feature("docstring") unlockall "S.unlockall() -> bool"; - int unlockall(); - %feature("docstring") unlockall "S.lockall_read() -> bool"; - int lockall_read(); - %feature("docstring") unlockall "S.unlockall_read() -> bool"; - int unlockall_read(); - %feature("docstring") reopen "S.reopen() -> bool\n" - "Reopen this file."; - int reopen(); - %feature("docstring") transaction_start "S.transaction_start() -> None\n" - "Start a new transaction."; - int transaction_start(); - %feature("docstring") transaction_commit "S.transaction_commit() -> None\n" - "Commit the currently active transaction."; - int transaction_commit(); - %feature("docstring") transaction_cancel "S.transaction_cancel() -> None\n" - "Cancel the currently active transaction."; - int transaction_cancel(); - int transaction_recover(); - %feature("docstring") hash_size "S.hash_size() -> int"; - int hash_size(); - %feature("docstring") map_size "S.map_size() -> int"; - size_t map_size(); - %feature("docstring") get_flags "S.get_flags() -> int"; - int get_flags(); - %feature("docstring") set_max_dead "S.set_max_dead(int) -> None"; - void set_max_dead(int max_dead); - %feature("docstring") name "S.name() -> path\n" \ - "Return filename of this TDB file."; - const char *name(); - } - - %pythoncode { - def __repr__(self): - return "Tdb('%s')" % self.name() - - # Random access to keys, values - def __getitem__(self, key): - result = self.get(key) - if result is None: - raise KeyError, '%s: %s' % (key, self.errorstr()) - return result - - def __setitem__(self, key, item): - if self.store(key, item) == -1: - raise IOError, self.errorstr() - - def __delitem__(self, key): - if not self.exists(key): - raise KeyError, '%s: %s' % (key, self.errorstr()) - self.delete(key) - - def __contains__(self, key): - return self.exists(key) != 0 - - def has_key(self, key): - return self.exists(key) != 0 - - def fetch_uint32(self, key): - data = self.get(key) - if data is None: - return None - import struct - return struct.unpack("<L", data)[0] - - def fetch_int32(self, key): - data = self.get(key) - if data is None: - return None - import struct - return struct.unpack("<l", data)[0] - - # Tdb iterator - class TdbIterator: - def __init__(self, tdb): - self.tdb = tdb - self.key = None - - def __iter__(self): - return self - - def next(self): - if self.key is None: - self.key = self.tdb.firstkey() - if self.key is None: - raise StopIteration - return self.key - else: - self.key = self.tdb.nextkey(self.key) - if self.key is None: - raise StopIteration - return self.key - - def __iter__(self): - return self.TdbIterator(self) - - # Implement other dict functions using TdbIterator - - def keys(self): - return [k for k in iter(self)] - - def values(self): - return [self[k] for k in iter(self)] - - def items(self): - return [(k, self[k]) for k in iter(self)] - - def __len__(self): - return len(self.keys()) - - def clear(self): - for k in iter(self): - del(self[k]) - - def iterkeys(self): - for k in iter(self): - yield k - - def itervalues(self): - for k in iter(self): - yield self[k] - - def iteritems(self): - for k in iter(self): - yield (k, self[k]) - - # TODO: any other missing methods for container types - } -} tdb; - -%pythoncode { -__docformat__ = 'restructuredText' -open = Tdb -} diff --git a/tdb/tdb.mk b/tdb/tdb.mk index 025457503..72f44e721 100644 --- a/tdb/tdb.mk +++ b/tdb/tdb.mk @@ -35,11 +35,11 @@ clean:: build-python:: tdb.$(SHLIBEXT) -tdb_wrap.o: $(tdbdir)/tdb_wrap.c - $(CC) $(PICFLAG) -c $(tdbdir)/tdb_wrap.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags` +pytdb.o: $(tdbdir)/pytdb.c + $(CC) $(PICFLAG) -c $(tdbdir)/pytdb.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags` -tdb.$(SHLIBEXT): libtdb.$(SHLIBEXT) tdb_wrap.o - $(SHLD) $(SHLD_FLAGS) -o $@ tdb_wrap.o -L. -ltdb `$(PYTHON_CONFIG) --ldflags` +tdb.$(SHLIBEXT): libtdb.$(SHLIBEXT) pytdb.o + $(SHLD) $(SHLD_FLAGS) -o $@ pytdb.o -L. -ltdb `$(PYTHON_CONFIG) --ldflags` install:: installdirs installbin installheaders installlibs \ $(PYTHON_INSTALL_TARGET) |