apt  2.2.4
About: Apt (Advanced Package Tool) is a management system for software packages (Debian/Ubuntu). Release series 2.2.
  Fossies Dox: apt-2.2.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

private-show.cc
Go to the documentation of this file.
1 // Includes /*{{{*/
2 #include <config.h>
3 
4 #include <apt-pkg/cachefile.h>
5 #include <apt-pkg/cacheset.h>
6 #include <apt-pkg/cmndline.h>
7 #include <apt-pkg/configuration.h>
8 #include <apt-pkg/depcache.h>
9 #include <apt-pkg/error.h>
10 #include <apt-pkg/fileutl.h>
11 #include <apt-pkg/hashes.h>
12 #include <apt-pkg/indexfile.h>
13 #include <apt-pkg/macros.h>
14 #include <apt-pkg/pkgcache.h>
15 #include <apt-pkg/pkgrecords.h>
16 #include <apt-pkg/pkgsystem.h>
17 #include <apt-pkg/policy.h>
18 #include <apt-pkg/sourcelist.h>
19 #include <apt-pkg/strutl.h>
20 #include <apt-pkg/tagfile.h>
21 
26 
27 #include <ostream>
28 #include <string>
29 #include <stdio.h>
30 #include <unistd.h>
31 
32 #include <apti18n.h>
33  /*}}}*/
34 
36 {
37  Vf = V.FileList();
38  for (; Vf.end() == false; ++Vf)
39  if ((Vf.File()->Flags & pkgCache::Flag::NotSource) == 0)
40  break;
41  if (Vf.end() == true)
42  Vf = V.FileList();
43  return Recs.Lookup(Vf);
44 }
45  /*}}}*/
46 static APT_PURE char const *skipDescription(char const *DescP, size_t const Length, bool fields) /*{{{*/
47 {
48  auto const backup = DescP;
49  char const * const TagName = "\nDescription";
50  size_t const TagLen = strlen(TagName);
51  while ((DescP = static_cast<char const *>(memchr(DescP, '\n', Length - (DescP - backup)))) != nullptr)
52  {
53  if (DescP[1] == ' ')
54  DescP += 2;
55  else if (fields && strncmp((char *)DescP, TagName, TagLen) == 0)
56  DescP += TagLen;
57  else
58  break;
59  }
60  if (DescP != NULL)
61  ++DescP;
62  return DescP;
63 }
64  /*}}}*/
65 static APT_PURE char const *findDescriptionField(char const *DescP, size_t const Length) /*{{{*/
66 {
67  auto const backup = DescP;
68  char const * const TagName = "\nDescription";
69  size_t const TagLen = strlen(TagName);
70  while ((DescP = static_cast<char const *>(memchr(DescP, '\n', Length - (DescP - backup)))) != nullptr)
71  {
72  if (strncmp(DescP, TagName, TagLen) == 0)
73  break;
74  else
75  ++DescP;
76  }
77  if (DescP != nullptr)
78  ++DescP;
79  return DescP;
80 }
81  /*}}}*/
82 static APT_PURE char const *skipColonSpaces(char const *Buffer, size_t const Length) /*{{{*/
83 {
84  // skipping withspace before and after the field-value separating colon
85  char const *const Start = Buffer;
86  for (; isspace(*Buffer) != 0 && Length - (Buffer - Start) > 0; ++Buffer)
87  ;
88  if (*Buffer != ':')
89  return nullptr;
90  ++Buffer;
91  for (; isspace(*Buffer) != 0 && Length - (Buffer - Start) > 0; ++Buffer)
92  ;
93  if (Length < static_cast<size_t>(Buffer - Start))
94  return nullptr;
95  return Buffer;
96 }
97  /*}}}*/
98 
99 bool DisplayRecordV1(pkgCacheFile &, pkgRecords &Recs, /*{{{*/
101  char const *Buffer, size_t Length, std::ostream &out)
102 {
103  if (unlikely(Length < 4))
104  return false;
105 
106  auto const Desc = V.TranslatedDescription();
107  if (Desc.end())
108  {
109  /* This handles the unusual case that we have no description whatsoever.
110  The slightly more common case of only having a short-description embedded
111  in the record could be handled here, but apt supports also having multiple
112  descriptions embedded in the record, so we deal with that case later */
113  if (FileFd::Write(STDOUT_FILENO, Buffer, Length) == false)
114  return false;
115  if (strncmp((Buffer + Length - 4), "\r\n\r\n", 4) != 0 &&
116  strncmp((Buffer + Length - 2), "\n\n", 2) != 0)
117  out << std::endl;
118  return true;
119  }
120 
121  // Get a pointer to start of Description field
122  char const *DescP = findDescriptionField(Buffer, Length);
123  if (DescP == nullptr)
124  DescP = Buffer + Length;
125 
126  // Write all but Description
127  size_t const untilDesc = DescP - Buffer;
128  if (untilDesc != 0 && FileFd::Write(STDOUT_FILENO, Buffer, untilDesc) == false)
129  return false;
130 
131  // Show the right description
132  char desctag[50];
133  auto const langcode = Desc.LanguageCode();
134  if (strcmp(langcode, "") == 0)
135  strcpy(desctag, "\nDescription");
136  else
137  snprintf(desctag, sizeof(desctag), "\nDescription-%s", langcode);
138 
139  out << desctag + 1 << ": " << std::flush;
140  auto const Df = Desc.FileList();
141  if (Df.end() == false)
142  {
143  if (Desc.FileList()->File == Vf->File)
144  {
145  /* If we have the file already open look in the buffer for the
146  description we want to display. Note that this might not be the
147  only one we can encounter in this record */
148  char const *Start = DescP;
149  do
150  {
151  if (strncmp(Start, desctag + 1, strlen(desctag) - 1) != 0)
152  continue;
153  Start += strlen(desctag) - 1;
154  Start = skipColonSpaces(Start, Length - (Start - Buffer));
155  if (Start == nullptr)
156  continue;
157  char const *End = skipDescription(Start, Length - (Start - Buffer), false);
158  if (likely(End != nullptr))
159  FileFd::Write(STDOUT_FILENO, Start, End - (Start + 1));
160  break;
161  } while ((Start = findDescriptionField(Start, Length - (Start - Buffer))) != nullptr);
162  }
163  else
164  {
165  pkgRecords::Parser &P = Recs.Lookup(Df);
166  out << P.LongDesc();
167  }
168  }
169 
170  out << std::endl << "Description-md5: " << Desc.md5() << std::endl;
171 
172  // Find the first field after the description (if there is any)
173  DescP = skipDescription(DescP, Length - (DescP - Buffer), true);
174 
175  // write the rest of the buffer, but skip mixed in Descriptions* fields
176  while (DescP != nullptr)
177  {
178  char const *const Start = DescP;
179  char const *End = findDescriptionField(DescP, Length - (DescP - Buffer));
180  if (End == nullptr)
181  {
182  DescP = nullptr;
183  End = Buffer + Length - 1;
184  size_t endings = 0;
185  while (*End == '\n')
186  {
187  --End;
188  if (*End == '\r')
189  --End;
190  ++endings;
191  }
192  if (endings >= 1)
193  {
194  ++End;
195  if (*End == '\r')
196  ++End;
197  }
198  ++End;
199  }
200  else
201  DescP = skipDescription(End + strlen("Description"), Length - (End - Buffer), true);
202 
203  size_t const length = End - Start;
204  if (length != 0 && FileFd::Write(STDOUT_FILENO, Start, length) == false)
205  return false;
206  }
207  // write a final newline after the last field
208  out << std::endl;
209 
210  return true;
211 }
212  /*}}}*/
213 static bool DisplayRecordV2(pkgCacheFile &CacheFile, pkgRecords &Recs, /*{{{*/
215  char const *Buffer, size_t const Length, std::ostream &out)
216 {
217  // Check and load the package list file
218  pkgCache::PkgFileIterator I = Vf.File();
219 
220  // find matching sources.list metaindex
222  pkgIndexFile *Index;
223  if (SrcList->FindIndex(I, Index) == false &&
224  _system->FindIndex(I, Index) == false)
225  return _error->Error("Can not find indexfile for Package %s (%s)",
226  V.ParentPkg().Name(), V.VerStr());
227  std::string source_index_file = Index->Describe(true);
228 
229  // Read the record
230  pkgTagSection Tags;
231  if (Tags.Scan(Buffer, Length, true) == false)
232  return _error->Error("Internal Error, Unable to parse a package record");
233 
234  // make size nice
235  std::string installed_size;
236  if (Tags.FindULL("Installed-Size") > 0)
237  strprintf(installed_size, "%sB", SizeToStr(Tags.FindULL("Installed-Size") * 1024).c_str());
238  else
239  installed_size = _("unknown");
240  std::string package_size;
241  if (Tags.FindULL("Size") > 0)
242  strprintf(package_size, "%sB", SizeToStr(Tags.FindULL("Size")).c_str());
243  else
244  package_size = _("unknown");
245 
246  const char *manual_installed = nullptr;
247  if (V.ParentPkg().CurrentVer() == V)
248  {
249  pkgDepCache *depCache = CacheFile.GetDepCache();
250  if (unlikely(depCache == nullptr))
251  return false;
252  pkgDepCache::StateCache &state = (*depCache)[V.ParentPkg()];
253  manual_installed = !(state.Flags & pkgCache::Flag::Auto) ? "yes" : "no";
254  }
255 
256  // FIXME: add verbose that does not do the removal of the tags?
257  std::vector<pkgTagSection::Tag> RW;
258  // delete, apt-cache show has this info and most users do not care
259  RW.push_back(pkgTagSection::Tag::Remove("MD5sum"));
260  RW.push_back(pkgTagSection::Tag::Remove("SHA1"));
261  RW.push_back(pkgTagSection::Tag::Remove("SHA256"));
262  RW.push_back(pkgTagSection::Tag::Remove("SHA512"));
263  RW.push_back(pkgTagSection::Tag::Remove("Filename"));
264  RW.push_back(pkgTagSection::Tag::Remove("Multi-Arch"));
265  RW.push_back(pkgTagSection::Tag::Remove("Architecture"));
266  RW.push_back(pkgTagSection::Tag::Remove("Conffiles"));
267  // we use the translated description
268  RW.push_back(pkgTagSection::Tag::Remove("Description"));
269  RW.push_back(pkgTagSection::Tag::Remove("Description-md5"));
270  // improve
271  RW.push_back(pkgTagSection::Tag::Rewrite("Package", V.ParentPkg().FullName(true)));
272  RW.push_back(pkgTagSection::Tag::Rewrite("Installed-Size", installed_size));
273  RW.push_back(pkgTagSection::Tag::Remove("Size"));
274  RW.push_back(pkgTagSection::Tag::Rewrite("Download-Size", package_size));
275  // add
276  if (manual_installed != nullptr)
277  RW.push_back(pkgTagSection::Tag::Rewrite("APT-Manual-Installed", manual_installed));
278  RW.push_back(pkgTagSection::Tag::Rewrite("APT-Sources", source_index_file));
279 
280  FileFd stdoutfd;
281  if (stdoutfd.OpenDescriptor(STDOUT_FILENO, FileFd::WriteOnly, false) == false ||
282  Tags.Write(stdoutfd, TFRewritePackageOrder, RW) == false || stdoutfd.Close() == false)
283  return _error->Error("Internal Error, Unable to parse a package record");
284 
285  // write the description
286  // FIXME: show (optionally) all available translations(?)
287  pkgCache::DescIterator Desc = V.TranslatedDescription();
288  if (Desc.end() == false)
289  {
290  pkgRecords::Parser &P = Recs.Lookup(Desc.FileList());
291  out << "Description: " << P.LongDesc();
292  }
293 
294  // write a final newline (after the description)
295  out << std::endl << std::endl;
296 
297  return true;
298 }
299  /*}}}*/
300 bool ShowPackage(CommandLine &CmdL) /*{{{*/
301 {
303  auto VolatileCmdL = GetAllPackagesAsPseudo(CacheFile.GetSourceList(), CmdL, AddVolatileBinaryFile, "");
304 
305  if (unlikely(CacheFile.GetPkgCache() == nullptr))
306  return false;
308  APT::CacheSetHelper::VerSelector const select = _config->FindB("APT::Cache::AllVersions", true) ?
310  if (select == APT::CacheSetHelper::CANDIDATE && CacheFile.GetDepCache() == nullptr)
311  return false;
312 
313  APT::VersionList verset;
314  size_t normalPackages = 0;
315  for (auto const &I: VolatileCmdL)
316  {
317  if (I.index == -1)
318  {
319  APT::VersionContainerInterface::FromString(&verset, CacheFile, I.name, select, helper);
320  ++normalPackages;
321  }
322  else
323  {
324  if (select != APT::CacheSetHelper::CANDIDATE && unlikely(CacheFile.GetDepCache() == nullptr))
325  return false;
326  pkgCache::PkgIterator const P = CacheFile->FindPkg(I.name);
327  if (unlikely(P.end()))
328  continue;
329 
330  // Set any version providing the .deb as the candidate.
331  for (auto Prv = P.ProvidesList(); Prv.end() == false; ++Prv)
332  {
333  if (I.release.empty())
334  CacheFile->SetCandidateVersion(Prv.OwnerVer());
335  else
336  CacheFile->SetCandidateRelease(Prv.OwnerVer(), I.release);
337 
338  // via cacheset to have our usual handling
340  }
341  }
342  }
343 
344  int const ShowVersion = _config->FindI("APT::Cache::Show::Version", 1);
345  pkgRecords Recs(CacheFile);
346  for (APT::VersionList::const_iterator Ver = verset.begin(); Ver != verset.end(); ++Ver)
347  {
349  auto &Parser = LookupParser(Recs, Ver, Vf);
350  char const *Start, *Stop;
351  Parser.GetRec(Start, Stop);
352  size_t const Length = Stop - Start;
353 
354  if (ShowVersion <= 1)
355  {
356  if (DisplayRecordV1(CacheFile, Recs, Ver, Vf, Start, Length, std::cout) == false)
357  return false;
358  }
359  else if (DisplayRecordV2(CacheFile, Recs, Ver, Vf, Start, Length + 1, c1out) == false)
360  return false;
361  }
362 
363  if (select == APT::CacheSetHelper::CANDIDATE && normalPackages != 0)
364  {
365  APT::VersionList verset_all;
366  for (auto const &I: VolatileCmdL)
367  {
368  if (I.index == -1)
370  else
371  {
372  pkgCache::PkgIterator const P = CacheFile->FindPkg(I.name);
373  if (unlikely(P.end()))
374  continue;
375 
376  // Set any version providing the .deb as the candidate.
377  for (auto Prv = P.ProvidesList(); Prv.end() == false; ++Prv)
378  {
379  if (I.release.empty())
380  CacheFile->SetCandidateVersion(Prv.OwnerVer());
381  else
382  CacheFile->SetCandidateRelease(Prv.OwnerVer(), I.release);
383 
384  // via cacheset to have our usual virtual handling
386  }
387  }
388  }
389 
390  int const records = verset_all.size() - verset.size();
391  if (records > 0)
392  _error->Notice(P_("There is %i additional record. Please use the '-a' switch to see it", "There are %i additional records. Please use the '-a' switch to see them.", records), records);
393  }
394 
395  if (_config->FindB("APT::Cache::ShowVirtuals", false) == true)
397  Pkg != helper.virtualPkgs.end(); ++Pkg)
398  {
399  c1out << "Package: " << Pkg.FullName(true) << std::endl;
400  c1out << "State: " << _("not a real package (virtual)") << std::endl;
401  // FIXME: show providers, see private-cacheset.h
402  // CacheSetHelperAPTGet::showVirtualPackageErrors()
403  }
404 
405  if (verset.empty() == true)
406  {
407  if (helper.virtualPkgs.empty() == true)
408  return _error->Error(_("No packages found"));
409  else
410  _error->Notice(_("No packages found"));
411  }
412 
413  return true;
414 }
415  /*}}}*/
416 static std::string Sha1FromString(std::string const &input) /*{{{*/
417 {
418  // XXX: move to hashes.h: HashString::FromString() ?
419  Hashes sha1(Hashes::SHA1SUM);
420  sha1.Add(input.c_str(), input.length());
421  return sha1.GetHashString(Hashes::SHA1SUM).HashValue();
422 }
423  /*}}}*/
424 bool ShowSrcPackage(CommandLine &CmdL) /*{{{*/
425 {
428  if (unlikely(List == NULL))
429  return false;
430 
431  // Create the text record parsers
432  pkgSrcRecords SrcRecs(*List);
433  if (_error->PendingError() == true)
434  return false;
435 
436  bool found = false;
437  // avoid showing identical records
438  std::set<std::string> seen;
439  for (const char **I = CmdL.FileList + 1; *I != 0; I++)
440  {
441  SrcRecs.Restart();
442 
443  pkgSrcRecords::Parser *Parse;
444  bool found_this = false;
445  while ((Parse = SrcRecs.Find(*I,false)) != 0) {
446  // SrcRecs.Find() will find both binary and source names
447  if (_config->FindB("APT::Cache::Only-Source", false) == true)
448  if (Parse->Package() != *I)
449  continue;
450  std::string sha1str = Sha1FromString(Parse->AsStr());
451  if (std::find(seen.begin(), seen.end(), sha1str) == seen.end())
452  {
453  std::cout << Parse->AsStr() << std::endl;;
454  found = true;
455  found_this = true;
456  seen.insert(sha1str);
457  }
458  }
459  if (found_this == false) {
460  _error->Warning(_("Unable to locate package %s"),*I);
461  continue;
462  }
463  }
464  if (found == false)
465  _error->Notice(_("No packages found"));
466  return true;
467 }
468  /*}}}*/
469 // Policy - Show the results of the preferences file /*{{{*/
470 bool Policy(CommandLine &CmdL)
471 {
473  pkgSourceList const * const SrcList = CacheFile.GetSourceList();
474  if (unlikely(SrcList == nullptr))
475  return false;
476  pkgCache * const Cache = CacheFile.GetPkgCache();
477  if (unlikely(Cache == nullptr))
478  return false;
479  pkgPolicy * const Plcy = CacheFile.GetPolicy();
480  if (unlikely(Plcy == nullptr))
481  return false;
482 
483  // Print out all of the package files
484  if (CmdL.FileList[1] == 0)
485  {
486  std::cout << _("Package files:") << std::endl;
487  for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F.end() == false; ++F)
488  {
489  if (F.Flagged(pkgCache::Flag::NoPackages))
490  continue;
491  // Locate the associated index files so we can derive a description
492  pkgIndexFile *Indx;
493  if (SrcList->FindIndex(F,Indx) == false &&
494  _system->FindIndex(F,Indx) == false)
495  return _error->Error(_("Cache is out of sync, can't x-ref a package file"));
496 
497  printf("%4i %s\n",
498  Plcy->GetPriority(F),Indx->Describe(true).c_str());
499 
500  // Print the reference information for the package
501  std::string Str = F.RelStr();
502  if (Str.empty() == false)
503  printf(" release %s\n",F.RelStr().c_str());
504  if (F.Site() != 0 && F.Site()[0] != 0)
505  printf(" origin %s\n",F.Site());
506  }
507 
508  // Show any packages have explicit pins
509  std::cout << _("Pinned packages:") << std::endl;
510  pkgCache::PkgIterator I = Cache->PkgBegin();
511  for (;I.end() != true; ++I)
512  {
513  for (pkgCache::VerIterator V = I.VersionList(); !V.end(); ++V) {
514  auto Prio = Plcy->GetPriority(V, false);
515  if (Prio == 0)
516  continue;
517 
518  std::cout << " ";
519  // Print the package name and the version we are forcing to
520  ioprintf(std::cout, _("%s -> %s with priority %d\n"), I.FullName(true).c_str(), V.VerStr(), Prio);
521  }
522  }
523  return true;
524  }
525 
526  char const * const msgInstalled = _(" Installed: ");
527  char const * const msgCandidate = _(" Candidate: ");
528  short const InstalledLessCandidate =
529  mbstowcs(NULL, msgInstalled, 0) - mbstowcs(NULL, msgCandidate, 0);
530  short const deepInstalled =
531  (InstalledLessCandidate < 0 ? (InstalledLessCandidate*-1) : 0) - 1;
532  short const deepCandidate =
533  (InstalledLessCandidate > 0 ? (InstalledLessCandidate) : 0) - 1;
534 
535  // Print out detailed information for each package
538  for (APT::PackageList::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
539  {
540  std::cout << Pkg.FullName(true) << ":" << std::endl;
541 
542  // Installed version
543  std::cout << msgInstalled << OutputInDepth(deepInstalled, " ");
544  if (Pkg->CurrentVer == 0)
545  std::cout << _("(none)") << std::endl;
546  else
547  std::cout << Pkg.CurrentVer().VerStr() << std::endl;
548 
549  // Candidate Version
550  std::cout << msgCandidate << OutputInDepth(deepCandidate, " ");
551  pkgCache::VerIterator V = Plcy->GetCandidateVer(Pkg);
552  if (V.end() == true)
553  std::cout << _("(none)") << std::endl;
554  else
555  std::cout << V.VerStr() << std::endl;
556 
557  // Show the priority tables
558  std::cout << _(" Version table:") << std::endl;
559  for (V = Pkg.VersionList(); V.end() == false; ++V)
560  {
561  if (Pkg.CurrentVer() == V)
562  std::cout << " *** " << V.VerStr();
563  else
564  std::cout << " " << V.VerStr();
565 
566  std::cout << " " << Plcy->GetPriority(V);
567 
568  if (V.PhasedUpdatePercentage() != 100)
569  std::cout << " "
570  << "(" << _("phased") << " " << V.PhasedUpdatePercentage() << "%)";
571 
572  std::cout << std::endl;
573  for (pkgCache::VerFileIterator VF = V.FileList(); VF.end() == false; ++VF)
574  {
575  // Locate the associated index files so we can derive a description
576  pkgIndexFile *Indx;
577  if (SrcList->FindIndex(VF.File(),Indx) == false &&
578  _system->FindIndex(VF.File(),Indx) == false)
579  return _error->Error(_("Cache is out of sync, can't x-ref a package file"));
580  printf(" %4i %s\n",Plcy->GetPriority(VF.File()),
581  Indx->Describe(true).c_str());
582  }
583  }
584  }
585  return true;
586 }
587  /*}}}*/
strprintf(m, msg, repo.c_str())
static bool std::string const metaIndex const *const pkgAcqMetaClearSig *const pkgAcquire::Item *const I
VerSelector
specifies which version(s) we want to refer to
Definition: cacheset.h:95
bool empty() const APT_OVERRIDE
Definition: cacheset.h:361
const_iterator begin() const
Definition: cacheset.h:371
static PackageContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper)
returns all packages specified on the commandline
Definition: cacheset.h:478
const_iterator end() const
Definition: cacheset.h:372
static bool FromPackage(VersionContainerInterface *const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &P, CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper)
Definition: cacheset.cc:516
static bool FromString(VersionContainerInterface *const vci, pkgCacheFile &Cache, std::string pkg, CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper, bool const onlyFromName=false)
Definition: cacheset.cc:445
bool empty() const APT_OVERRIDE
Definition: cacheset.h:815
size_t size() const APT_OVERRIDE
Definition: cacheset.h:817
const_iterator begin() const
Definition: cacheset.h:825
const_iterator end() const
Definition: cacheset.h:826
APT::PackageSet virtualPkgs
const char ** FileList
Definition: cmndline.h:78
int FindI(const char *Name, int const &Default=0) const
bool FindB(const char *Name, bool const &Default=false) const
Definition: fileutl.h:39
bool OpenDescriptor(int Fd, unsigned int const Mode, CompressMode Compress, bool AutoClose=false)
Definition: fileutl.cc:2572
@ WriteOnly
Definition: fileutl.h:60
bool Write(const void *From, unsigned long long Size)
Definition: fileutl.cc:2819
bool Close()
Definition: fileutl.cc:2977
@ NOTICE
deprecation warnings, old fallback behavior, …
Definition: error.h:64
std::string HashValue() const
Definition: hashes.h:44
Definition: hashes.h:170
@ SHA1SUM
Definition: hashes.h:185
HashString GetHashString(SupportedHashes hash)
Definition: hashes.cc:442
bool Add(const unsigned char *const Data, unsigned long long const Size) APT_NONNULL(2)
Definition: hashes.cc:353
pkgPolicy * GetPolicy()
Definition: cachefile.h:75
pkgDepCache * GetDepCache()
Definition: cachefile.h:74
pkgSourceList * GetSourceList()
Definition: cachefile.h:76
pkgCache * GetPkgCache()
Definition: cachefile.h:73
virtual std::string Describe(bool const Short=false) const =0
virtual pkgCache::VerIterator GetCandidateVer(pkgCache::PkgIterator const &Pkg) APT_OVERRIDE
Definition: policy.cc:140
virtual signed short GetPriority(pkgCache::VerIterator const &Ver, bool ConsiderFiles=true) APT_OVERRIDE
Definition: policy.cc:311
Parser & Lookup(pkgCache::VerFileIterator const &Ver)
Definition: pkgrecords.cc:62
bool FindIndex(pkgCache::PkgFileIterator File, pkgIndexFile *&Found) const
Definition: sourcelist.cc:471
virtual std::string AsStr()=0
virtual std::string Package() const =0
bool Restart()
Definition: srcrecords.cc:76
Parser * Find(const char *Package, bool const &SrcOnly=false)
Definition: srcrecords.cc:111
virtual bool FindIndex(pkgCache::PkgFileIterator File, pkgIndexFile *&Found) const =0
APT_MUSTCHECK bool Scan(const char *Start, unsigned long MaxLength, bool const Restart=true)
searches the boundaries of the current section
Definition: tagfile.cc:484
bool Write(FileFd &File, char const *const *const Order=NULL, std::vector< Tag > const &Rewrite=std::vector< Tag >()) const
Definition: tagfile.cc:999
APT_HIDDEN unsigned long long FindULL(Key key, unsigned long long const &Default=0) const
Definition: tagfile.cc:812
Configuration * _config
#define APT_PURE
Definition: macros.h:56
pkgCache - Structure definitions for the cache file
pkgSystem * _system
Definition: pkgsystem.cc:24
std::vector< PseudoPkg > GetAllPackagesAsPseudo(pkgSourceList *const SL, CommandLine &CmdL, bool(*Add)(pkgSourceList *const, PseudoPkg &&, std::vector< PseudoPkg > &), std::string const &pseudoArch)
bool AddVolatileBinaryFile(pkgSourceList *const SL, PseudoPkg &&pkg, std::vector< PseudoPkg > &VolatileCmdL)
APT_PUBLIC std::ostream c1out
static bool DisplayRecordV2(pkgCacheFile &CacheFile, pkgRecords &Recs, pkgCache::VerIterator const &V, pkgCache::VerFileIterator const &Vf, char const *Buffer, size_t const Length, std::ostream &out)
bool DisplayRecordV1(pkgCacheFile &, pkgRecords &Recs, pkgCache::VerIterator const &V, pkgCache::VerFileIterator const &Vf, char const *Buffer, size_t Length, std::ostream &out)
Definition: private-show.cc:99
bool Policy(CommandLine &CmdL)
static APT_PURE char const * skipColonSpaces(char const *Buffer, size_t const Length)
Definition: private-show.cc:82
static APT_PURE char const * skipDescription(char const *DescP, size_t const Length, bool fields)
Definition: private-show.cc:46
bool ShowPackage(CommandLine &CmdL)
static std::string Sha1FromString(std::string const &input)
pkgRecords::Parser & LookupParser(pkgRecords &Recs, pkgCache::VerIterator const &V, pkgCache::VerFileIterator &Vf)
Definition: private-show.cc:35
static APT_PURE char const * findDescriptionField(char const *DescP, size_t const Length)
Definition: private-show.cc:65
bool ShowSrcPackage(CommandLine &CmdL)
unsigned short Flags
Definition: depcache.h:224
static Tag Rewrite(std::string const &Name, std::string const &Data)
Definition: tagfile.cc:958
static Tag Remove(std::string const &Name)
Definition: tagfile.cc:950
std::string OutputInDepth(const unsigned long Depth, const char *Separator)
Definition: strutl.cc:540
string SizeToStr(double Size)
Definition: strutl.cc:437
void ioprintf(ostream &out, const char *format,...)
Definition: strutl.cc:1433
const char ** TFRewritePackageOrder