[Aptitude-svn-commit] r3657 -
branches/aptitude-0.3/aptitude/src/generic
Daniel Burrows
dburrows at costa.debian.org
Thu Jul 21 17:31:44 UTC 2005
Author: dburrows
Date: Thu Jul 21 17:31:43 2005
New Revision: 3657
Modified:
branches/aptitude-0.3/aptitude/src/generic/apt.h
branches/aptitude-0.3/aptitude/src/generic/tasks.cc
Log:
Lift loc_pair and location_compare into the common header
Modified: branches/aptitude-0.3/aptitude/src/generic/apt.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/apt.h (original)
+++ branches/aptitude-0.3/aptitude/src/generic/apt.h Thu Jul 21 17:31:43 2005
@@ -27,6 +27,8 @@
#include "aptcache.h"
+#include <utility>
+
class OpProgress;
class pkgRecords;
class pkgSourceList;
@@ -154,4 +156,21 @@
*/
bool package_trusted(const pkgCache::VerIterator &ver);
+/** A pair (veriterator,verfile) -- used for building a list of
+ * versions sorted by file location.
+ */
+typedef std::pair<pkgCache::VerIterator, pkgCache::VerFileIterator> loc_pair;
+
+/** Used to compare two version files based on their location. */
+struct location_compare
+{
+ bool operator()(loc_pair a, loc_pair b)
+ {
+ if(a.second->File==b.second->File)
+ return a.second->Offset<b.second->Offset;
+ else
+ return a.second->File<b.second->File;
+ }
+};
+
#endif
Modified: branches/aptitude-0.3/aptitude/src/generic/tasks.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/tasks.cc (original)
+++ branches/aptitude-0.3/aptitude/src/generic/tasks.cc Thu Jul 21 17:31:43 2005
@@ -30,22 +30,6 @@
// (as usual, it's initialized to NULL)
list<string> *tasks_by_package;
-// A pair (veriterator,verfile) -- used for building a list of versions
-// sorted by file location.
-typedef pair<pkgCache::PkgIterator, pkgCache::VerFileIterator> loc_pair;
-
-// Used to compare two version files based on their location
-struct location_compare
-{
- bool operator()(loc_pair a, loc_pair b)
- {
- if(a.second->File==b.second->File)
- return a.second->Offset<b.second->Offset;
- else
- return a.second->File<b.second->File;
- }
-};
-
// Now this is just a wrapper, as you can see..
std::list<std::string> *get_tasks(const pkgCache::PkgIterator &pkg)
{
@@ -265,8 +249,12 @@
for(pkgCache::PkgIterator pkg=(*apt_cache_file)->PkgBegin();
!pkg.end(); ++pkg)
- if(!pkg.VersionList().end() && !pkg.VersionList().FileList().end())
- versionfiles.push_back(loc_pair(pkg, pkg.VersionList().FileList()));
+ {
+ const pkgCache::VerIterator v=pkg.VersionList();
+
+ if(!v.end() && !v.FileList().end())
+ versionfiles.push_back(loc_pair(v, v.FileList()));
+ }
sort(versionfiles.begin(), versionfiles.end(), location_compare());
@@ -277,7 +265,7 @@
for(vector<loc_pair>::iterator i=versionfiles.begin();
i!=versionfiles.end();
++i)
- update_tasks(i->first, i->second);
+ update_tasks(i->first.ParentPkg(), i->second);
FileFd task_file;
More information about the Aptitude-svn-commit
mailing list