[Debtags-commits] [svn] r897 - in libdebtags1/trunk: . debian debtags debtags/old swig tests
Enrico Zini
debtags-commits@lists.alioth.debian.org
Sat, 18 Jun 2005 08:00:03 +0000
Author: enrico
Date: Sat Jun 18 08:00:01 2005
New Revision: 897
Added:
libdebtags1/trunk/DONE
libdebtags1/trunk/debtags/old/
libdebtags1/trunk/debtags/old/Environment.cc
- copied unchanged from r889, libdebtags1/trunk/debtags/Environment.cc
libdebtags1/trunk/debtags/old/Environment.h
- copied unchanged from r884, libdebtags1/trunk/debtags/Environment.h
libdebtags1/trunk/debtags/old/Maintainer.cc
- copied unchanged from r881, libdebtags1/trunk/debtags/Maintainer.cc
libdebtags1/trunk/debtags/old/Maintainer.h
- copied unchanged from r881, libdebtags1/trunk/debtags/Maintainer.h
libdebtags1/trunk/debtags/old/MaintainerSet.cc
- copied unchanged from r881, libdebtags1/trunk/debtags/MaintainerSet.cc
libdebtags1/trunk/debtags/old/MaintainerSet.h
- copied unchanged from r881, libdebtags1/trunk/debtags/MaintainerSet.h
Removed:
libdebtags1/trunk/NEWS
libdebtags1/trunk/TODO
libdebtags1/trunk/debtags/Environment.cc
libdebtags1/trunk/debtags/Environment.h
libdebtags1/trunk/debtags/Maintainer.cc
libdebtags1/trunk/debtags/Maintainer.h
libdebtags1/trunk/debtags/MaintainerSet.cc
libdebtags1/trunk/debtags/MaintainerSet.h
Modified:
libdebtags1/trunk/README
libdebtags1/trunk/debian/docs
libdebtags1/trunk/debtags/BasicPackageMatcher.cc
libdebtags1/trunk/debtags/DebtagsFilters.cc
libdebtags1/trunk/debtags/DebtagsFilters.h
libdebtags1/trunk/debtags/DebtagsSimple.h
libdebtags1/trunk/debtags/Makefile.am
libdebtags1/trunk/debtags/Package.cc
libdebtags1/trunk/debtags/Package.h
libdebtags1/trunk/debtags/PackageImpl.cc
libdebtags1/trunk/debtags/PackageImpl.h
libdebtags1/trunk/debtags/PackageSet.cc
libdebtags1/trunk/debtags/PackageSet.h
libdebtags1/trunk/debtags/instantiations.cc
libdebtags1/trunk/swig/libdebtags.i
libdebtags1/trunk/tests/ex-showpkg.cc
libdebtags1/trunk/tests/test-dbcat.cc
libdebtags1/trunk/tests/test-packagedata.cc
libdebtags1/trunk/tests/test-packages.cc
Log:
Removed Maintainer, MaintainerSet and Environment
Merged TODO into the README
Modified: libdebtags1/trunk/README
==============================================================================
--- libdebtags1/trunk/README (original)
+++ libdebtags1/trunk/README Sat Jun 18 08:00:01 2005
@@ -1,4 +1,8 @@
-README for libdebtags
+README for libdebtags 1.0.3, still unreleased
+=============================================
+
+Functionality
+-------------
The package finally builds some API documentation using doxygen. Not much of
the source code has useful comments yets, but since doxygen support is in
@@ -21,7 +25,54 @@
I would like to involve library users in design discussions and API changes.
-Project resources:
+What is in this release
+-----------------------
+
+DebtagsSimple has become a template. You can now choose if you want to use
+Package or std::string to represent packages. Choosing std::string gives big
+performance improvements, plays well with libraries that use other ways of
+accessing packages (such as libapt-front or libapt directly) and is in line of
+progressively getting rid of Package in libdebtags1.
+
+
+Environment has been removed. Finally no messy, catch-all singleton class that
+smells like a collection of global variables. You can now use DebtagsSimple to
+get the same functionality.
+
+Some migration hints::
+
+ Package pkg = Environment::getPackage("debtags");
+
+is now replaced by::
+
+ Package pkg = DebtagsSimple::serializer().stringToItem("debtags");
+
+
+Maintainer and MaintainerSet have been removed. This has been done in the path
+of progressively abandon functionalities that should instead be in
+libapt-front. The Maintainer class was little more than a wrapper around
+std::string, and it can now be replaced by just a std::string.
+
+
+Compiling from the subversion repository
+----------------------------------------
+
+Additionally to the build-dependencies, you need to install ``libtool`` and
+``automake1.9`::
+
+ apt-get install libtool automake1.9
+ ./autogen.sh
+ ./configure
+ make
+
+The library uses GNU Libtool. While this is very nice, it can be a pain when
+trying to debug a program. For that reason, compilation of shared libraries can
+be turned off by specifying the ``--disable-shared`` option to ``configure``.
+
+
+
+Resources
+---------
Website:
@@ -51,9 +102,169 @@
deb http://debtags.alioth.debian.org/debian unstable main
-The library uses GNU Libtool. While this is very nice, it can be a pain when
-trying to debug a program. For that reason, compilation of shared libraries can
-be turned off by specifying the `--disable-shared' option to `configure'.
+Further stages of the development
+---------------------------------
+
+Development will now proceed by:
+
+ * Slowly getting rid of the Package class, which should be handled by better
+ libraries such as libapt-front
+ * Making the library more generic, with more use of templates
+ * Trying to find better data structure and algorithms to improve the
+ efficiency of the various features provided by libdebtags1
+
+
+TODO-list items completed so far
+--------------------------------
+
+These are the TODO-list items completed so far::
+
+ * Done in version 1.0.3
+
+ + Remove Environment.{h,cc}
+ + Remove Maintainer.{h,cc}
+ + Generalise everything on the package type, allowing to use both a string and
+ a Package
+ + PackageDB returns a pkgSection with pointers to some memory that gets
+ deallocated at the end of the called function; the whole thing now works
+ just because that memory is only copied inside a Package, and very fast
+ + Possible implementation for Package (and Tag and Facet): keep only the full
+ data record and a pkgTagSection to access it
+
+ * Done in version 1.0.1
+
+ + Added DebtagsTODO and DebtagsFilters
+
+ * Done in version 1.0
+
+ + Package name change
+ ! API change
+ + Introduced simplified interface in new class Debtags
+ + Environment can now output packages to a TagcollConsumer
+
+
+(older items are archived in the DONE file)
+
+
+
+TODO-list items being worked on
+-------------------------------
+
+These are the TODO-list items currently being worked on::
+
+ - Try to get rid of the Singleton Environment
+
+ - Remove throw declarations altogether except when the function obviously
+ isn't throwing and won't be throwing anything.
+
+ - perl bindings crash at shutdown: it looks like #186104: check what it was,
+ and check how it has been corrected
+ - Does not seem to be the case:
+ TDBReadonlyDiskIndex's destructor reports garbage in the size of
+ newItems, even if nothing has been ending up on it (that is,
+ ~/.debtags/patch has been moved aside).
+
+ - Remove all PackageDB-related functions: libapt-front should be used for
+ that. PackageDB itself probably needs to stay for the APTFilter in Update.
+
+ - Impossible now to detect out-of-space errors because TagcollSerializer isn't
+ checking the return code of fprintf (changing it would break libtagcoll
+ binary compatibility)
+ (fixed in libtagcoll, should handle it appropriately in libdebtags)
+
+ - Sending mail to central database aborts if the mailserver fails
+
+ - See if mor standard c++ features can be used
+
+ use of functors (``operator()``)
+
+ The Debtags::Matcher is a good candidate for this one, having the same
+ implementation like the match function. With this the code in
+ TagSet::getFiltered could be implemented using a the copy_if() algorithm.
+ Uhh... the above is hard to read. I mean the operator() could be added to
+ the Debtags::Matcher() - where it could be used in std algorithms.
+
+
+
+
+
+Future TODO-list items
+----------------------
+
+These are the TODO-list items that are to be addressed in the future::
+
+ - Try wrapping with http://www.boost.org/libs/python/doc/index.html
+
+ - Make a small LRU cache of Facets and Tags in Vocabulary, so that some
+ TagImpl and FacetImpl are reused
+
+ - Update doesn't really merge different tag sources
+ (need more info) (seems to work for me: where does this come from?)
+
+ - Implement failover strategies in case the vocabulary (or other files) are
+ not present
+
+ - Create new tags / facets
+ - Save a vocabulary patch
+
+ - Make a more efficient collection container than InputMerger for the
+ operations performed by libdebtags
+
+ - port foundation libraries to libboost when possible
+
+
+
+
+
+Discarded TODO-list items
+-------------------------
+
+ = Consider implementing version information in Package, allowing more
+ Package-s with the same name but with different versions in PackageGroups
+ (can do by changing Package's comparison operators)
+ - Consider then doing dependency computations, like
+ PackageGroup PackageGroup::getDepends();
+ PackageGroup PackageGroup::getRecommends();
+ PackageGroup PackageGroup::getSuggests();
+ PackageGroup PackageGroup::getConflicts();
+ ...
+ = Allow more flexibility in Package representations
+ - Make PackageImpl somehow more public, so that people can subclass it and
+ write Package-like classes with more informations (as you can't subclass
+ Package, being it a smart pointer)
+ - Make PackageSet a template, to which you can pass Package or something else
+ - Rename Package into BasicPackage
+ - Make a Package virtual interface
+
+ = Bring in dependency info from synaptic (rpackage.h)
+ Subversion: https://oops.kerneljanitors.org/repos/synaptic/trunk
+ PackageSet Package::getDepends()
+ PackageSet Package::getSuggests()
+ PackageSet Package::getRecommends()
+ PackageSet PackageSet::getDepends()
+ PackageSet PackageSet::getSuggests()
+ PackageSet PackageSet::getRecommends()
+ (no: leave that to libapt-front)
+ = Environment: accept the filter as const
+ = Implement filters, searches and consumers also for MaintainerSet
+ = Find out how to efficiently search a std::set<Package> given the package
+ name, though: #include<algorithm> could come useful, hopefully, as it would
+ come useful to see what operators are supported by the set iterator (it
+ would be wonderful if it had tree operations...)
+ = See how it is possible to be a base for libcapture
+ = Integrate Maintainer info with Echelon data (from Debian LDAP database)
+ = Do popcon researches as well
+
+
+
+Useful resources
+----------------
+
+
+Author
+------
----
Enrico Zini <enrico@debian.org>
+
+
+ vim:set ts=3 sw=3:
Modified: libdebtags1/trunk/debian/docs
==============================================================================
--- libdebtags1/trunk/debian/docs (original)
+++ libdebtags1/trunk/debian/docs Sat Jun 18 08:00:01 2005
@@ -1,2 +1,3 @@
NEWS
README
+DONE
Modified: libdebtags1/trunk/debtags/BasicPackageMatcher.cc
==============================================================================
--- libdebtags1/trunk/debtags/BasicPackageMatcher.cc (original)
+++ libdebtags1/trunk/debtags/BasicPackageMatcher.cc Sat Jun 18 08:00:01 2005
@@ -2,7 +2,6 @@
#include <debtags/BasicPackageMatcher.h>
#include <debtags/Package.h>
-#include <debtags/Maintainer.h>
#include <Regexp.h>
@@ -84,7 +83,7 @@
bool BasicPackageMatcher::match(const Package& pkg, const OpSet<Tag>& tags) const throw ()
{
bool got = true;
- if (hasMaintainer() && pkg.maint() && !matchMaintainer(pkg.maint().fullname()))
+ if (hasMaintainer() && !matchMaintainer(pkg.maint()))
got = false;
if (hasName() && !matchName(pkg.name()))
got = false;
Modified: libdebtags1/trunk/debtags/DebtagsFilters.cc
==============================================================================
--- libdebtags1/trunk/debtags/DebtagsFilters.cc (original)
+++ libdebtags1/trunk/debtags/DebtagsFilters.cc Sat Jun 18 08:00:01 2005
@@ -6,24 +6,23 @@
#include <debtags/DebtagsSerializer.h>
#include <debtags/Package.h>
#include <debtags/Tag.h>
-#include <debtags/Environment.h>
#include <tagcoll/tagexpr/TagexprParser.h>
using namespace std;
using namespace Debtags;
-ExpressionFilter::ExpressionFilter(const std::string& expression) throw (ConsistencyCheckException)
- : ser(Debtags::Environment::get().vocabulary()), expr(0)
+ExpressionFilter::ExpressionFilter(Tagcoll::Serializer<Package, Tag>& ser, const std::string& expression) throw (ConsistencyCheckException)
+ : ser(ser), expr(0)
{
expr = Tagcoll::TagexprParser::instance()->parse(expression);
if (expr == 0)
throw ConsistencyCheckException("compiling tag expression \"" + expression + "\" failed");
}
-ExpressionFilter::ExpressionFilter(const std::string& expression, Tagcoll::TagcollConsumer<Package, Tag>* cons)
+ExpressionFilter::ExpressionFilter(Tagcoll::Serializer<Package, Tag>& ser, const std::string& expression, Tagcoll::TagcollConsumer<Package, Tag>* cons)
throw (ConsistencyCheckException)
: Tagcoll::TagcollFilter<Package, Tag>(cons),
- ser(Debtags::Environment::get().vocabulary()), expr(0)
+ ser(ser), expr(0)
{
expr = Tagcoll::TagexprParser::instance()->parse(expression);
if (expr == 0)
Modified: libdebtags1/trunk/debtags/DebtagsFilters.h
==============================================================================
--- libdebtags1/trunk/debtags/DebtagsFilters.h (original)
+++ libdebtags1/trunk/debtags/DebtagsFilters.h Sat Jun 18 08:00:01 2005
@@ -44,12 +44,12 @@
class ExpressionFilter : public Tagcoll::TagcollFilter<Package, Tag>
{
protected:
- Tagcoll::Serializer<Package, Tag> ser;
+ Tagcoll::Serializer<Package, Tag>& ser;
Tagcoll::Tagexpr* expr;
public:
- ExpressionFilter(const std::string& expression) throw (ConsistencyCheckException);
- ExpressionFilter(const std::string& expression, Tagcoll::TagcollConsumer<Package, Tag>* cons) throw (ConsistencyCheckException);
+ ExpressionFilter(Tagcoll::Serializer<Package, Tag>& ser, const std::string& expression) throw (ConsistencyCheckException);
+ ExpressionFilter(Tagcoll::Serializer<Package, Tag>& ser, const std::string& expression, Tagcoll::TagcollConsumer<Package, Tag>* cons) throw (ConsistencyCheckException);
virtual ~ExpressionFilter() throw ();
virtual void consume(const Debtags::Package& item) throw ();
Modified: libdebtags1/trunk/debtags/DebtagsSimple.h
==============================================================================
--- libdebtags1/trunk/debtags/DebtagsSimple.h (original)
+++ libdebtags1/trunk/debtags/DebtagsSimple.h Sat Jun 18 08:00:01 2005
@@ -51,7 +51,7 @@
TagDB<ITEM> _tagDB;
public:
- DebtagsSimple(bool editable);
+ DebtagsSimple(bool editable = false);
~DebtagsSimple() throw () {}
// Check if the tag database has been created (i.e. if debtags update has been run)
Modified: libdebtags1/trunk/debtags/Makefile.am
==============================================================================
--- libdebtags1/trunk/debtags/Makefile.am (original)
+++ libdebtags1/trunk/debtags/Makefile.am Sat Jun 18 08:00:01 2005
@@ -16,12 +16,9 @@
Update.h \
TagSet.h \
PackageDB.h \
- Environment.h \
Consumer.h \
Package.h \
PackageSet.h \
- Maintainer.h \
- MaintainerSet.h \
BasicTagMatcher.h \
BasicPackageMatcher.h \
TagToFacet.h \
@@ -47,8 +44,6 @@
Update.cc \
TagSet.cc \
PackageDB.cc \
- Maintainer.cc \
- MaintainerSet.cc \
PackageImpl.cc \
Package.cc \
PackageSet.cc \
@@ -57,7 +52,6 @@
DebtagsTODO.cc \
DebtagsSimple.cc \
DebtagsFilters.cc \
- Environment.cc \
instantiations.cc \
instantiations1.cc
#libdebtags1_la_LDFLAGS = -version-info @LIBDEBTAGS_VERSION_INFO@ -static
@@ -86,14 +80,11 @@
TagSet_pic.o \
PackageDB_pic.o \
DebtagsSimple_pic.o \
- Maintainer_pic.o \
- MaintainerSet_pic.o \
PackageImpl_pic.o \
Package_pic.o \
PackageSet_pic.o \
BasicTagMatcher_pic.o \
BasicPackageMatcher_pic.o \
- Environment_pic.o \
instantiations_pic.o \
instantiations1_pic.o
#libdebtags1_pic_la_LDFLAGS = -static
Modified: libdebtags1/trunk/debtags/Package.cc
==============================================================================
--- libdebtags1/trunk/debtags/Package.cc (original)
+++ libdebtags1/trunk/debtags/Package.cc Sat Jun 18 08:00:01 2005
@@ -2,7 +2,6 @@
#include <debtags/Package.h>
#include <debtags/PackageImpl.h>
-#include <debtags/Environment.h>
#include <debtags/TagDB.h>
#include <debtags/TagSet.h>
#if 0
@@ -77,12 +76,7 @@
std::string Package::sdesc() const throw () { return impl->sdesc(); }
std::string Package::ldesc() const throw () { return impl->ldesc(); }
std::string Package::fulldata() const throw () { return impl->fulldata(); }
-Maintainer Package::maint() const throw () { return impl->maint(); }
+std::string Package::maint() const throw () { return impl->maint(); }
int Package::state() const throw (PackageDBException) { return impl->state(); }
-const TagSet Package::tags() const throw ()
-{
- return Environment::get().tagDB().getTags(*this);
-}
-
// vim:set ts=3 sw=3:
Modified: libdebtags1/trunk/debtags/Package.h
==============================================================================
--- libdebtags1/trunk/debtags/Package.h (original)
+++ libdebtags1/trunk/debtags/Package.h Sat Jun 18 08:00:01 2005
@@ -15,7 +15,6 @@
class StandardEnvironment;
class PackageImpl;
class PackageSet;
-class Maintainer;
class Package
{
@@ -39,11 +38,9 @@
std::string sdesc() const throw ();
std::string ldesc() const throw ();
std::string fulldata() const throw ();
- Maintainer maint() const throw ();
+ std::string maint() const throw ();
int state() const throw (PackageDBException);
- const TagSet tags() const throw ();
-
friend class PackageDB;
#if 0
friend class PackageImpl;
Modified: libdebtags1/trunk/debtags/PackageImpl.cc
==============================================================================
--- libdebtags1/trunk/debtags/PackageImpl.cc (original)
+++ libdebtags1/trunk/debtags/PackageImpl.cc Sat Jun 18 08:00:01 2005
@@ -66,9 +66,11 @@
string PackageImpl::fulldata() const throw () { return _buf; }
-Maintainer PackageImpl::maint() const throw ()
+string PackageImpl::maint() const throw ()
{
- if (!_maint)
+ return data.FindS("Maintainer");
+#if 0
+ if (_maint.empty())
{
#if 0
string val = data.FindS("Maintainer");
@@ -81,7 +83,7 @@
// Create a new maintainer
_maint = Maintainer(mail);
#endif
- _maint = Maintainer(data.FindS("Maintainer"));
+ //_maint = Maintainer(data.FindS("Maintainer"));
#if 0
// Update maintainer informations
maint.fullname(val);
@@ -91,6 +93,7 @@
}
return _maint;
+#endif
}
int PackageImpl::state() const throw (PackageDBException)
Modified: libdebtags1/trunk/debtags/PackageImpl.h
==============================================================================
--- libdebtags1/trunk/debtags/PackageImpl.h (original)
+++ libdebtags1/trunk/debtags/PackageImpl.h Sat Jun 18 08:00:01 2005
@@ -13,7 +13,6 @@
#endif
#include <debtags/PackageDB.h>
-#include <debtags/Maintainer.h>
#include <apt-pkg/tagfile.h>
@@ -32,8 +31,6 @@
std::string _buf;
pkgTagSection data;
- mutable Maintainer _maint;
-
public:
PackageImpl(const PackageDB& pdb, const std::string& buf) throw ();
~PackageImpl() throw ();
@@ -51,7 +48,7 @@
std::string ldesc() const throw ();
std::string fulldata() const throw ();
- Maintainer maint() const throw ();
+ std::string maint() const throw ();
int state() const throw (PackageDBException);
Modified: libdebtags1/trunk/debtags/PackageSet.cc
==============================================================================
--- libdebtags1/trunk/debtags/PackageSet.cc (original)
+++ libdebtags1/trunk/debtags/PackageSet.cc Sat Jun 18 08:00:01 2005
@@ -21,8 +21,6 @@
#pragma implementation
#include <debtags/PackageSet.h>
-#include <debtags/MaintainerSet.h>
-#include <debtags/Environment.h>
#include <debtags/TagSet.h>
using namespace std;
@@ -49,6 +47,7 @@
}
+/*
FacetSet PackageSet::getFacets() const throw ()
{
FacetSet res;
@@ -64,15 +63,17 @@
res += i->tags();
return res;
}
+*/
-MaintainerSet PackageSet::getMaintainers() const throw ()
+OpSet<string> PackageSet::getMaintainers() const throw ()
{
- MaintainerSet res;
+ OpSet<string> res;
for (const_iterator i = begin(); i != end(); i++)
res += i->maint();
return res;
}
+/*
// Get the set of all tags in this collection that appear in tagsets
// containing `ts'
TagSet PackageSet::getCompanionTags(const TagSet& ts) const throw ()
@@ -85,6 +86,7 @@
return tags;
}
+*/
#if 0
Package PackageSet::find(const std::string& name) const throw ()
@@ -98,6 +100,7 @@
}
#endif
+/*
Maintainer PackageSet::findMaintainer(const std::string& email) const throw ()
{
for (const_iterator i = begin(); i != end(); i++)
@@ -105,6 +108,7 @@
return i->maint();
return Maintainer();
}
+*/
void PackageSet::output(PackageConsumer& cons) const throw ()
{
@@ -129,6 +133,7 @@
}
// Get the PackageSet of packages related to `pivot'
+/*
PackageSet PackageSet::getRelated(const Package& pivot, int distance) const throw ()
{
return getRelated(pivot.tags(), distance) - pivot;
@@ -164,5 +169,6 @@
for (PackageSet::const_iterator i = res.begin(); i != res.end(); i++)
cons.consume(*i);
}
+*/
// vim:set ts=4 sw=4:
Modified: libdebtags1/trunk/debtags/PackageSet.h
==============================================================================
--- libdebtags1/trunk/debtags/PackageSet.h (original)
+++ libdebtags1/trunk/debtags/PackageSet.h Sat Jun 18 08:00:01 2005
@@ -34,8 +34,6 @@
class FacetSet;
class TagSet;
-class Maintainer;
-class MaintainerSet;
class PackageSet : public OpSet<Debtags::Package>, public PackageConsumer
{
@@ -48,14 +46,16 @@
virtual void consume(const Package& pkg) throw ();
+ /*
// Get a list of all facets in these packages
FacetSet getFacets() const throw ();
// Get a list of all tags in these packages
TagSet getTags() const throw ();
+ */
// Get a list of all the maintainers of these packages
- MaintainerSet getMaintainers() const throw ();
+ Tagcoll::OpSet<std::string> getMaintainers() const throw ();
// Get the set of all tags in this collection that appear in tagsets
// containing `ts'
@@ -67,7 +67,7 @@
#endif
// Get the Maintainer object given the maintainers's e-mail
- Maintainer findMaintainer(const std::string& email) const throw ();
+ //Maintainer findMaintainer(const std::string& email) const throw ();
// Output the whole package list to `cons'
void output(PackageConsumer& cons) const throw ();
@@ -78,6 +78,7 @@
// Get the packages that are matched by `filter'
PackageSet getFiltered(PackageMatcher& filter) const throw ();
+ /*
// Get the PackageSet of packages related to `pivot'
PackageSet getRelated(const Package& pivot, int distance = 1) const throw ();
@@ -89,6 +90,7 @@
// Output list of packages related to the specific tagset to `cons'
void outputRelated(PackageConsumer& cons, const Debtags::TagSet& ts, int distance = 1) const throw ();
+ */
};
};
Modified: libdebtags1/trunk/debtags/instantiations.cc
==============================================================================
--- libdebtags1/trunk/debtags/instantiations.cc (original)
+++ libdebtags1/trunk/debtags/instantiations.cc Sat Jun 18 08:00:01 2005
@@ -1,7 +1,6 @@
#define INSTANTIATING_TEMPLATES
#include <debtags/Package.h>
-#include <debtags/Maintainer.h>
#include <debtags/Tag.h>
#include <debtags/DebtagsSerializer.h>
#include <debtags/TagDB.h>
@@ -33,7 +32,6 @@
template class ItemGrouper<std::string, Debtags::Tag>;
template class ItemGrouper<Debtags::Package, Debtags::Tag>;
template class OpSet<Debtags::Package>;
-template class OpSet<Debtags::Maintainer>;
template class OpSet<Debtags::Tag>;
template class OpSet<Debtags::Facet>;
template class SmartHierarchyNode<Debtags::Package, Debtags::Tag>;
Modified: libdebtags1/trunk/swig/libdebtags.i
==============================================================================
--- libdebtags1/trunk/swig/libdebtags.i (original)
+++ libdebtags1/trunk/swig/libdebtags.i Sat Jun 18 08:00:01 2005
@@ -17,8 +17,6 @@
#include "debtags/DebtagsSimple.h"
#include "debtags/Package.h"
#include "debtags/PackageSet.h"
-#include "debtags/Maintainer.h"
-#include "debtags/MaintainerSet.h"
#include "debtags/BasicPackageMatcher.h"
#include "debtags/PackageDB.h"
Modified: libdebtags1/trunk/tests/ex-showpkg.cc
==============================================================================
--- libdebtags1/trunk/tests/ex-showpkg.cc (original)
+++ libdebtags1/trunk/tests/ex-showpkg.cc Sat Jun 18 08:00:01 2005
@@ -1,4 +1,4 @@
-#include <debtags/Environment.h>
+#include <debtags/DebtagsSimple.h>
#include <debtags/Package.h>
#include <debtags/PackageSet.h>
#include <debtags/TagSet.h>
@@ -15,15 +15,15 @@
// Install the handler for unexpected exceptions
InstallUnexpected installUnexpected;
- Debtags::Environment::init(false);
+ DebtagsSimple<Package> debtags;
string name = argc > 1 ? argv[1] : "debtags";
- Package pkg = Debtags::Environment::get().getPackage(name);
+ Package pkg = debtags.serializer().stringToItem(name);
if (pkg)
{
printf("%.*sTags: ", PFSTR(pkg.fulldata()));
- TagSet ts = pkg.tags();
+ TagSet ts = debtags.tagDB().getTags(pkg);
for (TagSet::const_iterator i = ts.begin();
i != ts.end(); i++)
if (i == ts.begin())
Modified: libdebtags1/trunk/tests/test-dbcat.cc
==============================================================================
--- libdebtags1/trunk/tests/test-dbcat.cc (original)
+++ libdebtags1/trunk/tests/test-dbcat.cc Sat Jun 18 08:00:01 2005
@@ -1,4 +1,4 @@
-#include <debtags/Environment.h>
+#include <debtags/DebtagsSimple.h>
#include <debtags/TagDB.h>
#include <debtags/DebtagsSerializer.h>
@@ -17,19 +17,19 @@
// Install the handler for unexpected exceptions
InstallUnexpected installUnexpected;
- Debtags::Environment::init(false);
+ DebtagsSimple<Package> debtags;
int result = 0;
- TextFormat<Package, Tag> writer(Environment::get().serializer(), stdout);
+ TextFormat<Package, Tag> writer(debtags.serializer(), stdout);
if (argc == 1)
{
ItemGrouper<Package, Tag> grouper;
- Environment::get().tagDB().outputPatched(grouper);
+ debtags.tagDB().outputPatched(grouper);
grouper.output(writer);
} else
- Environment::get().tagDB().outputPatched(writer);
+ debtags.tagDB().outputPatched(writer);
return result;
} catch (Exception& e) {
Modified: libdebtags1/trunk/tests/test-packagedata.cc
==============================================================================
--- libdebtags1/trunk/tests/test-packagedata.cc (original)
+++ libdebtags1/trunk/tests/test-packagedata.cc Sat Jun 18 08:00:01 2005
@@ -4,9 +4,8 @@
#include <tagcoll/stringf.h>
#include <tagcoll/Exception.h>
-#include <debtags/Environment.h>
+#include <debtags/DebtagsSimple.h>
#include <debtags/Package.h>
-#include <debtags/Maintainer.h>
#include <debtags/PackageDB.h>
@@ -34,7 +33,12 @@
class PkgRecordChecker : public PkgRecordConsumer
{
+protected:
+ DebtagsSimple<Package>& debtags;
+
public:
+ PkgRecordChecker(DebtagsSimple<Package>& debtags) throw () : debtags(debtags) {}
+
virtual void operator()(pkgRecords::Parser& p)
{
string name = p.Name();
@@ -42,7 +46,7 @@
string ldesc = p.LongDesc();
string maint = p.Maintainer();
- Package pkg = Debtags::Environment::get().getPackage(name);
+ Package pkg = debtags.serializer().stringToItem(name);
// Compare data in section and pkg
if (!pkg)
@@ -56,19 +60,10 @@
fprintf(stderr, "%.*s: package name \"%.*s\" is different than expected\n",
PFSTR(name), PFSTR(pkg.name()));
}
- else if (!pkg.maint())
- {
- result = 1;
- fprintf(stderr, "%.*s: null maintainer from pkg.maint()\n", PFSTR(name));
- }
- else if (pkg.maint().email() == "error")
- {
- errormaints++;
- }
- else if (pkg.maint().fullname() != maint)
+ else if (pkg.maint() != maint)
{
result = 1;
- string t = pkg.maint().fullname();
+ string t = pkg.maint();
fprintf(stderr, "%.*s: Package maintainer \"%.*s\" is different than expected \"%.*s\"\n",
PFSTR(name), PFSTR(t), PFSTR(maint));
}
@@ -84,7 +79,8 @@
// Install the handler for unexpected exceptions
InstallUnexpected installUnexpected;
- Debtags::Environment::init(false);
+ DebtagsSimple<Package> debtags;
+ //Debtags::Environment::init(false);
/*
PackageDB db;
@@ -95,7 +91,7 @@
PackageDB db;
- PkgRecordChecker checker;
+ PkgRecordChecker checker(debtags);
db.iterateAll(checker);
if (errormaints)
Modified: libdebtags1/trunk/tests/test-packages.cc
==============================================================================
--- libdebtags1/trunk/tests/test-packages.cc (original)
+++ libdebtags1/trunk/tests/test-packages.cc Sat Jun 18 08:00:01 2005
@@ -1,4 +1,4 @@
-#include <debtags/Environment.h>
+#include <debtags/DebtagsSimple.h>
#include <debtags/PackageSet.h>
#include <debtags/TagDB.h>
#include <debtags/TagSet.h>
@@ -126,16 +126,17 @@
// Install the handler for unexpected exceptions
InstallUnexpected installUnexpected;
- Debtags::Environment::init(false);
+ //Debtags::Environment::init(false);
+ DebtagsSimple<Package> debtags;
int result = 0;
// Test set operations on items of type Package
PackageSet test;
- test.insert(Debtags::Environment::get().getPackage("apt"));
- test.insert(Debtags::Environment::get().getPackage("apt"));
- test.insert(Debtags::Environment::get().getPackage("debtags"));
- Package p = Debtags::Environment::get().getPackage("debtags");
+ test.insert(debtags.serializer().stringToItem("apt"));
+ test.insert(debtags.serializer().stringToItem("apt"));
+ test.insert(debtags.serializer().stringToItem("debtags"));
+ Package p = debtags.serializer().stringToItem("debtags");
test.insert(p);
if (test.size() != 2)
{
@@ -150,7 +151,7 @@
}
// Compare two methods of getting tags
- TagDB<Debtags::Package> first = Debtags::Environment::get().tagDB();
+ TagDB<Debtags::Package>& first = debtags.tagDB();
InputMerger<Package, Tag> second;
first.outputPatched(second);