[Debtags-commits] [svn] r1347 - in debtags/trunk: . debian tools

Enrico Zini enrico at costa.debian.org
Thu Sep 8 23:26:03 UTC 2005


Author: enrico
Date: Thu Sep  8 23:26:02 2005
New Revision: 1347

Added:
   debtags/trunk/tools/Filters.cc
   debtags/trunk/tools/Filters.h
Modified:
   debtags/trunk/configure.ac
   debtags/trunk/debian/changelog
   debtags/trunk/debian/control
   debtags/trunk/tools/Makefile.am
   debtags/trunk/tools/debtags.cc
   debtags/trunk/tools/instantiations.cc
Log:
Ported to new libapt-front.
We don't depend in libdebtags1 anymore.


Modified: debtags/trunk/configure.ac
==============================================================================
--- debtags/trunk/configure.ac	(original)
+++ debtags/trunk/configure.ac	Thu Sep  8 23:26:02 2005
@@ -32,13 +32,8 @@
 dnl Python build system
 AM_PATH_PYTHON
 
-dnl Compute library version info
-LIBDEBTAGS_VERSION_INFO=`echo $VERSION | awk -F. '{ printf "%d:%d:%d", $1+$2, $3, $2 }'`
-AC_SUBST(LIBDEBTAGS_VERSION_INFO)
-
 dnl Use libtagcoll, libdebtags and libapt-front
 LIBTAGCOLL1_DEFS
-LIBDEBTAGS1_DEFS
 LIBAPT_FRONT_DEFS
 
 dnl Directory where the shared databases are kept

Modified: debtags/trunk/debian/changelog
==============================================================================
--- debtags/trunk/debian/changelog	(original)
+++ debtags/trunk/debian/changelog	Thu Sep  8 23:26:02 2005
@@ -1,3 +1,11 @@
+debtags (1.5) experimental; urgency=low
+
+  * Ported to new libapt-front
+  * Don't depend on libdebtags1-dev anymore, as it has been merged into
+    libapt-front
+
+ -- Enrico Zini <enrico at debian.org>  Fri,  9 Sep 2005 01:25:21 +0200
+
 debtags (1.4) experimental; urgency=low
 
   * Big refactoring after tagcoll refactoring

Modified: debtags/trunk/debian/control
==============================================================================
--- debtags/trunk/debian/control	(original)
+++ debtags/trunk/debian/control	Thu Sep  8 23:26:02 2005
@@ -2,7 +2,7 @@
 Section: admin
 Priority: optional
 Maintainer: Enrico Zini <enrico at debian.org>
-Build-Depends: c++abi2-dev, cdbs, debhelper (>> 4.1), dh-buildinfo, pkg-config, apt, libdebtags1-dev (>= 1.4), libdebtags1-dev (<< 1.5), libapt-front-dev, zlib1g-dev, python-dev, python-docutils
+Build-Depends: c++abi2-dev, cdbs, debhelper (>> 4.1), dh-buildinfo, pkg-config, apt, libapt-front-dev (>= 0.3), libapt-front-dev (<< 0.4), zlib1g-dev, python-dev, python-docutils
 Standards-Version: 3.6.2.0
 
 Package: debtags

Modified: debtags/trunk/tools/Makefile.am
==============================================================================
--- debtags/trunk/tools/Makefile.am	(original)
+++ debtags/trunk/tools/Makefile.am	Thu Sep  8 23:26:02 2005
@@ -7,11 +7,12 @@
 	ChildProcess.cc \
 	CommandlineParser.cc \
 	Environment.cc \
+	Filters.cc \
 	acqprogress.cc \
 	instantiations.cc \
 	debtags.cc
-debtags_LDADD = $(LIBAPT_FRONT_LIBS) $(LIBDEBTAGS1_LIBS) $(LIBTAGCOLL1_LIBS) -lapt-pkg
+debtags_LDADD = $(LIBAPT_FRONT_LIBS) $(LIBTAGCOLL1_LIBS) -lapt-pkg
 
-INCLUDES = -I.. $(LIBTAGCOLL1_CFLAGS) $(LIBDEBTAGS1_CFLAGS) $(LIBABT_FRONT_CFLAGS)
+INCLUDES = -I.. $(LIBTAGCOLL1_CFLAGS) $(LIBABT_FRONT_CFLAGS)
 
 EXTRA_DIST = acqprogress.h ChildProcess.h CommandlineParser.h Environment.h Exec.h

Modified: debtags/trunk/tools/debtags.cc
==============================================================================
--- debtags/trunk/tools/debtags.cc	(original)
+++ debtags/trunk/tools/debtags.cc	Thu Sep  8 23:26:02 2005
@@ -29,7 +29,12 @@
 
 #include <apt-front/init.h>
 #include <apt-front/cache/cache.h>
-#include <apt-front/cache/component/debtags.h>
+#include <apt-front/cache/component/packagetags.h>
+#include <apt-front/cache/component/tags.h>
+#include <apt-front/cache/component/debtags/expression.h>
+#include <apt-front/cache/component/debtags/update.h>
+#include <apt-front/cache/entity/tag.h>
+#include <apt-front/utils/paths.h>
 
 #include <tagcoll/StdioParserInput.h>
 #include <tagcoll/TextFormat.h>
@@ -37,13 +42,11 @@
 #include <tagcoll/InputMerger.h>
 #include <tagcoll/ItemGrouper.h>
 
-#include <debtags/Filters.h>
-#include <debtags/Paths.h>
-#include <debtags/Update.h>
-#include <debtags/Expression.h>
+//#include <debtags/Filters.h>
 
 #include "Environment.h"
 #include "CommandlineParser.h"
+#include "Filters.h"
 #include "acqprogress.h"
 
 #include <apt-pkg/configuration.h>
@@ -85,10 +88,11 @@
 using namespace std;
 using namespace aptFront;
 using namespace aptFront::cache;
-using namespace Debtags;
+using namespace aptFront::cache::entity;
+using namespace aptFront::cache::component;
 using namespace Tagcoll;
 
-component::Tags& debtagsInit(bool write = false)
+component::PackageTags& debtagsInit(bool write = false)
 {
 	    aptFront::init();
 
@@ -97,12 +101,14 @@
 			cache::Global::get().open(
 					  Cache::OpenDefault
 					| Cache::OpenReadOnly
+					| Cache::OpenTags
 					| Cache::OpenDebtags
 					| Cache::OpenDebtagsEditable);
 		else
 			cache::Global::get().open(
 					  Cache::OpenDefault
 					| Cache::OpenReadOnly
+					| Cache::OpenTags
 					| Cache::OpenDebtags);
 
 		return Global::get().debtags();
@@ -119,7 +125,7 @@
 
 void wantTagDatabase() throw ()
 {
-	if (!Debtags::Tags<entity::Package>::hasTagDatabase())
+	if (!component::PackageTags::hasTagDatabase())
 		fatal_error(
 				"The tag database has not yet been generated: you need to run \"debtags update\" (as root) before using the package tags\n");
 }
@@ -165,7 +171,6 @@
 	}
 }
 
-template<typename T>
 class SubstringTagMatcher
 {
 protected:
@@ -174,20 +179,36 @@
 public:
 	void add(const std::string& pattern) { patterns.push_back(pattern); }
 	
-	bool operator()(const T& item)
+	bool operator()(const Facet& item)
 	{
 		for (vector<string>::const_iterator i = patterns.begin();
 				i != patterns.end(); i++)
 		{
 			if (strcasestr(item.name().c_str(), i->c_str()))
 				return true;
-			if (strcasestr(item.sdesc().c_str(), i->c_str()))
+			if (strcasestr(item.shortDescription().c_str(), i->c_str()))
 				return true;
-			if (strcasestr(item.ldesc().c_str(), i->c_str()))
+			if (strcasestr(item.longDescription().c_str(), i->c_str()))
 				return true;
 		}
 		return false;
 	}
+	bool operator()(const Tag& item)
+	{
+		cerr << "Testing: " << item.fullname() << endl;
+		for (vector<string>::const_iterator i = patterns.begin();
+				i != patterns.end(); i++)
+		{
+			if (strcasestr(item.fullname().c_str(), i->c_str()))
+				return true;
+			if (strcasestr(item.shortDescription().c_str(), i->c_str()))
+				return true;
+			if (strcasestr(item.longDescription().c_str(), i->c_str()))
+				return true;
+		}
+		cerr << "  not passed." << endl;
+		return false;
+	}
 };
 
 // Catch the tags for a given item
@@ -229,7 +250,7 @@
 class TagcollChecker : public Tagcoll::Consumer<string, string>
 {
 protected:
-	const Debtags::Vocabulary& voc;
+	const component::Tags& voc;
 	int missing_count;
 	map<string, int> missing;
 	unsigned int mtag_width;
@@ -268,8 +289,8 @@
 	}
 	
 public:
-	TagcollChecker(const Debtags::Vocabulary& voc)
-		: voc(voc), missing_count(0), mtag_width(0), max_missing(0) {}
+	TagcollChecker()
+		: voc(Global::get().tags()), missing_count(0), mtag_width(0), max_missing(0) {}
 	virtual ~TagcollChecker() {}
 
 	// Get the number of times a bad tag has been found in input
@@ -303,7 +324,7 @@
 };
 
 // Score tags by how many installed packages are there with them
-class TagsScorer : public map<Tag, int>, public Tagcoll::Consumer<entity::Package, Tag>
+class TagsScorer : public map<entity::Tag, int>, public Tagcoll::Consumer<entity::Package, entity::Tag>
 {
 protected:
 	Expression ignore;
@@ -311,7 +332,7 @@
 	virtual void consumeItemUntagged( const entity::Package& ) {}
 	virtual void consumeItemsUntagged( const OpSet<entity::Package>& ) {}
 
-	virtual void consumeItem(const entity::Package& item, const OpSet<Tag>& tags)
+	virtual void consumeItem(const entity::Package& item, const OpSet<entity::Tag>& tags)
 	{
 		if (item.isInstalled() || item.isUpgradable() || item.isBroken())
 			for (OpSet<Tag>::const_iterator i = tags.begin(); i != tags.end(); i++)
@@ -333,7 +354,7 @@
 	TagsScorer() : ignore("special::not-yet-tagged*") {}
 	virtual ~TagsScorer() {}
 
-	int score(const Tag& tag) const
+	int score(const entity::Tag& tag) const
 	{
 		const_iterator i = find(tag);
 		if (i == end())
@@ -670,7 +691,7 @@
 class ReportMaker
 {
 protected:
-	component::Tags& debtags;
+	component::PackageTags& debtags;
 	OpSet<entity::Package> mentionedPackages;
 	unsigned int itemsPerGroup;
 
@@ -733,7 +754,7 @@
 
 		CardinalityStore<entity::Package, Facet> coll;
 		TagToFacet<entity::Package> tagStripper(coll);
-		debtags.tagdb().outputPatched(tagStripper);
+		debtags.outputPatched(tagStripper);
 		Facet f;
 		SmartHierarchyNode<entity::Package, Facet> node(f, coll, 0);
 
@@ -778,7 +799,7 @@
 		out(".. _"); out(expr); out(":\n\n");
 		out(descr);
 		ExprCollector<entity::Package> miss(expr);
-		debtags.tagdb().outputPatched(miss);
+		debtags.outputPatched(miss);
 		listSuspects(miss);
 	}
 
@@ -870,16 +891,29 @@
 
 static void printShortVocabularyItem(const Facet& facet)
 {
-	printf("%.*s (facet) - %.*s\n", PFSTR(facet.name()), PFSTR(facet.sdesc()));
+	cout << facet.name() << " (facet) - " << facet.shortDescription() << endl;
 }
 
 static void printShortVocabularyItem(const Tag& tag)
 {
-	printf("%.*s - %.*s\n", PFSTR(tag.fullname()), PFSTR(tag.sdesc()));
+	cout << tag.fullname() << " - " << tag.shortDescription() << endl;
 }
 
+static void printVocabularyItem(const Facet& tag)
+{
+	cout << "Tag: " << tag.name() << endl;
+	cout << "Description: " << tag.shortDescription() << endl;
+	cout << " " << tag.longDescription() << endl;
+	cout << endl;
+}
 static void printVocabularyItem(const Tag& tag)
 {
+	cout << "Tag: " << tag.fullname() << endl;
+	cout << "Description: " << tag.shortDescription() << endl;
+	cout << " " << tag.longDescription() << endl;
+	cout << endl;
+
+	/*
 	string buf = tag.fulldata();
 	
 	// Count the end of lines at the end of the buffer
@@ -889,6 +923,7 @@
 	fwrite(buf.data(), buf.size() - nnl, 1, stdout);
 	fputc('\n', stdout);
 	fputc('\n', stdout);
+	*/
 }
 
 #if 0
@@ -930,14 +965,14 @@
 
 
 template<class ITEM, class TAG>
-int outputGrepped(component::Tags& debtags, const string& expression, bool invertMatch, Tagcoll::Consumer<ITEM, TAG>& cons)
+int outputGrepped(component::PackageTags& debtags, const string& expression, bool invertMatch, Tagcoll::Consumer<ITEM, TAG>& cons)
 {
 	// Build the grep filter chain
 	FilterItemsByExpression<ITEM, TAG> filter(cons, expression);
 	if (invertMatch)
 		filter.setMatchType(FilterItemsByExpression<ITEM, TAG>::INVERTED);
 
-	debtags.tagdb().outputPatched(filter);
+	debtags.outputPatched(filter);
 
 	return filter.countMatched();
 }
@@ -1064,7 +1099,7 @@
 	}
 };
 
-enum valid_command { UPDATE, CHECK, TAGSHOW, TAGSEARCH, SHOW, RELATED, CAT, SEARCH, GREP, INSTALL, MKPATCH, MAINTAINERS, TAG, SUBMIT, TODO, SCORE, FACETCOLL, STATS, TODOREPORT };
+enum valid_command { UPDATE, CHECK, TAGSHOW, TAGSEARCH, TAGCAT, SHOW, RELATED, CAT, SEARCH, GREP, INSTALL, MKPATCH, MAINTAINERS, TAG, SUBMIT, TODO, SCORE, FACETCOLL, STATS, TODOREPORT };
 
 int main(int argc, const char* argv[])
 {
@@ -1079,6 +1114,7 @@
 				"  check <file>	 Check that all the tags in the given tagged collection are present\n"
 				"                in the tag vocabulary.  Checks the main database if no file is\n"
 				"                specified\n"
+				"  tagcat <tag>	 Output the tag vocabulary\n"
 				"  tagshow <tag> Show the vocabulary informations about a tag\n"
 				"  tagsearch <string [string [string [...]]]>\n"
 				"                Show a summary of all tags whose data contains the given strings\n"
@@ -1134,6 +1170,7 @@
 
 		opts.addCommand("update", (int)UPDATE);
 		opts.addCommand("check", (int)CHECK);
+		opts.addCommand("tagcat", (int)TAGCAT);
 		opts.addCommand("tagshow", (int)TAGSHOW);
 		opts.addCommand("tagsearch", (int)TAGSEARCH);
 		opts.addCommand("show", (int)SHOW);
@@ -1174,7 +1211,7 @@
 			// Output the full package tag database
 			case CAT:
 			{
-				component::Tags& debtags = debtagsInit();
+				component::PackageTags& debtags = debtagsInit();
 				wantTagDatabase();
 
 				Converter<entity::Package, string> fromitem;
@@ -1183,10 +1220,10 @@
 				if (opts.get("groupitems").defined())
 				{
 					ItemGrouper<entity::Package, Tag> grouper;
-					debtags.tagdb().outputPatched(grouper);
+					debtags.outputPatched(grouper);
 					grouper.output(writer);
 				} else
-					debtags.tagdb().outputPatched(writer);
+					debtags.outputPatched(writer);
 				/*
 				TextFormat<Package, Tag> writer(Debtags::Environment::get().serializer(), stdout);
 				if (opts.get("groupitems").defined())
@@ -1206,7 +1243,7 @@
 			// the given tag expression\n"
 			case SEARCH:
 			{
-				component::Tags& debtags = debtagsInit();
+				component::PackageTags& debtags = debtagsInit();
 				wantTagDatabase();
 
 				string expression = args.next();
@@ -1225,7 +1262,7 @@
 			// given tag expression
 			case GREP:
 			{
-				component::Tags& debtags = debtagsInit();
+				component::PackageTags& debtags = debtagsInit();
 				wantTagDatabase();
 
 				string expression = args.next();
@@ -1252,7 +1289,7 @@
 			// apt-get install the packages that match the given tag expression
 			case INSTALL:
 			{
-				component::Tags& debtags = debtagsInit();
+				component::PackageTags& debtags = debtagsInit();
 				wantTagDatabase();
 
 				string expression = args.next();
@@ -1273,16 +1310,37 @@
 				throw SystemException(errno, "Running apt-get");
 			}
 
+			// tagcat
+			// Output the entire tag vocabulary
+			case TAGCAT:
+			{
+				debtagsInit();
+				wantTagDatabase();
+
+				component::Tags& voc = Global::get().tags();
+
+				OpSet<Facet> facets = voc.facets();
+				for (OpSet<Facet>::const_iterator i = facets.begin();
+						i != facets.end(); i++)
+				{
+					printVocabularyItem(*i);
+
+					OpSet<Tag> tags = i->tags();
+					for (OpSet<Tag>::const_iterator j = tags.begin();
+							j != tags.end(); j++)
+						printVocabularyItem(*j);
+				}
+				return 0;
+			}
 			// tagshow <tag>
-			// Show the vocabulary informations about a tag\n"
+			// Show the vocabulary informations about a tag
 			case TAGSHOW:
 			{
-				component::Tags& debtags = debtagsInit();
+				debtagsInit();
 				wantTagDatabase();
 				string tag = args.next();
 
-				const Debtags::Vocabulary& voc = debtags.vocabulary();
-				Tag t = voc.getTag(tag);
+				Tag t = Global::get().tags().tagByName(tag);
 				if (!t)
 				{
 					verbose("Tag `%.*s' was not found in tag vocabulary\n", PFSTR(tag));
@@ -1298,19 +1356,17 @@
 			// Show a summary of all tags matching the given patterns
 			case TAGSEARCH:
 			{
-				component::Tags& debtags = debtagsInit();
+				debtagsInit();
 				wantTagDatabase();
 
-				SubstringTagMatcher<Facet> matchFacet;
-				SubstringTagMatcher<Tag> matchTag;
+				SubstringTagMatcher match;
 				
 				// Get the patterns to be matched
 				bool empty;
 				while (args.hasNext())
 				{
 					string pattern = args.next();
-					matchFacet.add(pattern);
-					matchTag.add(pattern);
+					match.add(pattern);
 					empty = false;
 				}
 
@@ -1320,15 +1376,15 @@
 					return 1;
 				}
 
-				const Debtags::Vocabulary& voc = debtags.vocabulary();
+				component::Tags& voc = Global::get().tags();
 
 				int matched = 0;
 
-				OpSet<Facet> facets = voc.getFacets();
+				OpSet<Facet> facets = voc.facets();
 				for (OpSet<Facet>::const_iterator i = facets.begin();
 						i != facets.end(); i++)
 				{
-					if (matchFacet(*i))
+					if (match(*i))
 					{
 						matched++;
 						printShortVocabularyItem(*i);
@@ -1337,7 +1393,7 @@
 					OpSet<Tag> tags = i->tags();
 					for (OpSet<Tag>::const_iterator j = tags.begin();
 							j != tags.end(); j++)
-						if (matchTag(*j))
+						if (match(*j))
 						{
 							matched++;
 							printShortVocabularyItem(*j);
@@ -1350,7 +1406,7 @@
 			// Call apt-cache show <pkg>, but add tag informations to the output.\n"
 			case SHOW:
 			{
-				component::Tags& debtags = debtagsInit();
+				component::PackageTags& debtags = debtagsInit();
 				wantTagDatabase();
 
 				while (args.hasNext())
@@ -1381,9 +1437,7 @@
 			// Show packages related to the specified ones
 			case RELATED:
 			{
-				using namespace Debtags;
-
-				component::Tags& debtags = debtagsInit();
+				component::PackageTags& debtags = debtagsInit();
 				wantTagDatabase();
 
 				int maxdist = 0;
@@ -1455,18 +1509,16 @@
 			// file is specified
 			case CHECK:
 			{
-				component::Tags& debtags = debtagsInit();
+				debtagsInit();
 				wantTagDatabase();
 
 				string file;
 				if (args.hasNext())
 					file = args.next();
 				else
-					file = Path::tagdb();
-
-				const Debtags::Vocabulary& voc = debtags.vocabulary();
+					file = utils::Path::tagdb();
 
-				TagcollChecker checker(voc);
+				TagcollChecker checker;
 				readCollection(file, checker);
 
 				if (checker.missingCount() > 0)
@@ -1493,7 +1545,7 @@
 
 				AcqTextStatus Stat(ScreenWidth,_config->FindI("quiet",0));
 				//Debtags::Environment::get().updateDebtagsDatabase(&Stat);
-				Debtags::updateDatabase(&Stat);
+				debtags::updateDatabase(&Stat);
 				feedback("Done.\n");
 				break;
 			}
@@ -1502,14 +1554,14 @@
 			// collection [filename]
 			case MKPATCH:
 			{
-				component::Tags& debtags = debtagsInit();
+				component::PackageTags& debtags = debtagsInit();
 				wantTagDatabase();
 
 				string file = args.next();
 
 				InputMerger<entity::Package, Tag> coll;
-				Converter<string, entity::Package> toitem;
-				Converter<string, Tag> totag(debtags.vocabulary());
+				Converter<string, Package> toitem;
+				Converter<string, Tag> totag;
 				readCollection(toitem, totag, file, coll);
 
 				PatchList<entity::Package, Tag> newpatches;
@@ -1525,7 +1577,7 @@
 			// packages they maintain
 			case MAINTAINERS:
 			{
-				component::Tags& debtags = debtagsInit();
+				debtagsInit();
 				wantTagDatabase();
 
 				// Gather maintainer informations
@@ -1549,13 +1601,11 @@
 			//                View and edit the tags for a package\n");
 			case TAG:
 			{
-				using namespace Debtags;
-
 				std::string cmd = args.next();
 
 				if (cmd == "add" || cmd == "rm")
 				{
-					component::Tags& debtags = debtagsInit(true);
+					component::PackageTags& debtags = debtagsInit(true);
 					wantTagDatabase();
 
 					string name = args.next();
@@ -1572,7 +1622,7 @@
 					while (args.hasNext())
 					{
 						string tag = args.next();
-						Tag t = debtags.vocabulary().getTag(tag);
+						Tag t = Global::get().tags().tagByName(tag);
 						if (t)
 							tagset += t;
 						else
@@ -1587,13 +1637,13 @@
 						else
 							change.addPatch(Patch<entity::Package, Tag>(pkg, OpSet<Tag>(), tagset));
 						debtags.tagdb().applyChange(change);
-						debtags.tagdb().savePatch();
+						debtags.savePatch();
 					} else
 						verbose("No tags to add\n");
 				}
 				else if (cmd == "ls")
 				{
-					component::Tags& debtags = debtagsInit();
+					component::PackageTags& debtags = debtagsInit();
 					wantTagDatabase();
 
 					string name = args.next();
@@ -1619,20 +1669,20 @@
 			// repository
 			case SUBMIT:
 			{
-				component::Tags& debtags = debtagsInit();
+				component::PackageTags& debtags = debtagsInit();
 				wantTagDatabase();
 
 				if (args.hasNext())
 				{
 					StdioParserInput in(args.next());
-					Converter<string, entity::Package> toitem;
-					Converter<string, Tag> totag(debtags.vocabulary());
+					Converter<string, Package> toitem;
+					Converter<string, Tag> totag;
 					PatchList<entity::Package, Tag> patch =
 							TextFormat<entity::Package, Tag>::parsePatch(toitem, totag, in);
-					debtags.tagdb().sendPatch(patch);
+					debtags.sendPatch(patch);
 				}
 				else
-					debtags.tagdb().sendPatch();
+					debtags.sendPatch();
 
 				break;
 			}
@@ -1640,7 +1690,7 @@
 			// Print a list of the installed packages that are not yet tagged
 			case TODO:
 			{
-				component::Tags& debtags = debtagsInit();
+				component::PackageTags& debtags = debtagsInit();
 				wantTagDatabase();
 
 				// Write the package names to stdout
@@ -1649,7 +1699,7 @@
 				// Filter to select the right packages
 				TODOFilter filter(writer);
 
-				debtags.tagdb().outputPatched(filter);
+				debtags.outputPatched(filter);
 
 				break;
 			}
@@ -1658,16 +1708,16 @@
 			// appear in the packages that are installed already
 			case SCORE:
 			{
-				component::Tags& debtags = debtagsInit();
+				component::PackageTags& debtags = debtagsInit();
 				wantTagDatabase();
 
 				// Compute tag scores
 				TagsScorer tscorer;
-				debtags.tagdb().outputPatched(tscorer);
+				debtags.outputPatched(tscorer);
 
 				// Compute package scores
 				PackageScorer pscorer(tscorer);
-				debtags.tagdb().outputPatched(pscorer);
+				debtags.outputPatched(pscorer);
 
 				// Print the results
 				for (PackageScorer::const_iterator i = pscorer.begin();
@@ -1681,39 +1731,39 @@
 			// its facets only
 			case FACETCOLL:
 			{
-				component::Tags& debtags = debtagsInit();
+				component::PackageTags& debtags = debtagsInit();
 				wantTagDatabase();
 
 				FacetcollPrinter<entity::Package> printer;
 				TagToFacet<entity::Package> tagToFacet(printer);
-				debtags.tagdb().outputPatched(tagToFacet);
+				debtags.outputPatched(tagToFacet);
 				break;
 			}
 			// stats
 			// Print statistics about Debtags
 			case STATS:
 			{
-				component::Tags& debtags = debtagsInit();
+				component::PackageTags& debtags = debtagsInit();
 				wantTagDatabase();
 
 				int pkgCount = Global::get().packages().packageCount();
 				printf("Total count of packages: %d\n", pkgCount);
 
 				StatsCollector stats;
-				debtags.tagdb().outputPatched(stats);
+				debtags.outputPatched(stats);
 
 				printf("Total count of packages (according to APT): %d\n", pkgCount);
 				printf("Total count of packages (according to Debtags): %d\n", stats.get_seen());
 
-				const Debtags::Vocabulary& voc = debtags.vocabulary();
-				printf("Number of facets: %d\n", voc.getFacets().size());
-				printf("Number of tags: %d\n", voc.getTags().size());
+				const component::Tags& voc = Global::get().tags();
+				printf("Number of facets: %d\n", voc.facets().size());
+				printf("Number of tags: %d\n", voc.tags().size());
 
 				// Copied from Debtags class: compute the toplevel facets
 				// TODO: use Debtags instead of Environment throughout all Debtags
 				CardinalityStore<entity::Package, Facet> coll;
 				TagToFacet<entity::Package> tagStripper(coll);
-				debtags.tagdb().outputPatched(tagStripper);
+				debtags.outputPatched(tagStripper);
 				Facet f;
 				SmartHierarchyNode<entity::Package, Facet> node(f, coll, 0);
 				printf("Number of automatically computed toplevel facets: %d\n", node.size());
@@ -1735,7 +1785,7 @@
 			// Print a report of packages needing work
 			case TODOREPORT:
 			{
-				component::Tags& debtags = debtagsInit();
+				debtagsInit();
 				wantTagDatabase();
 
 				unsigned int itemsPerGroup = 0;

Modified: debtags/trunk/tools/instantiations.cc
==============================================================================
--- debtags/trunk/tools/instantiations.cc	(original)
+++ debtags/trunk/tools/instantiations.cc	Thu Sep  8 23:26:02 2005
@@ -1,16 +1,20 @@
 #define INSTANTIATING_TEMPLATES
 
 #include <apt-front/cache/entity/package.h>
-#include <debtags/Tag.h>
+#include <apt-front/cache/entity/tag.h>
 
+#include <tagcoll/InputMerger.cc>
 #include <tagcoll/CardinalityStore.cc>
 #include <tagcoll/SmartHierarchy.cc>
 
+#include <string>
+
 // Instantiate needed templates
 
 using namespace aptFront::cache;
 
-template class CardinalityStore<entity::Package, Debtags::Facet>;
-template class SmartHierarchyNode<entity::Package, Debtags::Facet>;
+template class InputMerger<std::string, entity::Tag>;
+template class CardinalityStore<entity::Package, entity::Facet>;
+template class SmartHierarchyNode<entity::Package, entity::Facet>;
 
 // vim:set ts=4 sw=4:



More information about the Debtags-commits mailing list