[Debtags-commits] [svn] r1607 - in debtags/trunk: . tools
Enrico Zini
enrico at costa.debian.org
Wed Feb 22 13:44:53 UTC 2006
Author: enrico
Date: Wed Feb 22 13:44:51 2006
New Revision: 1607
Modified:
debtags/trunk/ (props changed)
debtags/trunk/tools/debtags.cc
Log:
r7448 at viaza: enrico | 2006-02-22 14:41:25 +0100
Added 'selfcheck' command to host all sorts of sanity checks
Modified: debtags/trunk/tools/debtags.cc
==============================================================================
--- debtags/trunk/tools/debtags.cc (original)
+++ debtags/trunk/tools/debtags.cc Wed Feb 22 13:44:51 2006
@@ -66,6 +66,10 @@
using namespace aptFront::cache::component::debtags;
using namespace Tagcoll;
+typedef OpSet<entity::Tag> TagSet;
+typedef OpSet<entity::Facet> FacetSet;
+typedef OpSet<entity::Package> PackageSet;
+
template<typename TAG, typename _Traits>
basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& out, const Tagcoll::OpSet<TAG>& tags)
{
@@ -1176,7 +1180,7 @@
}
};
-enum valid_command { UPDATE, CHECK, TAGSHOW, TAGSEARCH, TAGCAT, SHOW, RELATED, CAT, SEARCH, GREP, INSTALL, MKPATCH, MAINTAINERS, TAG, SUBMIT, TODO, SCORE, FACETCOLL, STATS, TODOREPORT, SMARTSEARCH };
+enum valid_command { UPDATE, SELFCHECK, CHECK, TAGSHOW, TAGSEARCH, TAGCAT, SHOW, RELATED, CAT, SEARCH, GREP, INSTALL, MKPATCH, MAINTAINERS, TAG, SUBMIT, TODO, SCORE, FACETCOLL, STATS, TODOREPORT, SMARTSEARCH };
int main(int argc, const char* argv[])
{
@@ -1188,6 +1192,7 @@
"Commandline interface to access and manipulate Debian Package Tags.\n\n"
"Commands are:\n"
" update Updates the package tag database (requires root)\n"
+ " selfcheck Perform a series of internal self checks using the current tag data\n"
" 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"
@@ -1254,6 +1259,7 @@
opts.addCommand("update", (int)UPDATE);
opts.addCommand("check", (int)CHECK);
+ opts.addCommand("selfcheck", (int)SELFCHECK);
opts.addCommand("tagcat", (int)TAGCAT);
opts.addCommand("tagshow", (int)TAGSHOW);
opts.addCommand("tagsearch", (int)TAGSEARCH);
@@ -1293,6 +1299,33 @@
// Perform the correct operation
switch (cmd)
{
+ case SELFCHECK:
+ {
+ debtagsInit();
+ component::Tags& voc = Global::get().tags();
+
+ // ensure that all facets are readable
+ FacetSet facets = voc.facets();
+ for (FacetSet::const_iterator i = facets.begin(); i != facets.end(); i++)
+ {
+ i->name(string("foo"));
+ i->shortDescription(string("foo"));
+ i->longDescription(string("foo"));
+ i->tags();
+ }
+
+ // ensure that all tags are readable
+ TagSet tags = voc.tags();
+ for (TagSet::const_iterator i = tags.begin(); i != tags.end(); i++)
+ {
+ i->name(string("foo"));
+ i->fullname(string("foo"));
+ i->shortDescription(string("foo"));
+ i->longDescription(string("foo"));
+ }
+
+ return 0;
+ }
// Output the full package tag database
case CAT:
{
More information about the Debtags-commits
mailing list