]> git.saurik.com Git - apt.git/commitdiff
show APT-Sources in apt show
authorMichael Vogt <mvo@debian.org>
Fri, 24 Jan 2014 20:17:07 +0000 (21:17 +0100)
committerMichael Vogt <mvo@debian.org>
Fri, 24 Jan 2014 20:17:07 +0000 (21:17 +0100)
apt-private/private-output.h
apt-private/private-show.cc

index ba04ee2215214b6e97b27f9bbbfbe32d477d0713..2a2a694584b9567d869734ec98de7087f2ba3cf7 100644 (file)
@@ -43,10 +43,6 @@ bool ShowEssential(std::ostream &out,CacheFile &Cache);
 
 void Stats(std::ostream &out, pkgDepCache &Dep);
 
-// helpers to display single package data
-std::string
-GetArchiveSuite(pkgCacheFile &CacheFile, pkgCache::VerIterator ver);
-
 // prompting
 bool YnPrompt(bool Default=true);
 bool AnalPrompt(const char *Text);
index cee1328430cf215454667734289d66ed95c3a52d..ba8b266ee7b06d2d9891e62739d6f6fb29e97188 100644 (file)
@@ -54,6 +54,15 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V,
    if (I.IsOk() == false)
       return _error->Error(_("Package file %s is out of sync."),I.FileName());
 
+   // find matching sources.list metaindex
+   pkgSourceList *SrcList = CacheFile.GetSourceList();
+   pkgIndexFile *Index;
+   if (SrcList->FindIndex(I, Index) == false &&
+       _system->FindIndex(I, Index) == false)
+      return _error->Error("Can not find indexfile for Package %s (%s)", 
+                           V.ParentPkg().Name(), V.VerStr());
+   std::string source_index_file = Index->Describe(true);
+
    // Read the record
    FileFd PkgF;
    if (PkgF.Open(I.FileName(), FileFd::ReadOnly, FileFd::Extension) == false)
@@ -83,15 +92,17 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V,
       manual_installed = !(state.Flags & pkgCache::Flag::Auto) ? "yes" : "no";
    else
       manual_installed = 0;
-   std::string suite = GetArchiveSuite(CacheFile, V);
    TFRewriteData RW[] = {
+      // delete
       {"Conffiles",0},
       {"Description",0},
       {"Description-md5",0},
+      // improve
       {"Installed-Size", installed_size.c_str(), 0},
       {"Size", package_size.c_str(), "Download-Size"},
-      {"Archive-Origin", suite.c_str(), 0},
-      {"Manual-Installed", manual_installed, 0},
+      // add
+      {"APT-Manual-Installed", manual_installed, 0},
+      {"APT-Sources", source_index_file.c_str(), 0},
       {}
    };