BIND 10 trac2438, updated. 003f49d97927cc4dd85c4a631611152e7e10bd1c [2438] other distcheck fixes: need to add dns/python/.libs to some PYTHONPATHs

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Jan 17 20:08:31 UTC 2013


The branch, trac2438 has been updated
       via  003f49d97927cc4dd85c4a631611152e7e10bd1c (commit)
       via  fd29a774079b86f2b62c857d13ef450f0da29a00 (commit)
       via  e149d57f779c6597a6ed1d497c40a9641ac6651c (commit)
       via  ce19e77d9f6b9715502b5636511421dc09148f86 (commit)
       via  88ff44432d5fed287aa8a91d620692f4a715ae1c (commit)
      from  738540ce3a7b5d06707d5b298a6223629ab66050 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 003f49d97927cc4dd85c4a631611152e7e10bd1c
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Thu Jan 17 12:06:44 2013 -0800

    [2438] other distcheck fixes: need to add dns/python/.libs to some PYTHONPATHs
    
    as commented, #2145 should eliminate the need for it, but until it's fixed
    this seems to be the easiest and smallest workaround.

commit fd29a774079b86f2b62c857d13ef450f0da29a00
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Thu Jan 17 10:04:12 2013 -0800

    [2438] wording fixes

commit e149d57f779c6597a6ed1d497c40a9641ac6651c
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Thu Jan 17 09:58:49 2013 -0800

    [2438] updated doc about direct construction of RRsetCollectionBase.
    
    that constructor is provided, but results in an exception.

commit ce19e77d9f6b9715502b5636511421dc09148f86
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Thu Jan 17 09:54:21 2013 -0800

    [2438] clarify the relationship of Python/C++ classes of RRsetCollection.

commit 88ff44432d5fed287aa8a91d620692f4a715ae1c
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Thu Jan 17 09:09:30 2013 -0800

    [2438] make sure the branch is fully synchronized with trac2435
    
    there are some changes and files that don't exist the latest trac2435 branch.
    they are probably because of the intermediate merge of a separate working
    branch, which was based on an earlier version of trac2435.

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

Summary of changes:
 configure.ac                                      |    5 +-
 src/bin/dbutil/run_dbutil.sh.in                   |    5 +-
 src/lib/datasrc/database.cc                       |    1 -
 src/lib/datasrc/rrset_collection.cc               |   66 -----------------
 src/lib/datasrc/rrset_collection.h                |   78 ---------------------
 src/lib/datasrc/zone.h                            |    1 -
 src/lib/dns/python/rrset_collection_python.cc     |   22 +++++-
 src/lib/dns/python/rrset_collection_python.h      |    7 +-
 src/lib/dns/python/rrset_collection_python_inc.cc |   12 ++--
 9 files changed, 38 insertions(+), 159 deletions(-)
 delete mode 100644 src/lib/datasrc/rrset_collection.cc
 delete mode 100644 src/lib/datasrc/rrset_collection.h

-----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 892bc6c..e0eee91 100644
--- a/configure.ac
+++ b/configure.ac
@@ -282,7 +282,10 @@ AC_SUBST(PYTHON_LOGMSGPKG_DIR)
 
 # This is python package paths commonly used in python tests.  See
 # README of log_messages for why it's included.
-COMMON_PYTHON_PATH="\$(abs_top_builddir)/src/lib/python/isc/log_messages:\$(abs_top_srcdir)/src/lib/python:\$(abs_top_builddir)/src/lib/python"
+# lib/dns/python/.libs is necessary because __init__.py of isc package
+# automatically imports isc.datasrc, which then requires the DNS loadable
+# module.  #2145 should eliminate the need for it.
+COMMON_PYTHON_PATH="\$(abs_top_builddir)/src/lib/python/isc/log_messages:\$(abs_top_srcdir)/src/lib/python:\$(abs_top_builddir)/src/lib/python:\$(abs_top_builddir)/src/lib/dns/python/.libs"
 AC_SUBST(COMMON_PYTHON_PATH)
 
 # Check for python development environments
diff --git a/src/bin/dbutil/run_dbutil.sh.in b/src/bin/dbutil/run_dbutil.sh.in
index fea7482..f0c6dbd 100755
--- a/src/bin/dbutil/run_dbutil.sh.in
+++ b/src/bin/dbutil/run_dbutil.sh.in
@@ -20,7 +20,10 @@ export PYTHON_EXEC
 
 DBUTIL_PATH=@abs_top_builddir@/src/bin/dbutil
 
-PYTHONPATH=@abs_top_srcdir@/src/bin:@abs_top_builddir@/src/lib/python/isc/log_messages:@abs_top_builddir@/src/lib/python:@abs_top_builddir@/src/bin:@abs_top_srcdir@/src/lib/python
+# Note: lib/dns/python/.libs is necessary because __init__.py of isc package
+# automatically imports isc.datasrc, which then requires the DNS loadable
+# module.  #2145 should eliminate the need for it.
+PYTHONPATH=@abs_top_srcdir@/src/bin:@abs_top_builddir@/src/lib/python/isc/log_messages:@abs_top_builddir@/src/lib/python:@abs_top_builddir@/src/bin:@abs_top_srcdir@/src/lib/python:@abs_top_builddir@/src/lib/dns/python/.libs
 export PYTHONPATH
 
 # If necessary (rare cases), explicitly specify paths to dynamic libraries
diff --git a/src/lib/datasrc/database.cc b/src/lib/datasrc/database.cc
index fdb86dd..51793bd 100644
--- a/src/lib/datasrc/database.cc
+++ b/src/lib/datasrc/database.cc
@@ -32,7 +32,6 @@
 
 #include <datasrc/data_source.h>
 #include <datasrc/logger.h>
-#include <datasrc/rrset_collection.h>
 
 #include <boost/foreach.hpp>
 #include <boost/scoped_ptr.hpp>
diff --git a/src/lib/datasrc/rrset_collection.cc b/src/lib/datasrc/rrset_collection.cc
deleted file mode 100644
index 0651dec..0000000
--- a/src/lib/datasrc/rrset_collection.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (C) 2013  Internet Systems Consortium, Inc. ("ISC")
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THIS SOFTWARE.
-
-#include <datasrc/rrset_collection.h>
-#include <datasrc/zone_loader.h>
-#include <exceptions/exceptions.h>
-
-using namespace isc;
-using namespace isc::dns;
-
-namespace isc {
-namespace datasrc {
-
-ConstRRsetPtr
-RRsetCollection::find(const isc::dns::Name& name,
-                      const isc::dns::RRClass& rrclass,
-                      const isc::dns::RRType& rrtype) const
-{
-    if (rrclass != rrclass_) {
-        // We could throw an exception here, but RRsetCollection is
-        // expected to support an arbitrary collection of RRsets, and it
-        // can be queried just as arbitrarily. So we just return nothing
-        // here.
-        return (ConstRRsetPtr());
-    }
-
-    ZoneFinder& finder = updater_.getFinder();
-    try {
-        ZoneFinderContextPtr result =
-            finder.find(name, rrtype,
-                        ZoneFinder::NO_WILDCARD | ZoneFinder::FIND_GLUE_OK);
-        return (result->rrset);
-    } catch (const OutOfZone&) {
-        // As RRsetCollection is an arbitrary set of RRsets, in case the
-        // searched name is out of zone, we return nothing instead of
-        // propagating the exception.
-        return (ConstRRsetPtr());
-    } catch (const DataSourceError& e) {
-        isc_throw(FindError, "ZoneFinder threw a DataSourceError: " <<
-                  e.getMessage().c_str());
-    }
-}
-
-RRsetCollectionBase::IterPtr
-RRsetCollection::getBeginning() {
-    isc_throw(NotImplemented, "This method is not implemented.");
-}
-
-RRsetCollectionBase::IterPtr
-RRsetCollection::getEnd() {
-    isc_throw(NotImplemented, "This method is not implemented.");
-}
-
-} // end of namespace datasrc
-} // end of namespace isc
diff --git a/src/lib/datasrc/rrset_collection.h b/src/lib/datasrc/rrset_collection.h
deleted file mode 100644
index 0907323..0000000
--- a/src/lib/datasrc/rrset_collection.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (C) 2013  Internet Systems Consortium, Inc. ("ISC")
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THIS SOFTWARE.
-
-#ifndef RRSET_COLLECTION_DATASRC_H
-#define RRSET_COLLECTION_DATASRC_H 1
-
-#include <dns/rrset_collection_base.h>
-#include <dns/rrclass.h>
-#include <datasrc/zone.h>
-
-namespace isc {
-namespace datasrc {
-
-/// \brief datasrc implementation of RRsetCollectionBase.
-class RRsetCollection : public isc::dns::RRsetCollectionBase {
-public:
-    /// \brief Constructor.
-    ///
-    /// No reference (count via \c shared_ptr) to the ZoneUpdater is
-    /// acquired. As long as the collection object is alive, the
-    /// corresponding \c ZoneUpdater should be kept alive.
-    ///
-    /// \param updater The ZoneUpdater to wrap around.
-    /// \param rrclass The RRClass of the records in the zone.
-    RRsetCollection(ZoneUpdater& updater, const isc::dns::RRClass& rrclass) :
-        updater_(updater),
-        rrclass_(rrclass)
-    {}
-
-    /// \brief Destructor
-    virtual ~RRsetCollection() {}
-
-    /// \brief Find a matching RRset in the collection.
-    ///
-    /// Returns the RRset in the collection that exactly matches the
-    /// given \c name, \c rrclass and \c rrtype.  If no matching RRset
-    /// is found, \c NULL is returned.
-    ///
-    /// \throw FindError if find() results in some underlying datasrc error.
-    /// \param name The name of the RRset to search for.
-    /// \param rrclass The class of the RRset to search for.
-    /// \param rrtype The type of the RRset to search for.
-    /// \returns The RRset if found, \c NULL otherwise.
-    virtual isc::dns::ConstRRsetPtr find(const isc::dns::Name& name,
-                                         const isc::dns::RRClass& rrclass,
-                                         const isc::dns::RRType& rrtype) const;
-
-private:
-    ZoneUpdater& updater_;
-    isc::dns::RRClass rrclass_;
-
-protected:
-    // TODO: RRsetCollectionBase::Iter is not implemented and the
-    // following two methods just throw.
-
-    virtual RRsetCollectionBase::IterPtr getBeginning();
-    virtual RRsetCollectionBase::IterPtr getEnd();
-};
-
-} // end of namespace datasrc
-} // end of namespace isc
-
-#endif  // RRSET_COLLECTION_DATASRC_H
-
-// Local Variables:
-// mode: c++
-// End:
diff --git a/src/lib/datasrc/zone.h b/src/lib/datasrc/zone.h
index 0189e37..01d6a83 100644
--- a/src/lib/datasrc/zone.h
+++ b/src/lib/datasrc/zone.h
@@ -18,7 +18,6 @@
 #include <dns/name.h>
 #include <dns/rrset.h>
 #include <dns/rrtype.h>
-#include <dns/rrset_collection_base.h>
 
 #include <datasrc/exceptions.h>
 #include <datasrc/result.h>
diff --git a/src/lib/dns/python/rrset_collection_python.cc b/src/lib/dns/python/rrset_collection_python.cc
index 157ca19..cfdcdae 100644
--- a/src/lib/dns/python/rrset_collection_python.cc
+++ b/src/lib/dns/python/rrset_collection_python.cc
@@ -55,10 +55,23 @@ setTypeError(PyObject* pobj, const char* var_name, const char* type_name) {
 }
 }
 
+// RRsetCollectionBase: the base RRsetCollection class in Python.
 //
-// RRsetCollectionBase
-//
-
+// Any derived RRsetCollection class is supposed to be inherited from this
+// class:
+// - If the derived class is implemented via a C++ wrapper (associated with
+//   a C++ implementation of RRsetCollection), its PyTypeObject should
+//   specify rrset_collection_base_type for tp_base.  Its C/C++-representation
+//   of objects should be compatible with s_RRsetCollection, and the wrapper
+//   should set its cppobj member to point to the corresponding C++
+//   RRsetCollection object.  Normally it doesn't have to provide Python
+//   wrapper of find(); the Python interpreter will then call find() on
+//   the base class, which ensures that the corresponding C++ version of
+//   find() will be used.
+// - If the derived class is implemented purely in Python, it must implement
+//   find() in Python within the class.  As explained in the first bullet,
+//   the base class method is generally expected to be used only for C++
+//   wrapper of RRsetCollection derived class.
 namespace {
 int
 RRsetCollectionBase_init(PyObject*, PyObject*, PyObject*) {
@@ -84,6 +97,9 @@ PyObject*
 RRsetCollectionBase_find(PyObject* po_self, PyObject* args) {
     s_RRsetCollection* self = static_cast<s_RRsetCollection*>(po_self);
 
+    // If this function is called with cppobj being NULL, this means
+    // a pure-Python derived class skips implementing its own find().
+    // This is an error (see general description above).
     if (self->cppobj == NULL) {
         PyErr_Format(PyExc_TypeError, "find() is not implemented in the "
                      "derived RRsetCollection class");
diff --git a/src/lib/dns/python/rrset_collection_python.h b/src/lib/dns/python/rrset_collection_python.h
index 9b464f9..ea442bb 100644
--- a/src/lib/dns/python/rrset_collection_python.h
+++ b/src/lib/dns/python/rrset_collection_python.h
@@ -23,10 +23,13 @@ class RRsetCollectionBase;
 
 namespace python {
 
-// The s_* Class simply covers one instantiation of the object
+// The s_* Class simply covers one instantiation of the object.
 // This structure will be commonly used for all derived classes of
 // RRsetCollectionBase.  cppobj will point to an instance of the specific
-// derived class.
+// derived class of (C++) RRsetCollectionBase.
+//
+// A C++ wrapper for Python version of RRsetCollection should set this
+// variable, and skip the implementation of C++ wrapper of find() method.
 class s_RRsetCollection : public PyObject {
 public:
     s_RRsetCollection() : cppobj(NULL) {}
diff --git a/src/lib/dns/python/rrset_collection_python_inc.cc b/src/lib/dns/python/rrset_collection_python_inc.cc
index 5c1e532..f6eb8a3 100644
--- a/src/lib/dns/python/rrset_collection_python_inc.cc
+++ b/src/lib/dns/python/rrset_collection_python_inc.cc
@@ -1,7 +1,7 @@
 namespace {
 // Modifications
 //   - libdns++ => isc.dns, libdatasrc => isc.datasrc
-//   - note about the constructor.
+//   - note about the direct construction.
 //   - add note about iteration
 const char* const RRsetCollectionBase_doc = "\
 Generic class to represent a set of RRsets.\n\
@@ -18,8 +18,8 @@ maybe class) and a way to iterate over all RRsets.\n\
 See RRsetCollection for a simple isc.dns implementation. Other modules\n\
 such as isc.datasrc will have another implementation.\n\
 \n\
-This base class cannot be directly instantiated, so no constructor is\n\
-defined.\n\
+This base class cannot be directly instantiated.  Such an attempt will\n\
+result in a TypeError exception.\n\
 \n\
 ";
 
@@ -79,18 +79,18 @@ RRsetCollection(filename, origin, rrclass)\n\
       origin     (isc.dns.Name) The zone origin.\n\
       rrclass    (isc.dns.RRClass) The zone class.\n\
 \n\
-RRsetCollection(input_stream, origin, rrclass)\n\
+RRsetCollection(input, origin, rrclass)\n\
 \n\
     Constructor.\n\
 \n\
     This constructor is similar to the previous one, but instead of\n\
-    taking a filename to load a zone from, it takes a byte object,\n\
+    taking a filename to load a zone from, it takes a bytes object,\n\
     representing the zone contents in text.\n\
     The constructor throws IscException if there is an error\n\
     during loading.\n\
 \n\
     Parameters:\n\
-      input      (byte) Textual representation of the zone.\n\
+      input      (bytes) Textual representation of the zone.\n\
       origin     (isc.dns.Name) The zone origin.\n\
       rrclass    (isc.dns.RRClass) The zone class.\n\
 \n\



More information about the bind10-changes mailing list