+ WriteOkay(Okay, output, "\nProvides: ", provides);
+ return WriteOkay(Okay, output, "\n");
+}
+ /*}}}*/
+static bool SkipUnavailableVersions(pkgDepCache &Cache, pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const &Ver)/*{{{*/
+{
+ /* versions which aren't current and aren't available in
+ any "online" source file are bad, expect if they are the choosen
+ candidate: The exception is for build-dep implementation as it creates
+ such pseudo (package) versions and removes them later on again.
+ We filter out versions at all so packages in 'rc' state only available
+ in dpkg/status aren't passed to solvers as they can't be installed. */
+ if (Pkg->CurrentVer != 0)
+ return false;
+ if (Cache.GetCandidateVersion(Pkg) == Ver)
+ return false;
+ for (pkgCache::VerFileIterator I = Ver.FileList(); I.end() == false; ++I)
+ if (I.File().Flagged(pkgCache::Flag::NotSource) == false)
+ return false;
+ return true;
+}
+ /*}}}*/
+static bool WriteScenarioEDSPVersion(pkgDepCache &Cache, FileFd &output, pkgCache::PkgIterator const &Pkg,/*{{{*/
+ pkgCache::VerIterator const &Ver)
+{
+ bool Okay = WriteOkay(output, "\nSource: ", Ver.SourcePkgName(),
+ "\nSource-Version: ", Ver.SourceVerStr());
+ if (PrioMap[Ver->Priority] != nullptr)
+ WriteOkay(Okay, output, "\nPriority: ", PrioMap[Ver->Priority]);
+ if (Ver->Section != 0)
+ WriteOkay(Okay, output, "\nSection: ", Ver.Section());
+ if (Pkg.CurrentVer() == Ver)
+ WriteOkay(Okay, output, "\nInstalled: yes");
+ if (Pkg->SelectedState == pkgCache::State::Hold ||
+ (Cache[Pkg].Keep() == true && Cache[Pkg].Protect() == true))
+ WriteOkay(Okay, output, "\nHold: yes");
+ std::set<string> Releases;
+ for (pkgCache::VerFileIterator I = Ver.FileList(); I.end() == false; ++I) {
+ pkgCache::PkgFileIterator File = I.File();
+ if (File.Flagged(pkgCache::Flag::NotSource) == false) {
+ string Release = File.RelStr();
+ if (!Release.empty())
+ Releases.insert(Release);
+ }
+ }
+ if (!Releases.empty()) {
+ WriteOkay(Okay, output, "\nAPT-Release:");
+ for (std::set<string>::iterator R = Releases.begin(); R != Releases.end(); ++R)
+ WriteOkay(Okay, output, "\n ", *R);
+ }
+ WriteOkay(Okay, output, "\nAPT-Pin: ", Cache.GetPolicy().GetPriority(Ver));
+ if (Cache.GetCandidateVersion(Pkg) == Ver)
+ WriteOkay(Okay, output, "\nAPT-Candidate: yes");
+ if ((Cache[Pkg].Flags & pkgCache::Flag::Auto) == pkgCache::Flag::Auto)
+ WriteOkay(Okay, output, "\nAPT-Automatic: yes");
+ return Okay;