[SCM] Samba Shared Repository - branch master updated

Jelmer Vernooij jelmer at samba.org
Sat Sep 25 13:20:48 MDT 2010


The branch, master has been updated
       via  0a18f89 pyteven: Fix build warnings.
       via  296ff48 Check in configure/Makefile for those projects that have waf as primary build system.
       via  e68afdc pytevent: Add more tests.
       via  ddb3c48 pytevent: Fill in client side fnuctions.
       via  ba5d034 selftest: If a testsuite is killed by a signal, let selftest die.
       via  465cff7 tevent: Add infrastructure for python bindings.
       via  1f22b63 tevent: Switch to using waf by default.
      from  e81db37 s3: Fix bug 7470

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 0a18f89e8a1599bae4ac96b6f3ab358797881ef7
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Sep 23 17:40:35 2010 -0700

    pyteven: Fix build warnings.

commit 296ff486e41d309493c9ddb195578cb6355e2b36
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Sep 23 17:29:53 2010 -0700

    Check in configure/Makefile for those projects that have waf as primary build system.

commit e68afdc02f7ead1da8d0e11cf13a1845eebe7d48
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Sep 23 17:13:56 2010 -0700

    pytevent: Add more tests.

commit ddb3c48f1adf3e3202ad904ba9de4027c7e140df
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Sep 23 16:50:36 2010 -0700

    pytevent: Fill in client side fnuctions.

commit ba5d034d5318d340aefa2b3bd2600c0cc43c934b
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Sep 23 15:14:57 2010 -0700

    selftest: If a testsuite is killed by a signal, let selftest die.

commit 465cff7531731929b963085a13ef9a74100858e5
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Sep 23 14:28:02 2010 -0700

    tevent: Add infrastructure for python bindings.

commit 1f22b63b3453e7d8919dcbdd41ea62b34001754e
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Sep 23 14:01:02 2010 -0700

    tevent: Switch to using waf by default.

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                                      |   11 +-
 lib/tevent/Makefile                             |   57 ++
 lib/tevent/{autogen.sh => autogen-autotools.sh} |    0
 lib/tevent/autogen.sh                           |   15 +-
 lib/tevent/bindings.py                          |   62 ++
 lib/tevent/configure                            |   14 +
 lib/tevent/pytevent.c                           |  762 +++++++++++++++++++++++
 lib/tevent/wscript                              |   25 +-
 selftest/selftest.pl                            |    4 +-
 source4/Makefile                                |   57 ++
 source4/configure                               |   14 +
 source4/lib/ldb/Makefile                        |   57 ++
 source4/lib/ldb/configure                       |   14 +
 13 files changed, 1070 insertions(+), 22 deletions(-)
 create mode 100644 lib/tevent/Makefile
 copy lib/tevent/{autogen.sh => autogen-autotools.sh} (100%)
 mode change 100755 => 120000 lib/tevent/autogen.sh
 create mode 100644 lib/tevent/bindings.py
 create mode 100755 lib/tevent/configure
 create mode 100644 lib/tevent/pytevent.c
 create mode 100644 source4/Makefile
 create mode 100755 source4/configure
 create mode 100644 source4/lib/ldb/Makefile
 create mode 100755 source4/lib/ldb/configure


Changeset truncated at 500 lines:

diff --git a/.gitignore b/.gitignore
index 56bba7e..49b24a0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,8 +13,12 @@ config.h
 config.h.in
 config.log
 config.status
-configure
-Makefile
+source3/configure
+source3/Makefile
+lib/talloc/configure
+lib/talloc/Makefile
+lib/tdb/configure
+lib/tdb/Makefile
 *.d
 *_err.c
 *_err.h
@@ -83,7 +87,6 @@ source3/library-versions
 librpc/gen_ndr/*.*
 source3/librpc/gen_ndr/*.*
 source4/librpc/gen_ndr/*.*
-source3/Makefile
 source3/nsswitch/*.so
 source3/pkgconfig/*.pc
 source3/proto_exists
@@ -313,14 +316,12 @@ packaging/RHEL-CTDB/samba.spec
 packaging/RHEL/samba.spec
 packaging/RHEL/makerpms.sh
 source3/setup
-lib/tevent/Makefile
 lib/tevent/tevent.so
 lib/tevent/libtevent.so*
 lib/tevent/libtevent.a
 lib/tdb/libtdb.so
 lib/tdb/tdb.so
 lib/tdb/libtdb.a
-lib/tdb/Makefile
 lib/tdb/bin
 docs-xml/build/catalog.xml
 docs-xml/*/images/*.eps
diff --git a/lib/tevent/Makefile b/lib/tevent/Makefile
new file mode 100644
index 0000000..bf19ebe
--- /dev/null
+++ b/lib/tevent/Makefile
@@ -0,0 +1,57 @@
+# simple makefile wrapper to run waf
+
+WAF=WAF_MAKE=1 ../../buildtools/bin/waf
+
+all:
+	$(WAF) build
+
+install:
+	$(WAF) install
+
+uninstall:
+	$(WAF) uninstall
+
+test:
+	$(WAF) test $(TEST_OPTIONS)
+
+testenv:
+	$(WAF) test --testenv $(TEST_OPTIONS)
+
+quicktest:
+	$(WAF) test --quick $(TEST_OPTIONS)
+
+dist:
+	$(WAF) dist
+
+distcheck:
+	$(WAF) distcheck
+
+clean:
+	$(WAF) clean
+
+distclean:
+	$(WAF) distclean
+
+reconfigure: configure
+	$(WAF) reconfigure
+
+show_waf_options:
+	$(WAF) --help
+
+# some compatibility make targets
+everything: all
+
+testsuite: all
+
+check: test
+
+torture: all
+
+# this should do an install as well, once install is finished
+installcheck: test
+
+etags:
+	$(WAF) etags
+
+ctags:
+	$(WAF) ctags
diff --git a/lib/tevent/autogen.sh b/lib/tevent/autogen-autotools.sh
similarity index 100%
copy from lib/tevent/autogen.sh
copy to lib/tevent/autogen-autotools.sh
diff --git a/lib/tevent/autogen.sh b/lib/tevent/autogen.sh
deleted file mode 100755
index 7a1e7ab..0000000
--- a/lib/tevent/autogen.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-rm -rf autom4te.cache
-rm -f configure config.h.in
-
-IPATHS="-I libreplace -I lib/replace -I ../libreplace -I ../replace -I ../../../lib/replace"
-autoconf $IPATHS || exit 1
-autoheader $IPATHS || exit 1
-
-rm -rf autom4te.cache
-
-echo "Now run ./configure and then make."
-exit 0
-
diff --git a/lib/tevent/autogen.sh b/lib/tevent/autogen.sh
new file mode 120000
index 0000000..99150f3
--- /dev/null
+++ b/lib/tevent/autogen.sh
@@ -0,0 +1 @@
+../../buildtools/scripts/autogen-waf.sh
\ No newline at end of file
diff --git a/lib/tevent/bindings.py b/lib/tevent/bindings.py
new file mode 100644
index 0000000..1060caf
--- /dev/null
+++ b/lib/tevent/bindings.py
@@ -0,0 +1,62 @@
+#!/usr/bin/python
+#
+#   Python integration for tevent - tests
+#
+#   Copyright (C) Jelmer Vernooij 2010
+#
+#     ** NOTE! The following LGPL license applies to the tevent
+#     ** 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/>.
+
+import signal
+import _tevent
+from unittest import TestCase
+
+class BackendListTests(TestCase):
+
+    def test_backend_list(self):
+        self.assertTrue(isinstance(_tevent.backend_list(), list))
+
+
+class CreateContextTests(TestCase):
+
+    def test_by_name(self):
+        ctx = _tevent.Context(_tevent.backend_list()[0])
+        self.assertTrue(ctx is not None)
+
+    def test_no_name(self):
+        ctx = _tevent.Context()
+        self.assertTrue(ctx is not None)
+
+
+class ContextTests(TestCase):
+
+    def setUp(self):
+        super(ContextTests, self).setUp()
+        self.ctx = _tevent.Context()
+
+    def test_signal_support(self):
+        self.assertTrue(type(self.ctx.signal_support) is bool)
+
+    def test_reinitialise(self):
+        self.ctx.reinitialise()
+
+    def test_loop_wait(self):
+        self.ctx.loop_wait()
+
+    def test_add_signal(self):
+        sig = self.ctx.add_signal(signal.SIGINT, 0, lambda callback: None)
+        self.assertTrue(isinstance(sig, _tevent.Signal))
diff --git a/lib/tevent/configure b/lib/tevent/configure
new file mode 100755
index 0000000..2d4aec7
--- /dev/null
+++ b/lib/tevent/configure
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+PREVPATH=`dirname $0`
+
+WAF=../../buildtools/bin/waf
+
+# using JOBS=1 gives maximum compatibility with
+# systems like AIX which have broken threading in python
+JOBS=1
+export JOBS
+
+cd . || exit 1
+$WAF configure "$@" || exit 1
+cd $PREVPATH
diff --git a/lib/tevent/pytevent.c b/lib/tevent/pytevent.c
new file mode 100644
index 0000000..5999802
--- /dev/null
+++ b/lib/tevent/pytevent.c
@@ -0,0 +1,762 @@
+/*
+   Unix SMB/CIFS implementation.
+   Python bindings for tevent
+
+   Copyright (C) Jelmer Vernooij 2010
+
+     ** NOTE! The following LGPL license applies to the tevent
+     ** 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/>.
+*/
+
+#include <Python.h>
+#include <tevent.h>
+
+typedef struct {
+	PyObject_HEAD
+	struct tevent_context *ev;
+} TeventContext_Object;
+
+typedef struct {
+	PyObject_HEAD
+	struct tevent_queue *queue;
+} TeventQueue_Object;
+
+typedef struct {
+	PyObject_HEAD
+	struct tevent_req *req;
+} TeventReq_Object;
+
+typedef struct {
+	PyObject_HEAD
+	struct tevent_signal *signal;
+} TeventSignal_Object;
+
+typedef struct {
+	PyObject_HEAD
+	struct tevent_timer *timer;
+} TeventTimer_Object;
+
+typedef struct {
+	PyObject_HEAD
+	struct tevent_fd *fd;
+} TeventFd_Object;
+
+staticforward PyTypeObject TeventContext_Type;
+staticforward PyTypeObject TeventReq_Type;
+staticforward PyTypeObject TeventQueue_Type;
+staticforward PyTypeObject TeventSignal_Type;
+staticforward PyTypeObject TeventTimer_Type;
+staticforward PyTypeObject TeventFd_Type;
+
+static int py_context_init(struct tevent_context *ev)
+{
+	/* FIXME */
+	return 0;
+}
+
+static struct tevent_fd *py_add_fd(struct tevent_context *ev,
+				    TALLOC_CTX *mem_ctx,
+				    int fd, uint16_t flags,
+				    tevent_fd_handler_t handler,
+				    void *private_data,
+				    const char *handler_name,
+				    const char *location)
+{
+	/* FIXME */
+	return NULL;
+}
+
+static void py_set_fd_close_fn(struct tevent_fd *fde,
+				tevent_fd_close_fn_t close_fn)
+{
+	/* FIXME */
+}
+
+uint16_t py_get_fd_flags(struct tevent_fd *fde)
+{
+	/* FIXME */
+	return 0;
+}
+
+static void py_set_fd_flags(struct tevent_fd *fde, uint16_t flags)
+{
+	/* FIXME */
+}
+
+/* timed_event functions */
+static struct tevent_timer *py_add_timer(struct tevent_context *ev,
+					  TALLOC_CTX *mem_ctx,
+					  struct timeval next_event,
+					  tevent_timer_handler_t handler,
+					  void *private_data,
+					  const char *handler_name,
+					  const char *location)
+{
+	/* FIXME */
+	return NULL;
+}
+
+/* immediate event functions */
+static void py_schedule_immediate(struct tevent_immediate *im,
+				   struct tevent_context *ev,
+				   tevent_immediate_handler_t handler,
+				   void *private_data,
+				   const char *handler_name,
+				   const char *location)
+{
+	/* FIXME */
+}
+
+/* signal functions */
+static struct tevent_signal *py_add_signal(struct tevent_context *ev,
+					    TALLOC_CTX *mem_ctx,
+					    int signum, int sa_flags,
+					    tevent_signal_handler_t handler,
+					    void *private_data,
+					    const char *handler_name,
+					    const char *location)
+{
+	/* FIXME */
+	return NULL;
+}
+
+/* loop functions */
+static int py_loop_once(struct tevent_context *ev, const char *location)
+{
+	/* FIXME */
+	return 0;
+}
+
+static int py_loop_wait(struct tevent_context *ev, const char *location)
+{
+	/* FIXME */
+	return 0;
+}
+
+const static struct tevent_ops py_tevent_ops = {
+	.context_init = py_context_init,
+	.add_fd = py_add_fd,
+	.set_fd_close_fn = py_set_fd_close_fn,
+	.get_fd_flags = py_get_fd_flags,
+	.set_fd_flags = py_set_fd_flags,
+	.add_timer = py_add_timer,
+	.schedule_immediate = py_schedule_immediate,
+	.add_signal = py_add_signal,
+	.loop_wait = py_loop_wait,
+	.loop_once = py_loop_once,
+};
+
+static PyObject *py_register_backend(PyObject *self, PyObject *args)
+{
+	PyObject *name, *py_backend;
+
+	if (!PyArg_ParseTuple(args, "O", &py_backend))
+		return NULL;
+
+	name = PyObject_GetAttrString(py_backend, "name");
+	if (name == NULL) {
+		PyErr_SetNone(PyExc_AttributeError);
+		return NULL;
+	}
+
+	if (!PyString_Check(name)) {
+		PyErr_SetNone(PyExc_TypeError);
+		return NULL;
+	}
+
+	if (!tevent_register_backend(PyString_AsString(name), &py_tevent_ops)) { /* FIXME: What to do with backend */
+		PyErr_SetNone(PyExc_RuntimeError);
+		return NULL;
+	}
+
+	Py_RETURN_NONE;
+}
+
+static PyObject *py_tevent_context_reinitialise(TeventContext_Object *self)
+{
+	int ret = tevent_re_initialise(self->ev);
+	if (ret != 0) {
+		PyErr_SetNone(PyExc_RuntimeError);
+		return NULL;
+	}
+	Py_RETURN_NONE;
+}
+
+static PyObject *py_tevent_queue_stop(TeventQueue_Object *self)
+{
+	tevent_queue_stop(self->queue);
+	Py_RETURN_NONE;
+}
+
+static PyObject *py_tevent_queue_start(TeventQueue_Object *self)
+{
+	tevent_queue_start(self->queue);
+	Py_RETURN_NONE;
+}
+
+static void py_queue_trigger(struct tevent_req *req, void *private_data)
+{
+	PyObject *callback = private_data, *ret;
+
+	ret = PyObject_CallFunction(callback, "");
+	Py_XDECREF(ret);
+}
+
+static PyObject *py_tevent_queue_add(TeventQueue_Object *self, PyObject *args)
+{
+	TeventContext_Object *py_ev;
+	TeventReq_Object *py_req;
+	PyObject *trigger;
+	bool ret;
+
+	if (!PyArg_ParseTuple(args, "O!O!O", 
+						  &TeventContext_Type, &py_ev,
+						  &TeventReq_Type, &py_req,
+						  &trigger))
+		return NULL;
+
+	Py_INCREF(trigger);
+
+	ret = tevent_queue_add(self->queue, py_ev->ev, py_req->req,
+						   py_queue_trigger, trigger);
+	if (!ret) {
+		PyErr_SetString(PyExc_RuntimeError, "queue add failed");
+		Py_DECREF(trigger);
+		return NULL;
+	}
+
+	Py_RETURN_NONE;
+}
+
+static PyMethodDef py_tevent_queue_methods[] = {
+	{ "stop", (PyCFunction)py_tevent_queue_stop, METH_NOARGS,
+		"S.stop()" },
+	{ "start", (PyCFunction)py_tevent_queue_start, METH_NOARGS,
+		"S.start()" },
+	{ "add", (PyCFunction)py_tevent_queue_add, METH_VARARGS,
+		"S.add(ctx, req, trigger, baton)" },
+	{ NULL },
+};
+
+static PyObject *py_tevent_context_wakeup_send(PyObject *self, PyObject *args)
+{
+	/* FIXME */
+
+	Py_RETURN_NONE;
+}
+
+static PyObject *py_tevent_context_loop_wait(TeventContext_Object *self)
+{
+	if (tevent_loop_wait(self->ev) != 0) {
+		PyErr_SetNone(PyExc_RuntimeError);
+		return NULL;
+	}
+	Py_RETURN_NONE;
+}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list