Package: aptitude Version: 0.6.1.5-3 Severity: wishlist Tags: patch Hello,
I am preparing a new version of libept after quite aggressively simplifying its code. The long term plan is #540218, although it seems that libept does have a reason to exist, to for example have debtags parsing code, or provide pointers to where the Xapian index is found. I'm now testing its reverse dependencies to see how the libept changes impact their code and functions. I'm posting here, for reference, the patch needed to make aptitude work with the version of libept I just committed to the libept git repo at http://git.debian.org/?p=debtags/libept.git;a=summary There is no functionality loss, just the code got quite a bit simpler. Porting was straightforward except for pkg_grouppolicy.cc, where I had to comment out the code that I'd like to use: #ifdef HAVE_EPT - string desc(f.longDescription()); - string shortdesc(f.shortDescription()); + // FIXME const ept::debtags::voc::FacetData* fd = vocabulary.facetData(f); + string desc(/* FIXME fd ? fd->longDescription() : */ "long description not available") + string shortdesc(/* FIXME fd ? fd->shortDescription() : */ f); #else // HAVE_EPT In this new libept, the Facet and Tag classes have been dropped in favour of simple strings. To get data about facets and tags, one uses an ept::debtags::Vocabulary object, which on startup parses the Debtags vocabulary and indexes it in RAM. In order to make that code work I'd need to include ept/debtags/vocabulary.h and to access an ept::debtags::Vocabulary object. It's a trivial change, but a change that's best done by someone who knows the aptitude code and its stile of #ifdefs / management of long lived objects. There might be another patch posted here as I intend to do a bit of chopping also on the ept::textsearch code. In the meantime, this should give an idea of what I'm up to. Ciao, Enrico -- Package-specific info: aptitude 0.6.1.5 compiled at Mar 12 2010 18:48:34 Compiler: g++ 4.4.3 Compiled against: apt version 4.8.0 NCurses version 5.7 libsigc++ version: 2.2.4.2 Ept support enabled. Gtk+ support disabled. Current library versions: NCurses version: ncurses 5.7.20100313 cwidget version: 0.5.16 Apt version: 4.8.0 linux-vdso.so.1 => (0x00007fff771ff000) libapt-pkg-libc6.9-6.so.4.8 => /usr/lib/libapt-pkg-libc6.9-6.so.4.8 (0x00007f47cccb1000) libncursesw.so.5 => /lib/libncursesw.so.5 (0x00007f47cca5e000) liblog4cxx.so.10 => /usr/lib/liblog4cxx.so.10 (0x00007f47cc670000) libsigc-2.0.so.0 => /usr/lib/libsigc-2.0.so.0 (0x00007f47cc46b000) libcwidget.so.3 => /usr/lib/libcwidget.so.3 (0x00007f47cc19f000) libept.so.0 => /usr/lib/libept.so.0 (0x00007f47cbf27000) libxapian.so.15 => /usr/lib/libxapian.so.15 (0x00007f47cbbd4000) libz.so.1 => /usr/lib/libz.so.1 (0x00007f47cb9bd000) libsqlite3.so.0 => /usr/lib/libsqlite3.so.0 (0x00007f47cb72c000) libboost_iostreams.so.1.40.0 => /usr/lib/libboost_iostreams.so.1.40.0 (0x00007f47cb521000) libpthread.so.0 => /lib/libpthread.so.0 (0x00007f47cb305000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f47caff4000) libm.so.6 => /lib/libm.so.6 (0x00007f47cad72000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f47cab5c000) libc.so.6 => /lib/libc.so.6 (0x00007f47ca807000) libutil.so.1 => /lib/libutil.so.1 (0x00007f47ca604000) libdl.so.2 => /lib/libdl.so.2 (0x00007f47ca400000) libaprutil-1.so.0 => /usr/lib/libaprutil-1.so.0 (0x00007f47ca1dc000) libdb-4.8.so => /usr/lib/libdb-4.8.so (0x00007f47c9e62000) libapr-1.so.0 => /usr/lib/libapr-1.so.0 (0x00007f47c9c2a000) libbz2.so.1.0 => /lib/libbz2.so.1.0 (0x00007f47c9a19000) librt.so.1 => /lib/librt.so.1 (0x00007f47c9811000) /lib64/ld-linux-x86-64.so.2 (0x00007f47ccf9c000) libuuid.so.1 => /lib/libuuid.so.1 (0x00007f47c960c000) libcrypt.so.1 => /lib/libcrypt.so.1 (0x00007f47c93d5000) libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007f47c91ad000) Terminal: xterm $DISPLAY is set. `which aptitude`: /usr/bin/aptitude aptitude version information: aptitude linkage: -- System Information: Debian Release: squeeze/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 2.6.32-trunk-amd64 (SMP w/2 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages aptitude depends on: ii apt [libapt-pkg-libc6.9 0.7.25.3 Advanced front-end for dpkg ii libboost-iostreams1.40. 1.40.0-6+b1 Boost.Iostreams Library ii libc6 2.10.2-6 Embedded GNU C Library: Shared lib ii libcwidget3 0.5.16-3 high-level terminal interface libr ii libept0 0.5.30 High-level library for managing De ii libgcc1 1:4.4.2-9 GCC support library ii liblog4cxx10 0.10.0-1.1 A logging library for C++ ii libncursesw5 5.7+20100313-2 shared libraries for terminal hand ii libsigc++-2.0-0c2a 2.2.4.2-1 type-safe Signal Framework for C++ ii libsqlite3-0 3.6.23.1-1 SQLite 3 shared library ii libstdc++6 4.4.2-9 The GNU Standard C++ Library v3 ii libxapian15 1.0.19-1 Search engine library ii zlib1g 1:1.2.3.4.dfsg-3 compression library - runtime Versions of packages aptitude recommends: ii apt-xapian-index 0.30 maintenance tools for a Xapian ind ii aptitude-doc-en [aptitude-doc 0.6.1.5-3 English manual for aptitude, a ter ii libparse-debianchangelog-perl 1.1.1-2 parse Debian changelogs and output ii sensible-utils 0.0.4 Utilities for sensible alternative Versions of packages aptitude suggests: ii debtags 1.7.10 Enables support for package tags pn tasksel <none> (no description available) -- no debconf information
diff --git a/src/desc_render.cc b/src/desc_render.cc index 0b0b0ef..647ec75 100644 --- a/src/desc_render.cc +++ b/src/desc_render.cc @@ -104,7 +104,7 @@ cw::fragment *make_tags_fragment(const pkgCache::PkgIterator &pkg) return NULL; #ifdef HAVE_EPT - typedef ept::debtags::Tag tag; + typedef std::string tag; using aptitude::apt::get_tags; #endif @@ -122,7 +122,7 @@ cw::fragment *make_tags_fragment(const pkgCache::PkgIterator &pkg) for(set<tag>::const_iterator i = s->begin(); i != s->end(); ++i) { #ifdef HAVE_EPT - std::string name(i->fullname()); + std::string name(*i); #else const std::string name(i->str()); #endif diff --git a/src/generic/apt/matching/match.cc b/src/generic/apt/matching/match.cc index f9febf5..300a842 100644 --- a/src/generic/apt/matching/match.cc +++ b/src/generic/apt/matching/match.cc @@ -1373,7 +1373,7 @@ namespace aptitude pkgCache::PkgIterator pkg(target.get_package_iterator(cache)); #ifdef HAVE_EPT - typedef ept::debtags::Tag tag; + typedef std::string tag; using aptitude::apt::get_tags; #endif @@ -1390,7 +1390,7 @@ namespace aptitude for(std::set<tag>::const_iterator i=tags->begin(); i!=tags->end(); ++i) { #ifdef HAVE_EPT - std::string name(i->fullname()); + std::string name(*i); #else const std::string name = i->str().c_str(); #endif diff --git a/src/generic/apt/tags.cc b/src/generic/apt/tags.cc index 36de6bc..3e19671 100644 --- a/src/generic/apt/tags.cc +++ b/src/generic/apt/tags.cc @@ -39,6 +39,8 @@ #include <apt-pkg/pkgrecords.h> #include <apt-pkg/tagfile.h> +#include <ept/debtags/debtags.h> + #include <cwidget/generic/util/eassert.h> using namespace std; @@ -350,10 +352,10 @@ namespace aptitude } } - const std::set<ept::debtags::Tag> get_tags(const pkgCache::PkgIterator &pkg) + const std::set<std::string> get_tags(const pkgCache::PkgIterator &pkg) { if(!apt_cache_file || !debtagsDB) - return std::set<ept::debtags::Tag>(); + return std::set<std::string>(); // TODO: handle !hasData() here. try @@ -362,7 +364,7 @@ namespace aptitude } catch(std::exception &ex) { - return std::set<ept::debtags::Tag>(); + return std::set<std::string>(); } } } diff --git a/src/generic/apt/tags.h b/src/generic/apt/tags.h index 2b8a36e..40411cd 100644 --- a/src/generic/apt/tags.h +++ b/src/generic/apt/tags.h @@ -225,15 +225,13 @@ std::string tag_description(const std::string &tag); #include <apt-pkg/pkgcache.h> -#include <ept/debtags/debtags.h> - #include <set> namespace aptitude { namespace apt { - const std::set<ept::debtags::Tag> get_tags(const pkgCache::PkgIterator &pkg); + const std::set<std::string> get_tags(const pkgCache::PkgIterator &pkg); /** \brief Initialize the cache of debtags information. */ void load_tags(); diff --git a/src/gtk/gui.cc b/src/gtk/gui.cc index cb450b1..2e338c6 100644 --- a/src/gtk/gui.cc +++ b/src/gtk/gui.cc @@ -1272,7 +1272,7 @@ namespace gui return where; #ifdef HAVE_EPT - typedef ept::debtags::Tag tag; + typedef std::string tag; using aptitude::apt::get_tags; const std::set<tag> realS(get_tags(pkg)); @@ -1292,7 +1292,7 @@ namespace gui it != s->end(); ++it) { #ifdef HAVE_EPT - const std::string name(it->fullname()); + const std::string name(*it); #else const std::string name(it->str()); #endif diff --git a/src/pkg_grouppolicy.cc b/src/pkg_grouppolicy.cc index 93d6538..46fcda5 100644 --- a/src/pkg_grouppolicy.cc +++ b/src/pkg_grouppolicy.cc @@ -1350,7 +1350,7 @@ public: pkg_subtree *root) { #ifdef HAVE_EPT - typedef ept::debtags::Tag tag; + typedef std::string tag; using aptitude::apt::get_tags; #endif @@ -1368,18 +1368,22 @@ public: ti != tags->end(); ++ti) { #ifdef HAVE_EPT - const ept::debtags::Facet f = ti->facet(); - - const std::string thisfacet(f.name()); + size_t fpos = ti->find("::"); + std::string f; + if (fpos == string::npos) + f = "legacy"; + else + f = ti->substr(0, fpos); + + const std::string thisfacet(f); // Don't create items for tags that aren't in our facet. - if(f.name() != facet) + if(f != facet) return; // TODO: split up by sub-facet or whatever the debtags guys // call it? - std::string tagname; - ti->name(tagname); + std::string tagname = *ti; #else // HAVE_EPT tag::const_iterator j = ti->begin(); @@ -1407,11 +1411,9 @@ public: if(found == children.end()) { #ifdef HAVE_EPT - std::string desc; - ti->longDescription(desc); - - std::string shortdesc; - ti->shortDescription(shortdesc); + // FIXME: const ept::debtags::voc::TagData* td = vocabulary.tagData(*ti); + std::string desc = /* FIXME td ? td->longDescription() : */ "description not available"; + std::string shortdesc = /* FIXME td ? td->shortDescription() : */ *ti; #else // HAVE_EPT string desc = tag_description(ti->str()); string shortdesc(desc, 0, desc.find('\n')); @@ -1491,7 +1493,7 @@ public: pkg_subtree *root) { #ifdef HAVE_EPT - typedef ept::debtags::Tag tag; + typedef std::string tag; using aptitude::apt::get_tags; #endif @@ -1528,9 +1530,15 @@ public: ti != tags->end(); ++ti) { #ifdef HAVE_EPT - const ept::debtags::Facet f(ti->facet()); - std::string thisfacet(f.name()); - std::string thistag(ti->name()); + size_t fpos = ti->find("::"); + std::string f; + if (fpos == string::npos) + f = "legacy"; + else + f = ti->substr(0, fpos); + + std::string thisfacet(f); + std::string thistag(*ti); #else // HAVE_EPT tag::const_iterator j = ti->begin(); @@ -1558,8 +1566,9 @@ public: if(facetfound == children.end()) { #ifdef HAVE_EPT - string desc(f.longDescription()); - string shortdesc(f.shortDescription()); + // FIXME const ept::debtags::voc::FacetData* fd = vocabulary.facetData(f); + string desc(/* FIXME fd ? fd->longDescription() : */ "long description not available"); + string shortdesc(/* FIXME fd ? fd->shortDescription() : */ f); #else // HAVE_EPT string desc = facet_description(thisfacet); string shortdesc(desc, 0, desc.find('\n')); @@ -1596,8 +1605,9 @@ public: if(tagfound == tagchildren->end()) { #ifdef HAVE_EPT - string desc(ti->longDescription()); - string shortdesc(ti->shortDescription()); + // FIXME const ept::debtags::voc::TagData* td = vocabulary.tagData(*ti); + std::string desc = /* FIXME td ? td->longDescription() : */ "description not available"; + std::string shortdesc = /* FIXME td ? td->shortDescription() : */ *ti; #else // HAVE_EPT string desc = tag_description(ti->str()); string shortdesc(desc, 0, desc.find('\n'));