Bug#526661: [aptitude]
On Wed, Nov 18, 2009 at 04:11:43PM +0100, Julian Andres Klode <jak@debian.org> was heard to say:
> On Wed, Nov 18, 2009 at 06:22:02AM -0800, Daniel Burrows wrote:
> > *bangs head on desk*
> >
> > So here's what we have. aptitude tries to avoid downloading a new
> > copy of a changelog by instead reusing one that it finds installed on
> > the system. To do this, it looks up the source package and checks
> > whether any of its binaries are installed, which requires reading in
> > apt's list of source records. You don't have any source records, so
> > the source record of the package can't be found, so aptitude won't try
> > to use a locally installed changelog (maybe instead it should check for
> > a changelog from the same binary, but it won't).
> >
> > Here's the wall-banger: the apt object representing the list of source
> > records emits the error message you're seeing *in its constructor* if
> > you don't have any source records listed in /etc/apt/sources.list. Even
> > more fun, I don't see any reasonable way (short of duplicating a bunch
> > of apt code) to replicate the test it uses exactly. I'll implement a
> > quick and dirty workaround, but this is really an apt bug IMO.
>
> I guess we could move the test code to a function and call this
> function from within the constructor. Then you could just call the
> function and go a different way if it returns false (i.e. if there are
> no deb-src entries).
Yeah, I think that would be ideal. As a workaround, I just copied
that little loop at the top of the constructor and I assume there's
a deb-src line if it succeeds:
---- cut here ----
bool source_lines_exist()
{
for (pkgSourceList::const_iterator sourceListIt =
apt_source_list->begin();
sourceListIt != apt_source_list->end();
++sourceListIt)
{
// Partly cribbed from srcrecords.cc in apt.
std::vector<pkgIndexFile *> *indexes = (*sourceListIt)->GetIndexFiles();
for (std::vector<pkgIndexFile *>::const_iterator indexesIt =
indexes->begin(); indexesIt != indexes->end(); ++indexesIt)
{
boost::scoped_ptr<pkgSrcRecords::Parser>
parser((*indexesIt)->CreateSrcParser());
if(parser.get() != NULL)
return true;
}
}
return false;
}
---- cut here ----
(sorry if the mail earlier was a little strong -- I got up much
earlier in the morning than I'm used to and that sometimes makes me
a bit cranky :P )
Daniel
Reply to: