=== modified file 'debian/changelog'
--- debian/changelog	2011-04-21 13:34:01 +0000
+++ debian/changelog	2011-04-27 10:57:27 +0000
@@ -1,3 +1,9 @@
+python-apt (0.8.0~exp4) UNRELEASED; urgency=low
+
+  * apt_pkg: Add OrderList, wanted for mancoosi (Closes: #623485)
+
+ -- Julian Andres Klode <jak@debian.org>  Wed, 27 Apr 2011 12:55:59 +0200
+
 python-apt (0.8.0~exp3) experimental; urgency=low
 
   [ Stéphane Graber ]

=== modified file 'doc/source/c++/api.rst'
--- doc/source/c++/api.rst	2011-04-05 14:11:34 +0000
+++ doc/source/c++/api.rst	2011-04-27 10:40:10 +0000
@@ -622,6 +622,34 @@ IndexFile (pkgIndexFile)
     Return the :ctype:`pkgIndexFile` pointer contained in the Python object
     *object*.
 
+OrderList (pkgOrderList)
+---------------------------
+.. cvar:: PyTypeObject PyOrderList_Type
+
+    The type object for :class:`apt_pkg.OrderList` objects.
+
+.. cfunction:: int PyOrderList_Check(PyObject *object)
+
+    Check that the object *object* is an :class:`apt_pkg.OrderList` object, or
+    a subclass thereof.
+
+.. cfunction:: int PyOrderList_CheckExact(PyObject *object)
+
+    Check that the object *object* is an :class:`apt_pkg.OrderList` object
+    and no subclass thereof.
+
+.. cfunction:: PyObject* PyOrderList_FromCpp(pkgOrderList *cpp, bool delete, PyObject *owner)
+
+    Create a new :class:`apt_pkg.OrderList` object from the :ctype:`pkgOrderList`
+    pointer given by the parameter *cpp*. If the parameter *delete* is
+    true, the object pointed to by *cpp* will be deleted when the reference
+    count of the returned object reaches 0. The owner must be a
+    :class:`apt_pkg.DepCache` object.
+
+.. cfunction:: pkgOrderList* PyOrderList_ToCpp(PyObject *object)
+
+    Return the :ctype:`pkgOrderList` pointer contained in the Python object
+    *object*.
 
 PackageManager (pkgPackageManager)
 ----------------------------------

=== modified file 'doc/source/library/apt_pkg.rst'
--- doc/source/library/apt_pkg.rst	2011-04-21 12:21:22 +0000
+++ doc/source/library/apt_pkg.rst	2011-04-27 11:04:30 +0000
@@ -422,6 +422,99 @@ Installing with :class:`PackageManager`
 
         A constant for checking whether the the result of the call to
         :meth:`do_install` is 'incomplete'.
+        
+Installation ordering with :class:`OrderList`
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. class:: OrderList(depcache: DepCache)
+
+	Represent a :ctype:`pkgOrderList`, used for installation
+	ordering. This class provides several methods and attributes,
+	is complicated and should not be used by normal programs.
+	
+	.. versionadded:: 0.8.0
+	
+	This class is a sequence and supports the following operations:
+	
+	.. describe:: list[index]
+	
+		Get the package at the given index in the list. Negative
+		index is supported.
+		
+	.. describe:: len(list)
+	
+		The length of the list.
+		
+	It also supports the append() method from :class:`list`:
+	
+	.. method:: append(pkg: Package)
+	
+		Append a new package to the end of the list. Please note that
+		you may not append a package twice, as only as much packages
+		as in the cache can be added.
+		
+	The class also defines several specific attributes and methods,
+	to be described hereinafter.
+		
+	.. method:: score(pkg: Package)
+	
+		Return the score of the package. Packages are basically
+		ordered by descending score.
+		
+	This class allows flags to be set on packages. Those flags are:
+	
+	.. attribute:: FLAG_ADDED
+	.. attribute:: FLAG_ADD_PENDING
+	.. attribute:: FLAG_IMMEDIATE
+	.. attribute:: FLAG_LOOP
+	.. attribute:: FLAG_UNPACKED
+	.. attribute:: FLAG_CONFIGURED
+	.. attribute:: FLAG_REMOVED
+	.. attribute:: FLAG_STATES_MASK
+	
+		Same as ``FLAG_UNPACKED | FLAG_CONFIGURED | FLAG_REMOVED``
+		
+	.. attribute:: FLAG_IN_LIST
+	.. attribute:: FLAG_AFTER
+	
+	The methods to work with those flags are:
+		
+	.. method:: flag(pkg: Package, flag: int[, unset_flags: int])
+
+		Flag a package. Sets the flags given in *flag* and unsets
+		any flags given in *unset_flags*.
+		
+	.. method:: is_flag(pkg: Package, flag: int)
+	
+		Check whether the flags in *flag* are set for the package.
+		
+	.. method:: wipe_flags(flags: int)
+	
+		Remove the flags in *flags* from all packages.
+	
+	.. method:: is_missing(pkg: Package)
+
+		Check if the package is missing (not really usable right now)
+
+	.. method:: is_now(pkg: Package)
+
+		Check if the package is flagged for any state but removal.
+		
+	The following methods for ordering are provided:
+	
+	.. method:: order_critical()
+	
+		Order the packages for critical unpacking; that is, only
+		respect pre-dependencies.
+	
+	.. method:: order_unpack()
+	
+		Order the packages for unpacking, repecting Pre-Depends and
+		Conflicts.
+	
+	.. method:: order_configure()
+	
+		Order the packages for configuration, respecting Depends.
 
 Improve performance with :class:`ActionGroup`
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

=== modified file 'doc/source/whatsnew/0.8.0.rst'
--- doc/source/whatsnew/0.8.0.rst	2011-04-05 14:18:26 +0000
+++ doc/source/whatsnew/0.8.0.rst	2011-04-27 11:02:33 +0000
@@ -23,6 +23,8 @@ This release of python-apt also features
 
     * apt_pkg.Cache() now takes None for the progress parameter, preventing
       progress reporting.
+    * A new class :class:`apt_pkg.OrderList` has been added on request
+      of the mancoosi project.
 
 There have been various other changes, see the changelog for a complete list
 of changes.

=== modified file 'python/apt_pkgmodule.cc'
--- python/apt_pkgmodule.cc	2011-04-21 12:21:22 +0000
+++ python/apt_pkgmodule.cc	2011-04-27 10:37:17 +0000
@@ -24,6 +24,7 @@
 #include <apt-pkg/sha256.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/orderlist.h>
 
 #include <sys/stat.h>
 #include <libintl.h>
@@ -734,7 +735,10 @@ static struct _PyAptPkgAPIStruct API = {
    &PyVersion_ToCpp,          // version_tocpp
    &PyGroup_Type,             // group_type
    &PyGroup_FromCpp,          // group_fromcpp
-   &PyGroup_ToCpp             // group_tocpp
+   &PyGroup_ToCpp,            // group_tocpp
+   &PyOrderList_Type,         // orderlist_type
+   &PyOrderList_FromCpp,      // orderlist_fromcpp
+   &PyOrderList_ToCpp         // orderlist_tocpp
 };
 
 
@@ -843,6 +847,7 @@ extern "C" void initapt_pkg()
    ADDTYPE(Module,"AcquireItemDesc",&PyAcquireItemDesc_Type);
    ADDTYPE(Module,"SystemLock",&PySystemLock_Type);
    ADDTYPE(Module,"FileLock",&PyFileLock_Type);
+   ADDTYPE(Module,"OrderList",&PyOrderList_Type);
    // Tag file constants
    PyModule_AddObject(Module,"REWRITE_PACKAGE_ORDER",
                       CharCharToList(TFRewritePackageOrder));
@@ -850,6 +855,16 @@ extern "C" void initapt_pkg()
    PyModule_AddObject(Module,"REWRITE_SOURCE_ORDER",
                       CharCharToList(TFRewriteSourceOrder));
 
+   PyDict_SetItemString(PyOrderList_Type.tp_dict, "FLAG_ADDED", MkPyNumber(pkgOrderList::Added));
+   PyDict_SetItemString(PyOrderList_Type.tp_dict, "FLAG_ADD_PENDIG", MkPyNumber(pkgOrderList::AddPending));
+   PyDict_SetItemString(PyOrderList_Type.tp_dict, "FLAG_IMMEDIATE", MkPyNumber(pkgOrderList::Immediate));
+   PyDict_SetItemString(PyOrderList_Type.tp_dict, "FLAG_LOOP", MkPyNumber(pkgOrderList::Loop));
+   PyDict_SetItemString(PyOrderList_Type.tp_dict, "FLAG_UNPACKED", MkPyNumber(pkgOrderList::UnPacked));
+   PyDict_SetItemString(PyOrderList_Type.tp_dict, "FLAG_CONFIGURED", MkPyNumber(pkgOrderList::Configured));
+   PyDict_SetItemString(PyOrderList_Type.tp_dict, "FLAG_REMOVED", MkPyNumber(pkgOrderList::Removed));
+   PyDict_SetItemString(PyOrderList_Type.tp_dict, "FLAG_IN_LIST", MkPyNumber(pkgOrderList::InList));
+   PyDict_SetItemString(PyOrderList_Type.tp_dict, "FLAG_AFTER", MkPyNumber(pkgOrderList::After));
+   PyDict_SetItemString(PyOrderList_Type.tp_dict, "FLAG_STATES_MASK", MkPyNumber(pkgOrderList::States));
 
    // Acquire constants.
    // some constants
@@ -983,6 +998,7 @@ extern "C" void initapt_pkg()
    PyModule_AddIntConstant(Module,"INSTSTATE_HOLD",pkgCache::State::Hold);
    PyModule_AddIntConstant(Module,"INSTSTATE_HOLD_REINSTREQ",pkgCache::State::HoldReInstReq);
 
+
    // DEPRECATED API
    #ifdef COMPAT_0_7
    PyModule_AddObject(Module,"RewritePackageOrder",

=== modified file 'python/apt_pkgmodule.h'
--- python/apt_pkgmodule.h	2011-04-05 13:56:14 +0000
+++ python/apt_pkgmodule.h	2011-04-27 10:32:03 +0000
@@ -134,6 +134,7 @@ extern PyTypeObject PyAcquireItemDesc_Ty
 extern PyTypeObject PyAcquireWorker_Type;
 extern PyTypeObject PySystemLock_Type;
 extern PyTypeObject PyFileLock_Type;
+extern PyTypeObject PyOrderList_Type;
 
 // Functions to be exported in the public API.
 
@@ -159,6 +160,7 @@ extern PyTypeObject PyFileLock_Type;
 # define PyPackage_ToCpp           GetCpp<pkgCache::PkgIterator>
 # define PyPackageFile_ToCpp       GetCpp<pkgCache::PkgFileIterator>
 # define PyIndexFile_ToCpp         GetCpp<pkgIndexFile*>
+# define PyOrderList_ToCpp         GetCpp<pkgOrderList*>
 # define PyPackageList_ToCpp       GetCpp<PkgListStruct> // TODO
 # define PyPackageManager_ToCpp    GetCpp<pkgPackageManager*>
 # define PyPackageRecords_ToCpp    GetCpp<PkgRecordsStruct> // TODO
@@ -191,6 +193,7 @@ PyObject* PyMetaIndex_FromCpp(metaIndex*
 PyObject* PyPackage_FromCpp(pkgCache::PkgIterator const &obj, bool Delete, PyObject *Owner);
 PyObject* PyGroup_FromCpp(pkgCache::GrpIterator const &obj, bool Delete, PyObject *Owner);
 PyObject* PyIndexFile_FromCpp(pkgIndexFile* const &obj, bool Delete, PyObject *Owner);
+PyObject* PyOrderList_FromCpp(pkgOrderList* const &obj, bool Delete, PyObject *Owner);
 PyObject* PyPackageFile_FromCpp(pkgCache::PkgFileIterator const &obj, bool Delete, PyObject *Owner);
 //PyObject* PyPackageList_FromCpp(PkgListStruct const &obj, bool Delete, PyObject *Owner);
 PyObject* PyPackageManager_FromCpp(pkgPackageManager* const &obj, bool Delete, PyObject *Owner);

=== added file 'python/orderlist.cc'
--- python/orderlist.cc	1970-01-01 00:00:00 +0000
+++ python/orderlist.cc	2011-04-27 10:55:10 +0000
@@ -0,0 +1,317 @@
+/*
+ * orderlist.cc - Wrapper around pkgOrderList
+ *
+ * Copyright 2011 Julian Andres Klode <jak@debian.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#include <Python.h>
+#include "apt_pkgmodule.h"
+#include "generic.h"
+#include <apt-pkg/orderlist.h>
+
+struct PyOrderList : CppPyObject<pkgOrderList*> {
+    pkgCache::PkgIterator current;
+    int nextIndex;
+};
+
+static PyObject *order_list_new(PyTypeObject *type,PyObject *args,
+                                  PyObject *kwds)
+{
+    PyObject *pyDepCache = NULL;
+    char *kwlist[] = {"depcache", NULL};
+    if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", kwlist,
+                                    &PyDepCache_Type, &pyDepCache)
+                                    == 0)
+        return 0;
+
+    pkgDepCache *depCache = PyDepCache_ToCpp(pyDepCache);
+    return PyOrderList_FromCpp(new pkgOrderList(depCache), true, 
+                               pyDepCache);
+}
+
+static const char order_list_append_doc[] =
+    "append(pkg: Package)\n\n"
+    "Append a package to the end of the list.";
+static PyObject *order_list_append(PyObject *self,PyObject *args)
+{
+    pkgOrderList *list = GetCpp<pkgOrderList*>(self);
+    PyObject *pyPackage = NULL;
+    if (PyArg_ParseTuple(args, "O!", &PyPackage_Type, &pyPackage) == 0)
+        return 0;
+
+    list->push_back(PyPackage_ToCpp(pyPackage));
+    Py_RETURN_NONE;
+}
+
+static const char order_list_score_doc[] =
+    "score(pkg: Package) -> int\n\n"
+    "Return the score of the package.";
+static PyObject *order_list_score(PyObject *self,PyObject *args)
+{
+    pkgOrderList *list = GetCpp<pkgOrderList*>(self);
+    PyObject *pyPackage = NULL;
+    if (PyArg_ParseTuple(args, "O!", &PyPackage_Type, &pyPackage) == 0)
+        return 0;
+
+    return MkPyNumber(list->Score(PyPackage_ToCpp(pyPackage)));
+}
+
+static const char order_list_order_critical_doc[] =
+    "order_critical()\n\n"
+    "Order by PreDepends only (critical unpack order).";
+static PyObject *order_list_order_critical(PyObject *self,PyObject *args)
+{
+    pkgOrderList *list = GetCpp<pkgOrderList*>(self);
+    if (PyArg_ParseTuple(args, "") == 0)
+        return 0;
+
+    list->OrderCritical();
+    
+    Py_INCREF(Py_None);
+    return HandleErrors(Py_None);
+}
+
+static const char order_list_order_unpack_doc[] =
+    "order_unpack()\n\n"
+    "Order the packages for unpacking (see Debian Policy).";
+static PyObject *order_list_order_unpack(PyObject *self,PyObject *args)
+{
+    pkgOrderList *list = GetCpp<pkgOrderList*>(self);
+    if (PyArg_ParseTuple(args, "") == 0)
+        return 0;
+
+    list->OrderUnpack();
+    Py_INCREF(Py_None);
+    return HandleErrors(Py_None);
+}
+
+static const char order_list_order_configure_doc[] =
+    "order_configure()\n\n"
+    "Order the packages for configuration (see Debian Policy).";
+static PyObject *order_list_order_configure(PyObject *self,PyObject *args)
+{
+    pkgOrderList *list = GetCpp<pkgOrderList*>(self);
+    if (PyArg_ParseTuple(args, "") == 0)
+        return 0;
+
+    list->OrderConfigure();
+    
+    Py_INCREF(Py_None);
+    return HandleErrors(Py_None);
+}
+
+static bool valid_flags(unsigned int flags) {
+	return (flags & ~pkgOrderList::Added
+	              & ~pkgOrderList::AddPending
+	              & ~pkgOrderList::Immediate
+	              & ~pkgOrderList::Loop
+	              & ~pkgOrderList::UnPacked
+	              & ~pkgOrderList::Configured
+	              & ~pkgOrderList::Removed
+	              & ~pkgOrderList::InList
+	              & ~pkgOrderList::After
+	              & ~pkgOrderList::States) == 0;
+}
+
+static const char order_list_flag_doc[] =
+    "flag(pkg: Package, flag: int[, unset_flags: int])\n\n"
+    "Flag the package, set flags in 'flag' and remove flags in\n"
+    "'unset_flags'.";
+static PyObject *order_list_flag(PyObject *self,PyObject *args)
+{
+    pkgOrderList *list = GetCpp<pkgOrderList*>(self);
+    
+    PyObject *pyPkg = NULL;
+    unsigned int flags = 0;
+    unsigned int unset_flags = 0;
+    if (PyArg_ParseTuple(args, "O!I|I", &PyPackage_Type, &pyPkg,
+                         &flags, &unset_flags) == 0)
+        return 0;
+
+	if (!valid_flags(flags))
+		return PyErr_Format(PyExc_ValueError, "flags (%u) is"
+		                    " not a valid combination of flags.",
+		                    flags);
+	if (!valid_flags(unset_flags))
+		return PyErr_Format(PyExc_ValueError, "unset_flags (%u) is"
+		                    " not a valid combination of flags.",
+		                    unset_flags);
+
+    list->Flag(PyPackage_ToCpp(pyPkg), flags, unset_flags);
+    
+    Py_RETURN_NONE;
+}
+
+static const char order_list_is_flag_doc[] =
+    "is_flag(pkg: Package, flag: int)\n\n"
+    "Check if the flag(s) are set.";
+static PyObject *order_list_is_flag(PyObject *self,PyObject *args)
+{
+    pkgOrderList *list = GetCpp<pkgOrderList*>(self);
+    PyObject *pyPkg = NULL;
+    unsigned int flags = 0;
+    if (PyArg_ParseTuple(args, "O!I", &PyPackage_Type, &pyPkg,
+                         &flags) == 0)
+        return 0;
+
+	if (!valid_flags(flags))
+		return PyErr_Format(PyExc_ValueError, "flags (%u) is"
+		                    " not a valid combination of flags.",
+		                    flags);
+
+    return PyBool_FromLong(list->IsFlag(PyPackage_ToCpp(pyPkg), flags));
+}
+
+static const char order_list_wipe_flags_doc[] =
+    "wipe_flags(flags: int)\n\n"
+    "Remove the flags in 'flags' from all packages in this list";
+static PyObject *order_list_wipe_flags(PyObject *self,PyObject *args)
+{
+    pkgOrderList *list = GetCpp<pkgOrderList*>(self);
+    unsigned int flags = 0;
+    if (PyArg_ParseTuple(args, "I", &flags) == 0)
+        return 0;
+
+	if (!valid_flags(flags))
+		return PyErr_Format(PyExc_ValueError, "flags (%u) is"
+		                    " not a valid combination of flags.",
+		                    flags);
+
+    list->WipeFlags(flags);
+    Py_RETURN_NONE;
+}
+
+static const char order_list_is_now_doc[] =
+    "is_now(pkg: Package)\n\n"
+    "Check if the package is flagged for any state but removal.";
+static PyObject *order_list_is_now(PyObject *self,PyObject *args)
+{
+    pkgOrderList *list = GetCpp<pkgOrderList*>(self);
+    PyObject *pyPkg = NULL;
+    if (PyArg_ParseTuple(args, "O!", &PyPackage_Type, &pyPkg) == 0)
+        return 0;
+
+    return PyBool_FromLong(list->IsNow(PyPackage_ToCpp(pyPkg)));
+}
+
+static const char order_list_is_missing_doc[] =
+    "is_now(pkg: Package)\n\n"
+    "Check if the package is marked for install.";
+static PyObject *order_list_is_missing(PyObject *self,PyObject *args)
+{
+    pkgOrderList *list = GetCpp<pkgOrderList*>(self);
+    PyObject *pyPkg = NULL;
+    if (PyArg_ParseTuple(args, "O!", &PyPackage_Type, &pyPkg) == 0)
+        return 0;
+
+    return PyBool_FromLong(list->IsMissing(PyPackage_ToCpp(pyPkg)));
+}
+
+
+#define METHOD(name) {#name, order_list_##name, METH_VARARGS,\
+                      order_list_##name##_doc}
+
+static PyMethodDef order_list_methods[] = {
+	METHOD(append),
+	METHOD(score),
+	METHOD(order_critical),
+	METHOD(order_unpack),
+	METHOD(order_configure),
+	METHOD(flag),
+	METHOD(is_flag),
+	METHOD(is_now),
+	METHOD(is_missing),
+	METHOD(wipe_flags),
+	{}
+};
+
+static PyObject *order_list_seq_item(PyObject *self,Py_ssize_t index)
+{
+    pkgOrderList *list = GetCpp<pkgOrderList*>(self);
+    PyObject *owner = GetOwner<pkgOrderList*>(self);
+    PyObject *pycache = GetOwner<pkgOrderList*>(owner);
+    pkgCache *cache = PyCache_ToCpp(pycache);
+
+    if (index < 0 || index >= list->size())
+        return PyErr_Format(PyExc_IndexError, "Out of range: %zd", index);
+
+    return PyPackage_FromCpp(pkgCache::PkgIterator(*cache,
+                                *(list->begin() + index)),
+                             true, owner);
+}
+
+Py_ssize_t order_list_seq_length(PyObject *self)
+{
+    return GetCpp<pkgOrderList*>(self)->size();
+}
+
+static PySequenceMethods order_list_as_sequence =
+{
+   order_list_seq_length, // sq_length
+   0,                     // sq_concat
+   0,                     // sq_repeat
+   order_list_seq_item,   // sq_item
+   0,                     // sq_ass_item
+   0,                     // sq_contains
+   0,                     // sq_inplace_concat
+   0                      // sq_inplace_repeat
+};
+
+static const char order_list_doc[] = "OrderList(depcache: DepCache)\n\n"
+    "Sequence type for packages with special ordering methods.";
+PyTypeObject PyOrderList_Type = {
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
+    "apt_pkg.OrderList",                 // tp_name
+    sizeof(CppPyObject<pkgOrderList*>),  // tp_basicsize
+    0,                                   // tp_itemsize
+    // Methods
+    CppDeallocPtr<pkgOrderList*>,        // tp_dealloc
+    0,                                   // tp_print
+    0,                                   // tp_getattr
+    0,                                   // tp_setattr
+    0,                                   // tp_compare
+    0,                                   // tp_repr
+    0,                                   // tp_as_number
+    &order_list_as_sequence,             // tp_as_sequence
+    0,                                   // tp_as_mapping
+    0,                                   // tp_hash
+    0,                                   // tp_call
+    0,                                   // tp_str
+    0,                                   // tp_getattro
+    0,                                   // tp_setattro
+    0,                                   // tp_as_buffer
+    Py_TPFLAGS_DEFAULT,                  // tp_flags
+    order_list_doc,                      // tp_doc
+    0,                                   // tp_traverse
+    0,                                   // tp_clear
+    0,                                   // tp_richcompare
+    0,                                   // tp_weaklistoffset
+    0,                                   // tp_iter
+    0,                                   // tp_iternext
+    order_list_methods,                  // tp_methods
+    0,                                   // tp_members
+    0,                                   // tp_getset
+    0,                                   // tp_base
+    0,                                   // tp_dict
+    0,                                   // tp_descr_get
+    0,                                   // tp_descr_set
+    0,                                   // tp_dictoffset
+    0,                                   // tp_init
+    0,                                   // tp_alloc
+    order_list_new,                      // tp_new
+};

=== modified file 'python/python-apt-helpers.cc'
--- python/python-apt-helpers.cc	2011-04-05 12:37:16 +0000
+++ python/python-apt-helpers.cc	2011-04-27 10:32:40 +0000
@@ -54,6 +54,7 @@ NEW_FROM(PyMetaIndex_FromCpp,&PyMetaInde
 NEW_FROM(PyPackage_FromCpp,&PyPackage_Type,pkgCache::PkgIterator)
 NEW_FROM(PyGroup_FromCpp,&PyGroup_Type,pkgCache::GrpIterator)
 NEW_FROM(PyIndexFile_FromCpp,&PyIndexFile_Type,pkgIndexFile*)
+NEW_FROM(PyOrderList_FromCpp,&PyOrderList_Type,pkgOrderList*)
 NEW_FROM(PyPackageFile_FromCpp,&PyPackageFile_Type,pkgCache::PkgFileIterator)
 //NEW_FROM(PyPackageList_FromCpp,&PyPackageList_Type,PkgListStruct)
 NEW_FROM(PyPackageManager_FromCpp,&PyPackageManager_Type,pkgPackageManager*)

=== modified file 'python/python-apt.h'
--- python/python-apt.h	2011-04-05 12:37:16 +0000
+++ python/python-apt.h	2011-04-27 10:36:54 +0000
@@ -170,6 +170,10 @@ struct _PyAptPkgAPIStruct {
     PyTypeObject *group_type;
     PyObject* (*group_fromcpp)(pkgCache::GrpIterator const &obj, bool Delete, PyObject *Owner);
     pkgCache::GrpIterator& (*group_tocpp)(PyObject *self);
+    
+    PyTypeObject *orderlist_type;
+    PyObject* (*orderlist_fromcpp)(pkgOrderList* const &obj, bool Delete, PyObject *Owner);
+    pkgOrderList*& (*orderlist_tocpp)(PyObject *self);
 };
 
 // Checking macros.
@@ -228,6 +232,7 @@ struct _PyAptPkgAPIStruct {
 # define PyPackage_CheckExact(op)          (op->op_type == &PyPackage_Type)
 # define PyPackageFile_CheckExact(op)      (op->op_type == &PyPackageFile_Type)
 # define PyIndexFile_CheckExact(op)        (op->op_type == &PyIndexFile_Type)
+# define PyOrderList_CheckExact(op)        (op->op_type == &PyOrderList_Type)
 # define PyPackageList_CheckExact(op)      (op->op_type == &PyPackageList_Type)
 # define PyPackageManager_CheckExact(op)   (op->op_type == &PyPackageManager_Type)
 # define PyPackageRecords_CheckExact(op)   (op->op_type == &PyPackageRecords_Type)
@@ -273,6 +278,7 @@ static int import_apt_pkg(void) {
 #  define PyPackage_Type           *(_PyAptPkg_API->package_type)
 #  define PyPackageFile_Type       *(_PyAptPkg_API->packagefile_type)
 #  define PyIndexFile_Type         *(_PyAptPkg_API->packageindexfile_type)
+#  define PyOrderList_Type         *(_PyAptPkg_API->orderlist_type)
 #  define PyPackageList_Type       *(_PyAptPkg_API->packagelist_type)
 #  define PyPackageManager_Type    *(_PyAptPkg_API->packagemanager_type)
 #  define PyPackageRecords_Type    *(_PyAptPkg_API->packagerecords_type)
@@ -306,6 +312,7 @@ static int import_apt_pkg(void) {
 #  define PyPackage_ToCpp          _PyAptPkg_API->package_tocpp
 #  define PyPackageFile_ToCpp      _PyAptPkg_API->packagefile_tocpp
 #  define PyIndexFile_ToCpp        _PyAptPkg_API->packageindexfile_tocpp
+#  define PyOrderList_ToCpp        _PyAptPkg_API->orderlist_tocpp // NULL
 #  define PyPackageList_ToCpp      _PyAptPkg_API->packagelist_tocpp // NULL
 #  define PyPackageManager_ToCpp   _PyAptPkg_API->packagemanager_tocpp
 #  define PyPackageRecords_ToCpp   _PyAptPkg_API->packagerecords_tocpp
@@ -339,6 +346,7 @@ static int import_apt_pkg(void) {
 #  define PyPackage_FromCpp          _PyAptPkg_API->package_fromcpp
 #  define PyPackageFile_FromCpp      _PyAptPkg_API->packagefile_fromcpp
 #  define PyIndexFile_FromCpp        _PyAptPkg_API->packageindexfile_fromcpp
+#  define PyOrderList_FromCpp        _PyAptPkg_API->orderlist_fromcpp // NULL
 #  define PyPackageList_FromCpp      _PyAptPkg_API->packagelist_fromcpp // NULL
 #  define PyPackageManager_FromCpp   _PyAptPkg_API->packagemanager_fromcpp
 #  define PyPackageRecords_FromCpp   _PyAptPkg_API->packagerecords_fromcpp

=== modified file 'setup.py'
--- setup.py	2011-04-05 12:37:16 +0000
+++ setup.py	2011-04-26 12:58:50 +0000
@@ -34,7 +34,7 @@ files = ['apt_pkgmodule.cc', 'acquire.cc
          'pkgmanager.cc', 'pkgrecords.cc', 'pkgsrcrecords.cc', 'policy.cc',
          'progress.cc', 'sourcelist.cc', 'string.cc', 'tag.cc',
          'lock.cc', 'acquire-item.cc', 'python-apt-helpers.cc',
-         'cachegroup.cc']
+         'cachegroup.cc', 'orderlist.cc']
 files = sorted(['python/' + fname for fname in files], key=lambda s: s[:-3])
 apt_pkg = Extension("apt_pkg", files, libraries=["apt-pkg"])
 

