Przeglądaj źródła

hide Translation-* in 'apt-cache policy' output

Translation-* files are internally handled as PackageFiles which isn't
super nice, but giving them their own struct is a bit overkill so let it
be for the moment. They always appeared in the policy output because of
this through and now that they are properly linked to a ReleaseFile they
even display all the pinning information on them, but they don't contain
any packages which could be pinned… No problem, but useless and
potentially confusing output.

Adding a 'NoPackages' flag which can be set on those files and be used
in applications seems like a simple way to fix this display issue.
David Kalnischkies 11 lat temu
rodzic
commit
d2cb5b153f
3 zmienionych plików z 4 dodań i 1 usunięć
  1. 1 1
      apt-pkg/deb/debindexfile.cc
  2. 1 0
      apt-pkg/pkgcache.h
  3. 2 0
      cmdline/apt-cache.cc

+ 1 - 1
apt-pkg/deb/debindexfile.cc

@@ -203,7 +203,7 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
 
      if (Prog != NULL)
 	Prog->SubProgress(0, Target.Description);
-     if (Gen.SelectFile(TranslationFile, *this, "", Target.Option(IndexTarget::COMPONENT), pkgCache::Flag::NotSource) == false)
+     if (Gen.SelectFile(TranslationFile, *this, "", Target.Option(IndexTarget::COMPONENT), pkgCache::Flag::NotSource | pkgCache::Flag::NoPackages) == false)
        return _error->Error("Problem with SelectFile %s",TranslationFile.c_str());
 
      // Store the IMS information

+ 1 - 0
apt-pkg/pkgcache.h

@@ -195,6 +195,7 @@ class pkgCache								/*{{{*/
       enum PkgFFlags {
 	 NotSource=(1<<0), /*!< packages can't be fetched from here, e.g. dpkg/status file */
 	 LocalSource=(1<<1), /*!< local sources can't and will not be verified by hashes */
+	 NoPackages=(1<<2), /*!< the file includes no package records itself, but additions like Translations */
       };
       enum ReleaseFileFlags {
 	 NotAutomatic=(1<<0), /*!< archive has a default pin of 1 */

+ 2 - 0
cmdline/apt-cache.cc

@@ -1638,6 +1638,8 @@ static bool Policy(CommandLine &CmdL)
       cout << _("Package files:") << endl;   
       for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F.end() == false; ++F)
       {
+	 if (F.Flagged(pkgCache::Flag::NoPackages))
+	    continue;
 	 // Locate the associated index files so we can derive a description
 	 pkgIndexFile *Indx;
 	 if (SrcList->FindIndex(F,Indx) == false &&