bool Stats(CommandLine &Cmd)
{
pkgCache &Cache = *GCache;
- cout << _("Total Package Names : ") << Cache.Head().PackageCount << " (" <<
+ cout << _("Total package names : ") << Cache.Head().PackageCount << " (" <<
SizeToStr(Cache.Head().PackageCount*Cache.Head().PackageSz) << ')' << endl;
int Normal = 0;
continue;
}
}
- cout << _(" Normal Packages: ") << Normal << endl;
- cout << _(" Pure Virtual Packages: ") << Virtual << endl;
- cout << _(" Single Virtual Packages: ") << DVirt << endl;
- cout << _(" Mixed Virtual Packages: ") << NVirt << endl;
+ cout << _(" Normal packages: ") << Normal << endl;
+ cout << _(" Pure virtual packages: ") << Virtual << endl;
+ cout << _(" Single virtual packages: ") << DVirt << endl;
+ cout << _(" Mixed virtual packages: ") << NVirt << endl;
cout << _(" Missing: ") << Missing << endl;
- cout << _("Total Distinct Versions: ") << Cache.Head().VersionCount << " (" <<
+ cout << _("Total distinct versions: ") << Cache.Head().VersionCount << " (" <<
SizeToStr(Cache.Head().VersionCount*Cache.Head().VersionSz) << ')' << endl;
cout << _("Total Distinct Descriptions: ") << Cache.Head().DescriptionCount << " (" <<
SizeToStr(Cache.Head().DescriptionCount*Cache.Head().DescriptionSz) << ')' << endl;
- cout << _("Total Dependencies: ") << Cache.Head().DependsCount << " (" <<
+ cout << _("Total dependencies: ") << Cache.Head().DependsCount << " (" <<
SizeToStr(Cache.Head().DependsCount*Cache.Head().DependencySz) << ')' << endl;
- cout << _("Total Ver/File relations: ") << Cache.Head().VerFileCount << " (" <<
+ cout << _("Total ver/file relations: ") << Cache.Head().VerFileCount << " (" <<
SizeToStr(Cache.Head().VerFileCount*Cache.Head().VerFileSz) << ')' << endl;
cout << _("Total Desc/File relations: ") << Cache.Head().DescFileCount << " (" <<
SizeToStr(Cache.Head().DescFileCount*Cache.Head().DescFileSz) << ')' << endl;
- cout << _("Total Provides Mappings: ") << Cache.Head().ProvidesCount << " (" <<
+ cout << _("Total Provides mappings: ") << Cache.Head().ProvidesCount << " (" <<
SizeToStr(Cache.Head().ProvidesCount*Cache.Head().ProvidesSz) << ')' << endl;
// String list stats
Count++;
Size += strlen(Cache.StrP + I->String) + 1;
}
- cout << _("Total Globbed Strings: ") << Count << " (" << SizeToStr(Size) << ')' << endl;
+ cout << _("Total globbed strings: ") << Count << " (" << SizeToStr(Size) << ')' << endl;
unsigned long DepVerSize = 0;
for (pkgCache::PkgIterator P = Cache.PkgBegin(); P.end() == false; P++)
}
}
}
- cout << _("Total Dependency Version space: ") << SizeToStr(DepVerSize) << endl;
+ cout << _("Total dependency version space: ") << SizeToStr(DepVerSize) << endl;
unsigned long Slack = 0;
for (int I = 0; I != 7; I++)
Slack += Cache.Head().Pools[I].ItemSize*Cache.Head().Pools[I].Count;
- cout << _("Total Slack space: ") << SizeToStr(Slack) << endl;
+ cout << _("Total slack space: ") << SizeToStr(Slack) << endl;
unsigned long Total = 0;
Total = Slack + Size + Cache.Head().DependsCount*Cache.Head().DependencySz +
Cache.Head().PackageCount*Cache.Head().PackageSz +
Cache.Head().VerFileCount*Cache.Head().VerFileSz +
Cache.Head().ProvidesCount*Cache.Head().ProvidesSz;
- cout << _("Total Space Accounted for: ") << SizeToStr(Total) << endl;
+ cout << _("Total space accounted for: ") << SizeToStr(Total) << endl;
return true;
}
return false;
}
- // Strip the Description
- unsigned char *DescP = (unsigned char*)strstr((char*)Buffer, "Description:");
- *DescP='\0';
+ // Get a pointer to start of Description field
+ const unsigned char *DescP = (unsigned char*)strstr((char*)Buffer, "Description:");
- // Write all the rest
- if (fwrite(Buffer,1,V.FileList()->Size+1,stdout) < V.FileList()->Size+1))
+ // Write all but Description
+ if (fwrite(Buffer,1,DescP - Buffer,stdout) < (size_t)(DescP - Buffer))
{
delete [] Buffer;
return false;
}
- delete [] Buffer;
-
// Show the right description
pkgRecords Recs(*GCache);
- pkgCache::DescIterator DescDefault = V.DescriptionList();
- pkgCache::DescIterator Desc = DescDefault;
- for (; Desc.end() == false; Desc++)
- if (pkgIndexFile::LanguageCode() == Desc.LanguageCode())
- break;
- if (Desc.end() == true) Desc = DescDefault;
-
+ pkgCache::DescIterator Desc = V.TranslatedDescription();
pkgRecords::Parser &P = Recs.Lookup(Desc.FileList());
- cout << "Description" << ( (strcmp(Desc.LanguageCode(),"") != 0) ? "-" : "" ) << Desc.LanguageCode() << ": " << P.LongDesc() << endl;
+ cout << "Description" << ( (strcmp(Desc.LanguageCode(),"") != 0) ? "-" : "" ) << Desc.LanguageCode() << ": " << P.LongDesc();
+ // Find the first field after the description (if there is any)
+ for(DescP++;DescP != &Buffer[V.FileList()->Size];DescP++)
+ {
+ if(*DescP == '\n' && *(DescP+1) != ' ')
+ {
+ // write the rest of the buffer
+ const unsigned char *end=&Buffer[V.FileList()->Size];
+ if (fwrite(DescP,1,end-DescP,stdout) < (size_t)(end-DescP))
+ {
+ delete [] Buffer;
+ return false;
+ }
+
+ break;
+ }
+ }
+ // write a final newline (after the description)
+ cout<<endl;
+ delete [] Buffer;
return true;
}
++found;
- // Show virtual packages
- if (Pkg->ProvidesList != 0)
- {
- ioprintf(std::cout,_("Package %s is a virtual package provided by:\n"),
- Pkg.Name());
-
- pkgCache::PrvIterator I = Pkg.ProvidesList();
- for (; I.end() == false; I++)
- cout << " " << I.OwnerPkg().Name() << endl;
- cout << _("You should explicitly select one to show.") << endl;
- continue;
- }
-
// Find the proper version to use.
if (_config->FindB("APT::Cache::AllVersions","true") == true)
{
// Print out all of the package files
if (CmdL.FileList[1] == 0)
{
- cout << _("Package Files:") << endl;
+ cout << _("Package files:") << endl;
for (pkgCache::PkgFileIterator F = Cache.FileBegin(); F.end() == false; F++)
{
// Locate the associated index files so we can derive a description
}
// Show any packages have explicit pins
- cout << _("Pinned Packages:") << endl;
+ cout << _("Pinned packages:") << endl;
pkgCache::PkgIterator I = Cache.PkgBegin();
for (;I.end() != true; I++)
{
// Pinned version
if (Plcy.GetPriority(Pkg) != 0)
{
- cout << _(" Package Pin: ");
+ cout << _(" Package pin: ");
V = Plcy.GetMatch(Pkg);
if (V.end() == true)
cout << _("(not found)") << endl;
}
// Show the priority tables
- cout << _(" Version Table:") << endl;
+ cout << _(" Version table:") << endl;
for (V = Pkg.VersionList(); V.end() == false; V++)
{
if (Pkg.CurrentVer() == V)
pkgCache &Cache = *GCache;
- // Create the text record parsers
+ // Create the src text record parsers and ignore errors about missing
+ // deb-src lines that are generated from pkgSrcRecords::pkgSrcRecords
pkgSrcRecords SrcRecs(*SrcList);
if (_error->PendingError() == true)
- return false;
+ _error->Discard();
for (const char **I = CmdL.FileList + 1; *I != 0; I++)
{