+// VerIterator::NewestFile - Return the newest file version relation /*{{{*/
+// ---------------------------------------------------------------------
+/* This looks at the version numbers associated with all of the sources
+ this version is in and returns the highest.*/
+pkgCache::VerFileIterator pkgCache::VerIterator::NewestFile() const
+{
+ VerFileIterator Files = FileList();
+ VerFileIterator Highest = Files;
+ for (; Files.end() == false; Files++)
+ {
+ if (Owner->VS->CmpReleaseVer(Files.File().Version(),Highest.File().Version()) > 0)
+ Highest = Files;
+ }
+
+ return Highest;
+}
+ /*}}}*/
+// VerIterator::RelStr - Release description string /*{{{*/
+// ---------------------------------------------------------------------
+/* This describes the version from a release-centric manner. The output is a
+ list of Label:Version/Archive */
+string pkgCache::VerIterator::RelStr()
+{
+ bool First = true;
+ string Res;
+ for (pkgCache::VerFileIterator I = this->FileList(); I.end() == false; I++)
+ {
+ // Do not print 'not source' entries'
+ pkgCache::PkgFileIterator File = I.File();
+ if ((File->Flags & pkgCache::Flag::NotSource) == pkgCache::Flag::NotSource)
+ continue;
+
+ // See if we have already printed this out..
+ bool Seen = false;
+ for (pkgCache::VerFileIterator J = this->FileList(); I != J; J++)
+ {
+ pkgCache::PkgFileIterator File2 = J.File();
+ if (File2->Label == 0 || File->Label == 0)
+ continue;
+
+ if (strcmp(File.Label(),File2.Label()) != 0)
+ continue;
+
+ if (File2->Version == File->Version)
+ {
+ Seen = true;
+ break;
+ }
+ if (File2->Version == 0 || File->Version == 0)
+ break;
+ if (strcmp(File.Version(),File2.Version()) == 0)
+ Seen = true;
+ }
+
+ if (Seen == true)
+ continue;
+
+ if (First == false)
+ Res += ", ";
+ else
+ First = false;
+
+ if (File->Label != 0)
+ Res = Res + File.Label() + ':';
+
+ if (File->Archive != 0)
+ {
+ if (File->Version == 0)
+ Res += File.Archive();
+ else
+ Res = Res + File.Version() + '/' + File.Archive();
+ }
+ else
+ {
+ // No release file, print the host name that this came from
+ if (File->Site == 0 || File.Site()[0] == 0)
+ Res += "localhost";
+ else
+ Res += File.Site();
+ }
+ }
+ return Res;
+}
+ /*}}}*/