[Aptitude-svn-commit] r3678 - in branches/aptitude-0.3/aptitude: .
src/cmdline src/generic
Daniel Burrows
dburrows at costa.debian.org
Tue Jul 26 00:00:38 UTC 2005
Author: dburrows
Date: Tue Jul 26 00:00:35 2005
New Revision: 3678
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/cmdline/cmdline_changelog.cc
branches/aptitude-0.3/aptitude/src/generic/pkg_changelog.cc
Log:
Don't unnecessarily look up the source package to get a changelog.
Allows the changelog fetcher to be used even for packages not in sources.list.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Tue Jul 26 00:00:35 2005
@@ -1,5 +1,15 @@
2005-07-25 Daniel Burrows <dburrows at debian.org>
+ * src/cmdline/cmdline_changelog.cc:
+
+ Add heuristics to guess where the changelog of a package that we
+ don't have direct information about /might/ be.
+
+ * src/generic/pkg_changelog.cc:
+
+ It's no longer necessary to look up the source package in
+ pkg_changelog_form_source, so don't.
+
* src/generic/pkg_changelog.cc:
Don't crash if an end version iterator is passed into
Modified: branches/aptitude-0.3/aptitude/src/cmdline/cmdline_changelog.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/cmdline/cmdline_changelog.cc (original)
+++ branches/aptitude-0.3/aptitude/src/cmdline/cmdline_changelog.cc Tue Jul 26 00:00:35 2005
@@ -84,6 +84,35 @@
return changelog_entity(pkg, ver, parser->Section());
}
+/** Try to find a particular package version without knowing the
+ * section that it occurs in.
+ */
+pkg_changelog *changelog_by_version(const std::string &pkg,
+ const std::string &ver)
+{
+ // Try forcing the particular version that was
+ // selected, using various sections. FIXME: relies
+ // on specialized knowledge about how get_changelog
+ // works; in particular, that it only cares whether
+ // "section" has a first component.
+
+ pkg_changelog *cl = get_changelog_from_source(pkg, ver, "",
+ gen_cmdline_download_progress(),
+ 500000, pkg);
+
+ if(!cl)
+ cl = get_changelog_from_source(pkg, ver, "contrib/foo",
+ gen_cmdline_download_progress(),
+ 500000, pkg);
+
+ if(!cl)
+ cl = get_changelog_from_source(pkg, ver, "non-free/foo",
+ gen_cmdline_download_progress(),
+ 500000, pkg);
+
+ return cl;
+}
+
/** Find a source record in the given set of source records
* corresponding to the given package and archive. Expects no
* pending errors when it starts.
@@ -189,9 +218,12 @@
}
}
- cl=get_changelog(ver,
- gen_cmdline_download_progress(),
- 500000);
+ if(ver.end() && source == cmdline_version_version)
+ cl = changelog_by_version(package, sourcestr);
+ else
+ cl = get_changelog(ver,
+ gen_cmdline_download_progress(),
+ 500000);
}
else
{
@@ -226,11 +258,14 @@
case cmdline_version_version:
ent = find_src_ver(*apt_source_list, package, sourcestr);
+ if(ent.pkg.empty())
+ cl = changelog_by_version(package, sourcestr);
+
break;
}
- if(!ent.pkg.empty())
+ if(cl == NULL && !ent.pkg.empty())
cl = get_changelog_from_source(ent.pkg,
ent.ver,
ent.section,
Modified: branches/aptitude-0.3/aptitude/src/generic/pkg_changelog.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/pkg_changelog.cc (original)
+++ branches/aptitude-0.3/aptitude/src/generic/pkg_changelog.cc Tue Jul 26 00:00:35 2005
@@ -35,7 +35,6 @@
#include <apt-pkg/error.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/acquire-item.h>
-#include <apt-pkg/srcrecords.h>
#include <apt-pkg/strutl.h>
using namespace std;
@@ -131,20 +130,6 @@
char uribuf[1024];
- pkgSrcRecords src_recs(*apt_source_list);
- pkgSrcRecords::Parser *parser = src_recs.Find(srcpkg.c_str());
-
- while(parser != NULL && parser->Version() != ver)
- parser = src_recs.Find(srcpkg.c_str());
-
- if(parser == NULL)
- {
- _error->Error(_("Unable to find source for package \"%s\" version \"%s\""),
- srcpkg.c_str(),
- ver.c_str());
- return NULL;
- }
-
string realsection;
if(section.find('/')!=section.npos)
More information about the Aptitude-svn-commit
mailing list