summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-11-10 16:32:52 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2011-11-10 16:32:52 +0100
commit71ecaad29d8066a494f516efc5efd80860653fe2 (patch)
treeb0769df88e2b6496f23e3d899aeb1c240a3488d9 /cmdline
parenta865ed25fa54514224cf4d6f83dd9cf48b7ed02b (diff)
parent37adedc9d0b66eeae7efb88aebd08dfbc6e06f77 (diff)
merged from http://bzr.debian.org/bzr/apt/apt/debian-experimental2
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/acqprogress.cc20
-rw-r--r--cmdline/acqprogress.h4
-rw-r--r--cmdline/apt-cache.cc120
-rw-r--r--cmdline/apt-cdrom.cc10
-rw-r--r--cmdline/apt-config.cc8
-rw-r--r--cmdline/apt-dump-solver.cc1
-rw-r--r--cmdline/apt-extracttemplates.cc6
-rw-r--r--cmdline/apt-get.cc165
-rw-r--r--cmdline/apt-internal-solver.cc2
-rwxr-xr-xcmdline/apt-key2
-rw-r--r--cmdline/apt-mark.cc8
-rw-r--r--cmdline/apt-sortpkgs.cc11
12 files changed, 197 insertions, 160 deletions
diff --git a/cmdline/acqprogress.cc b/cmdline/acqprogress.cc
index d2db949ea..1ccb08804 100644
--- a/cmdline/acqprogress.cc
+++ b/cmdline/acqprogress.cc
@@ -8,19 +8,21 @@
##################################################################### */
/*}}}*/
// Include files /*{{{*/
-#include "acqprogress.h"
+#include<config.h>
+
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/acquire-worker.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/error.h>
-#include <apti18n.h>
-
#include <stdio.h>
#include <signal.h>
#include <iostream>
#include <unistd.h>
+
+#include "acqprogress.h"
+#include <apti18n.h>
/*}}}*/
using namespace std;
@@ -161,7 +163,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
ScreenWidth = sizeof(Buffer)-1;
// Put in the percent done
- sprintf(S,"%ld%%",long(double((CurrentBytes + CurrentItems)*100.0)/double(TotalBytes+TotalItems)));
+ sprintf(S,"%.0f%%",((CurrentBytes + CurrentItems)*100.0)/(TotalBytes+TotalItems));
bool Shown = false;
for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
@@ -212,11 +214,11 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false)
{
if (Mode == Short)
- snprintf(S,End-S," %lu%%",
- long(double(I->CurrentSize*100.0)/double(I->TotalSize)));
+ snprintf(S,End-S," %.0f%%",
+ (I->CurrentSize*100.0)/I->TotalSize);
else
- snprintf(S,End-S,"/%sB %lu%%",SizeToStr(I->TotalSize).c_str(),
- long(double(I->CurrentSize*100.0)/double(I->TotalSize)));
+ snprintf(S,End-S,"/%sB %.0f%%",SizeToStr(I->TotalSize).c_str(),
+ (I->CurrentSize*100.0)/I->TotalSize);
}
S += strlen(S);
snprintf(S,End-S,"]");
@@ -236,7 +238,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
if (CurrentCPS != 0)
{
char Tmp[300];
- unsigned long ETA = (unsigned long)((TotalBytes - CurrentBytes)/CurrentCPS);
+ unsigned long long ETA = (TotalBytes - CurrentBytes)/CurrentCPS;
sprintf(Tmp," %sB/s %s",SizeToStr(CurrentCPS).c_str(),TimeToStr(ETA).c_str());
unsigned int Len = strlen(Buffer);
unsigned int LenT = strlen(Tmp);
diff --git a/cmdline/acqprogress.h b/cmdline/acqprogress.h
index 48f90ae59..8f0903923 100644
--- a/cmdline/acqprogress.h
+++ b/cmdline/acqprogress.h
@@ -12,6 +12,8 @@
#include <apt-pkg/acquire.h>
+#include <string>
+
class AcqTextStatus : public pkgAcquireStatus
{
unsigned int &ScreenWidth;
@@ -21,7 +23,7 @@ class AcqTextStatus : public pkgAcquireStatus
public:
- virtual bool MediaChange(string Media,string Drive);
+ virtual bool MediaChange(std::string Media,std::string Drive);
virtual void IMSHit(pkgAcquire::ItemDesc &Itm);
virtual void Fetch(pkgAcquire::ItemDesc &Itm);
virtual void Done(pkgAcquire::ItemDesc &Itm);
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index 232bb93ec..82a31c9b1 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -13,9 +13,9 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include<config.h>
+
#include <apt-pkg/error.h>
-#include <cassert>
-#include <apt-pkg/pkgcachegen.h>
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cacheset.h>
#include <apt-pkg/init.h>
@@ -23,6 +23,7 @@
#include <apt-pkg/sourcelist.h>
#include <apt-pkg/cmndline.h>
#include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
#include <apt-pkg/pkgrecords.h>
#include <apt-pkg/srcrecords.h>
#include <apt-pkg/version.h>
@@ -30,18 +31,21 @@
#include <apt-pkg/tagfile.h>
#include <apt-pkg/algorithms.h>
#include <apt-pkg/sptr.h>
+#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/indexfile.h>
+#include <apt-pkg/metaindex.h>
-#include <config.h>
-#include <apti18n.h>
-
+#include <cassert>
#include <locale.h>
#include <iostream>
#include <unistd.h>
#include <errno.h>
#include <regex.h>
#include <stdio.h>
-
#include <iomanip>
+#include <algorithm>
+
+#include <apti18n.h>
/*}}}*/
using namespace std;
@@ -141,7 +145,7 @@ bool ShowUnMet(pkgCache::VerIterator const &V, bool const &Important)
if (Start == End)
break;
- Start++;
+ ++Start;
}
while (1);
@@ -169,7 +173,7 @@ bool ShowUnMet(pkgCache::VerIterator const &V, bool const &Important)
if (Start == End)
break;
cout << " | ";
- Start++;
+ ++Start;
}
while (1);
@@ -187,7 +191,7 @@ bool UnMet(CommandLine &CmdL)
if (CmdL.FileSize() <= 1)
{
- for (pkgCache::PkgIterator P = CacheFile.GetPkgCache()->PkgBegin(); P.end() == false; P++)
+ for (pkgCache::PkgIterator P = CacheFile.GetPkgCache()->PkgBegin(); P.end() == false; ++P)
for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; ++V)
if (ShowUnMet(V, Important) == false)
return false;
@@ -217,13 +221,13 @@ bool DumpPackage(CommandLine &CmdL)
{
cout << "Package: " << Pkg.FullName(true) << endl;
cout << "Versions: " << endl;
- for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; Cur++)
+ for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; ++Cur)
{
cout << Cur.VerStr();
- for (pkgCache::VerFileIterator Vf = Cur.FileList(); Vf.end() == false; Vf++)
+ for (pkgCache::VerFileIterator Vf = Cur.FileList(); Vf.end() == false; ++Vf)
cout << " (" << Vf.File().FileName() << ")";
cout << endl;
- for (pkgCache::DescIterator D = Cur.DescriptionList(); D.end() == false; D++)
+ for (pkgCache::DescIterator D = Cur.DescriptionList(); D.end() == false; ++D)
{
cout << " Description Language: " << D.LanguageCode() << endl
<< " File: " << D.FileList().File().FileName() << endl
@@ -235,7 +239,7 @@ bool DumpPackage(CommandLine &CmdL)
cout << endl;
cout << "Reverse Depends: " << endl;
- for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() != true; D++)
+ for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() != true; ++D)
{
cout << " " << D.ParentPkg().FullName(true) << ',' << D.TargetPkg().FullName(true);
if (D->Version != 0)
@@ -245,24 +249,24 @@ bool DumpPackage(CommandLine &CmdL)
}
cout << "Dependencies: " << endl;
- for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; Cur++)
+ for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; ++Cur)
{
cout << Cur.VerStr() << " - ";
- for (pkgCache::DepIterator Dep = Cur.DependsList(); Dep.end() != true; Dep++)
+ for (pkgCache::DepIterator Dep = Cur.DependsList(); Dep.end() != true; ++Dep)
cout << Dep.TargetPkg().FullName(true) << " (" << (int)Dep->CompareOp << " " << DeNull(Dep.TargetVer()) << ") ";
cout << endl;
}
cout << "Provides: " << endl;
- for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; Cur++)
+ for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; ++Cur)
{
cout << Cur.VerStr() << " - ";
- for (pkgCache::PrvIterator Prv = Cur.ProvidesList(); Prv.end() != true; Prv++)
+ for (pkgCache::PrvIterator Prv = Cur.ProvidesList(); Prv.end() != true; ++Prv)
cout << Prv.ParentPkg().FullName(true) << " ";
cout << endl;
}
cout << "Reverse Provides: " << endl;
- for (pkgCache::PrvIterator Prv = Pkg.ProvidesList(); Prv.end() != true; Prv++)
+ for (pkgCache::PrvIterator Prv = Pkg.ProvidesList(); Prv.end() != true; ++Prv)
cout << Prv.OwnerPkg().FullName(true) << " " << Prv.OwnerVer().VerStr() << endl;
}
@@ -290,7 +294,7 @@ bool Stats(CommandLine &Cmd)
int DVirt = 0;
int Missing = 0;
pkgCache::PkgIterator I = Cache->PkgBegin();
- for (;I.end() != true; I++)
+ for (;I.end() != true; ++I)
{
if (I->VersionList != 0 && I->ProvidesList == 0)
{
@@ -353,11 +357,11 @@ bool Stats(CommandLine &Cmd)
cout << _("Total globbed strings: ") << Count << " (" << SizeToStr(Size) << ')' << endl;
unsigned long DepVerSize = 0;
- for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; P++)
+ for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; ++P)
{
- for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; V++)
+ for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; ++V)
{
- for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; D++)
+ for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; ++D)
{
if (D->Version != 0)
DepVerSize += strlen(D.TargetVer()) + 1;
@@ -394,17 +398,17 @@ bool Dump(CommandLine &Cmd)
cout << "Using Versioning System: " << Cache->VS->Label << endl;
- for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; P++)
+ for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; ++P)
{
cout << "Package: " << P.FullName(true) << endl;
- for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; V++)
+ for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; ++V)
{
cout << " Version: " << V.VerStr() << endl;
cout << " File: " << V.FileList().File().FileName() << endl;
- for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; D++)
+ for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; ++D)
cout << " Depends: " << D.TargetPkg().FullName(true) << ' ' <<
DeNull(D.TargetVer()) << endl;
- for (pkgCache::DescIterator D = V.DescriptionList(); D.end() == false; D++)
+ for (pkgCache::DescIterator D = V.DescriptionList(); D.end() == false; ++D)
{
cout << " Description Language: " << D.LanguageCode() << endl
<< " File: " << D.FileList().File().FileName() << endl
@@ -413,7 +417,7 @@ bool Dump(CommandLine &Cmd)
}
}
- for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F.end() == false; F++)
+ for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F.end() == false; ++F)
{
cout << "File: " << F.FileName() << endl;
cout << " Type: " << F.IndexType() << endl;
@@ -449,7 +453,7 @@ bool DumpAvail(CommandLine &Cmd)
memset(VFList,0,sizeof(*VFList)*Count);
// Map versions that we want to write out onto the VerList array.
- for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; P++)
+ for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; ++P)
{
if (P->VersionList == 0)
continue;
@@ -466,7 +470,7 @@ bool DumpAvail(CommandLine &Cmd)
}
pkgCache::VerFileIterator VF = V.FileList();
- for (; VF.end() == false ; VF++)
+ for (; VF.end() == false ; ++VF)
if ((VF.File()->Flags & pkgCache::Flag::NotSource) == 0)
break;
@@ -480,9 +484,9 @@ bool DumpAvail(CommandLine &Cmd)
handling works OK. */
if (VF.end() == true)
{
- for (pkgCache::VerIterator Cur = P.VersionList(); Cur.end() != true; Cur++)
+ for (pkgCache::VerIterator Cur = P.VersionList(); Cur.end() != true; ++Cur)
{
- for (VF = Cur.FileList(); VF.end() == false; VF++)
+ for (VF = Cur.FileList(); VF.end() == false; ++VF)
{
if ((VF.File()->Flags & pkgCache::Flag::NotSource) == 0)
{
@@ -615,7 +619,7 @@ bool ShowDepends(CommandLine &CmdL, bool const RevDepends)
if (RevDepends == true)
cout << "Reverse Depends:" << endl;
for (pkgCache::DepIterator D = RevDepends ? Pkg.RevDependsList() : Ver.DependsList();
- D.end() == false; D++)
+ D.end() == false; ++D)
{
switch (D->Type) {
case pkgCache::Dep::PreDepends: if (!ShowPreDepends) continue; break;
@@ -741,7 +745,7 @@ bool XVcg(CommandLine &CmdL)
memset(Flags,0,sizeof(*Flags)*Cache->Head().PackageCount);
// Map the shapes
- for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
+ for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; ++Pkg)
{
if (Pkg->VersionList == 0)
{
@@ -788,7 +792,7 @@ bool XVcg(CommandLine &CmdL)
while (Act == true)
{
Act = false;
- for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
+ for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; ++Pkg)
{
// See we need to show this package
if (Show[Pkg->ID] == None || Show[Pkg->ID] >= DoneNR)
@@ -814,14 +818,14 @@ bool XVcg(CommandLine &CmdL)
continue;
pkgCache::VerIterator Ver = Pkg.VersionList();
- for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
+ for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; ++D)
{
// See if anything can meet this dep
// Walk along the actual package providing versions
bool Hit = false;
pkgCache::PkgIterator DPkg = D.TargetPkg();
for (pkgCache::VerIterator I = DPkg.VersionList();
- I.end() == false && Hit == false; I++)
+ I.end() == false && Hit == false; ++I)
{
if (Cache->VS->CheckDep(I.VerStr(),D->CompareOp,D.TargetVer()) == true)
Hit = true;
@@ -829,7 +833,7 @@ bool XVcg(CommandLine &CmdL)
// Follow all provides
for (pkgCache::PrvIterator I = DPkg.ProvidesList();
- I.end() == false && Hit == false; I++)
+ I.end() == false && Hit == false; ++I)
{
if (Cache->VS->CheckDep(I.ProvideVersion(),D->CompareOp,D.TargetVer()) == false)
Hit = true;
@@ -889,7 +893,7 @@ bool XVcg(CommandLine &CmdL)
/* Draw the box colours after the fact since we can not tell what colour
they should be until everything is finished drawing */
- for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
+ for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; ++Pkg)
{
if (Show[Pkg->ID] < DoneNR)
continue;
@@ -953,7 +957,7 @@ bool Dotty(CommandLine &CmdL)
memset(Flags,0,sizeof(*Flags)*Cache->Head().PackageCount);
// Map the shapes
- for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
+ for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; ++Pkg)
{
if (Pkg->VersionList == 0)
{
@@ -1000,7 +1004,7 @@ bool Dotty(CommandLine &CmdL)
while (Act == true)
{
Act = false;
- for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
+ for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; ++Pkg)
{
// See we need to show this package
if (Show[Pkg->ID] == None || Show[Pkg->ID] >= DoneNR)
@@ -1024,14 +1028,14 @@ bool Dotty(CommandLine &CmdL)
continue;
pkgCache::VerIterator Ver = Pkg.VersionList();
- for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
+ for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; ++D)
{
// See if anything can meet this dep
// Walk along the actual package providing versions
bool Hit = false;
pkgCache::PkgIterator DPkg = D.TargetPkg();
for (pkgCache::VerIterator I = DPkg.VersionList();
- I.end() == false && Hit == false; I++)
+ I.end() == false && Hit == false; ++I)
{
if (Cache->VS->CheckDep(I.VerStr(),D->CompareOp,D.TargetVer()) == true)
Hit = true;
@@ -1039,7 +1043,7 @@ bool Dotty(CommandLine &CmdL)
// Follow all provides
for (pkgCache::PrvIterator I = DPkg.ProvidesList();
- I.end() == false && Hit == false; I++)
+ I.end() == false && Hit == false; ++I)
{
if (Cache->VS->CheckDep(I.ProvideVersion(),D->CompareOp,D.TargetVer()) == false)
Hit = true;
@@ -1094,7 +1098,7 @@ bool Dotty(CommandLine &CmdL)
/* Draw the box colours after the fact since we can not tell what colour
they should be until everything is finished drawing */
- for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
+ for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; ++Pkg)
{
if (Show[Pkg->ID] < DoneNR)
continue;
@@ -1127,7 +1131,7 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V)
// Find an appropriate file
pkgCache::VerFileIterator Vf = V.FileList();
- for (; Vf.end() == false; Vf++)
+ for (; Vf.end() == false; ++Vf)
if ((Vf.File()->Flags & pkgCache::Flag::NotSource) == 0)
break;
if (Vf.end() == true)
@@ -1272,7 +1276,7 @@ bool Search(CommandLine &CmdL)
continue;
// Include all the packages that provide matching names too
- for (pkgCache::PrvIterator Prv = P.ProvidesList() ; Prv.end() == false; Prv++)
+ for (pkgCache::PrvIterator Prv = P.ProvidesList() ; Prv.end() == false; ++Prv)
{
pkgCache::VerIterator V = Plcy->GetCandidateVer(Prv.OwnerPkg());
if (V.end() == true)
@@ -1341,13 +1345,13 @@ bool ShowAuto(CommandLine &CmdL)
std::vector<string> packages;
packages.reserve(Cache->HeaderP->PackageCount / 3);
- for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; P++)
+ for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; ++P)
if ((*DepCache)[P].Flags & pkgCache::Flag::Auto)
packages.push_back(P.Name());
std::sort(packages.begin(), packages.end());
- for (vector<string>::iterator I = packages.begin(); I != packages.end(); I++)
+ for (vector<string>::iterator I = packages.begin(); I != packages.end(); ++I)
cout << *I << "\n";
_error->Notice(_("This command is deprecated. Please use 'apt-mark showauto' instead."));
@@ -1391,7 +1395,7 @@ bool ShowPkgNames(CommandLine &CmdL)
if (CmdL.FileList[1] != 0)
{
- for (;I.end() != true; I++)
+ for (;I.end() != true; ++I)
{
if (All == false && I->FirstPackage == 0)
continue;
@@ -1405,7 +1409,7 @@ bool ShowPkgNames(CommandLine &CmdL)
}
// Show all pkgs
- for (;I.end() != true; I++)
+ for (;I.end() != true; ++I)
{
if (All == false && I->FirstPackage == 0)
continue;
@@ -1476,7 +1480,7 @@ bool Policy(CommandLine &CmdL)
if (CmdL.FileList[1] == 0)
{
cout << _("Package files:") << endl;
- for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F.end() == false; F++)
+ for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F.end() == false; ++F)
{
// Locate the associated index files so we can derive a description
pkgIndexFile *Indx;
@@ -1498,7 +1502,7 @@ bool Policy(CommandLine &CmdL)
// Show any packages have explicit pins
cout << _("Pinned packages:") << endl;
pkgCache::PkgIterator I = Cache->PkgBegin();
- for (;I.end() != true; I++)
+ for (;I.end() != true; ++I)
{
if (Plcy->GetPriority(I) == 0)
continue;
@@ -1560,14 +1564,14 @@ bool Policy(CommandLine &CmdL)
// Show the priority tables
cout << _(" Version table:") << endl;
- for (V = Pkg.VersionList(); V.end() == false; V++)
+ for (V = Pkg.VersionList(); V.end() == false; ++V)
{
if (Pkg.CurrentVer() == V)
cout << " *** " << V.VerStr();
else
cout << " " << V.VerStr();
cout << " " << Plcy->GetPriority(Pkg) << endl;
- for (pkgCache::VerFileIterator VF = V.FileList(); VF.end() == false; VF++)
+ for (pkgCache::VerFileIterator VF = V.FileList(); VF.end() == false; ++VF)
{
// Locate the associated index files so we can derive a description
pkgIndexFile *Indx;
@@ -1607,9 +1611,9 @@ bool Madison(CommandLine &CmdL)
APT::PackageSet pkgset = APT::PackageSet::FromString(CacheFile, *I, helper);
for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
{
- for (pkgCache::VerIterator V = Pkg.VersionList(); V.end() == false; V++)
+ for (pkgCache::VerIterator V = Pkg.VersionList(); V.end() == false; ++V)
{
- for (pkgCache::VerFileIterator VF = V.FileList(); VF.end() == false; VF++)
+ for (pkgCache::VerFileIterator VF = V.FileList(); VF.end() == false; ++VF)
{
// This might be nice, but wouldn't uniquely identify the source -mdz
// if (VF.File().Archive() != 0)
@@ -1619,11 +1623,11 @@ bool Madison(CommandLine &CmdL)
// }
// Locate the associated index files so we can derive a description
- for (pkgSourceList::const_iterator S = SrcList->begin(); S != SrcList->end(); S++)
+ for (pkgSourceList::const_iterator S = SrcList->begin(); S != SrcList->end(); ++S)
{
vector<pkgIndexFile *> *Indexes = (*S)->GetIndexFiles();
for (vector<pkgIndexFile *>::const_iterator IF = Indexes->begin();
- IF != Indexes->end(); IF++)
+ IF != Indexes->end(); ++IF)
{
if ((*IF)->FindInCache(*(VF.File().Cache())) == VF.File())
{
diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc
index d1268edf9..fa48debcd 100644
--- a/cmdline/apt-cdrom.cc
+++ b/cmdline/apt-cdrom.cc
@@ -11,6 +11,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include<config.h>
+
#include <apt-pkg/cmndline.h>
#include <apt-pkg/error.h>
#include <apt-pkg/init.h>
@@ -21,10 +23,8 @@
#include <apt-pkg/acquire.h>
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/cdrom.h>
-#include <config.h>
-#include <apti18n.h>
-
-//#include "indexcopy.h"
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/pkgsystem.h>
#include <locale.h>
#include <iostream>
@@ -36,6 +36,8 @@
#include <dirent.h>
#include <unistd.h>
#include <stdio.h>
+
+#include <apti18n.h>
/*}}}*/
using namespace std;
diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc
index 589ee7ada..94f6ee9b0 100644
--- a/cmdline/apt-config.cc
+++ b/cmdline/apt-config.cc
@@ -16,20 +16,22 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include<config.h>
+
#include <apt-pkg/cmndline.h>
#include <apt-pkg/error.h>
#include <apt-pkg/init.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/aptconfiguration.h>
-
-#include <config.h>
-#include <apti18n.h>
+#include <apt-pkg/pkgsystem.h>
#include <locale.h>
#include <iostream>
#include <string>
#include <vector>
+
+#include <apti18n.h>
/*}}}*/
using namespace std;
diff --git a/cmdline/apt-dump-solver.cc b/cmdline/apt-dump-solver.cc
index dab0cc6fd..e82e15c6e 100644
--- a/cmdline/apt-dump-solver.cc
+++ b/cmdline/apt-dump-solver.cc
@@ -12,6 +12,7 @@
#include <config.h>
#include <cstdio>
+#include <iostream>
/*}}}*/
// ShowHelp - Show a help screen /*{{{*/
diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc
index 07bc0c25d..d5c1a3208 100644
--- a/cmdline/apt-extracttemplates.cc
+++ b/cmdline/apt-extracttemplates.cc
@@ -13,6 +13,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include<config.h>
+
#include <apt-pkg/init.h>
#include <apt-pkg/cmndline.h>
#include <apt-pkg/pkgcache.h>
@@ -28,7 +30,8 @@
#include <apt-pkg/error.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/fileutl.h>
-
+#include <apt-pkg/pkgsystem.h>
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -36,7 +39,6 @@
#include <fstream>
#include <locale.h>
-#include <config.h>
#include <apti18n.h>
#include "apt-extracttemplates.h"
/*}}}*/
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index a81e829e8..1925dea87 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -25,8 +25,7 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
-#define _LARGEFILE_SOURCE
-#define _LARGEFILE64_SOURCE
+#include <config.h>
#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/error.h>
@@ -37,6 +36,7 @@
#include <apt-pkg/algorithms.h>
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
#include <apt-pkg/clean.h>
#include <apt-pkg/srcrecords.h>
#include <apt-pkg/version.h>
@@ -45,9 +45,10 @@
#include <apt-pkg/sptr.h>
#include <apt-pkg/md5.h>
#include <apt-pkg/versionmatch.h>
-
-#include <config.h>
-#include <apti18n.h>
+#include <apt-pkg/progress.h>
+#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/pkgrecords.h>
+#include <apt-pkg/indexfile.h>
#include "acqprogress.h"
@@ -68,8 +69,7 @@
#include <sys/wait.h>
#include <sstream>
-#define statfs statfs64
-#define statvfs statvfs64
+#include <apti18n.h>
/*}}}*/
#define RAMFS_MAGIC 0x858458f6
@@ -368,7 +368,7 @@ void ShowBroken(ostream &out,CacheFile &Cache,bool Now)
if (Start == End)
break;
- Start++;
+ ++Start;
}
}
}
@@ -542,7 +542,7 @@ bool ShowEssential(ostream &out,CacheFile &Cache)
continue;
// Print out any essential package depenendents that are to be removed
- for (pkgCache::DepIterator D = I.CurrentVer().DependsList(); D.end() == false; D++)
+ for (pkgCache::DepIterator D = I.CurrentVer().DependsList(); D.end() == false; ++D)
{
// Skip everything but depends
if (D->Type != pkgCache::Dep::PreDepends &&
@@ -579,7 +579,7 @@ void Stats(ostream &out,pkgDepCache &Dep)
unsigned long Downgrade = 0;
unsigned long Install = 0;
unsigned long ReInstall = 0;
- for (pkgCache::PkgIterator I = Dep.PkgBegin(); I.end() == false; I++)
+ for (pkgCache::PkgIterator I = Dep.PkgBegin(); I.end() == false; ++I)
{
if (Dep[I].NewInstall() == true)
Install++;
@@ -662,22 +662,22 @@ public:
pkgCache::PkgIterator Pkg = I.OwnerPkg();
if (Cache[Pkg].CandidateVerIter(Cache) == I.OwnerVer()) {
- out << " " << Pkg.FullName(true) << " " << I.OwnerVer().VerStr();
+ c1out << " " << Pkg.FullName(true) << " " << I.OwnerVer().VerStr();
if (Cache[Pkg].Install() == true && Cache[Pkg].NewInstall() == false)
- out << _(" [Installed]");
- out << endl;
+ c1out << _(" [Installed]");
+ c1out << endl;
++provider;
}
}
// if we found no candidate which provide this package, show non-candidates
if (provider == 0)
- for (I = Pkg.ProvidesList(); I.end() == false; I++)
- out << " " << I.OwnerPkg().FullName(true) << " " << I.OwnerVer().VerStr()
+ for (I = Pkg.ProvidesList(); I.end() == false; ++I)
+ c1out << " " << I.OwnerPkg().FullName(true) << " " << I.OwnerVer().VerStr()
<< _(" [Not candidate version]") << endl;
else
out << _("You should explicitly select one to install.") << endl;
} else {
- ioprintf(out,
+ ioprintf(c1out,
_("Package %s is not available, but is referred to by another package.\n"
"This may mean that the package is missing, has been obsoleted, or\n"
"is only available from another source\n"),Pkg.FullName(true).c_str());
@@ -687,7 +687,7 @@ public:
SPtrArray<bool> Seen = new bool[Cache.GetPkgCache()->Head().PackageCount];
memset(Seen,0,Cache.GetPkgCache()->Head().PackageCount*sizeof(*Seen));
for (pkgCache::DepIterator Dep = Pkg.RevDependsList();
- Dep.end() == false; Dep++) {
+ Dep.end() == false; ++Dep) {
if (Dep->Type != pkgCache::Dep::Replaces)
continue;
if (Seen[Dep.ParentPkg()->ID] == true)
@@ -696,9 +696,9 @@ public:
List += Dep.ParentPkg().FullName(true) + " ";
//VersionsList += string(Dep.ParentPkg().CurVersion) + "\n"; ???
}
- ShowList(out,_("However the following packages replace it:"),List,VersionsList);
+ ShowList(c1out,_("However the following packages replace it:"),List,VersionsList);
}
- out << std::endl;
+ c1out << std::endl;
}
return false;
}
@@ -874,9 +874,7 @@ struct TryToInstall {
struct TryToRemove {
pkgCacheFile* Cache;
pkgProblemResolver* Fix;
- bool FixBroken;
bool PurgePkgs;
- unsigned long AutoMarkChanged;
TryToRemove(pkgCacheFile &Cache, pkgProblemResolver *PM) : Cache(&Cache), Fix(PM),
PurgePkgs(_config->FindB("APT::Get::Purge", false)) {};
@@ -928,7 +926,7 @@ void CacheFile::Sort()
List = new pkgCache::Package *[Cache->Head().PackageCount];
memset(List,0,sizeof(*List)*Cache->Head().PackageCount);
pkgCache::PkgIterator I = Cache->PkgBegin();
- for (;I.end() != true; I++)
+ for (;I.end() != true; ++I)
List[I->ID] = I;
SortCache = *this;
@@ -960,7 +958,7 @@ bool CacheFile::CheckDeps(bool AllowBroken)
if ((DCache->PolicyBrokenCount() > 0))
{
// upgrade all policy-broken packages with ForceImportantDeps=True
- for (pkgCache::PkgIterator I = Cache->PkgBegin(); !I.end(); I++)
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); !I.end(); ++I)
if ((*DCache)[I].NowPolicyBroken() == true)
DCache->MarkInstall(I,true,0, false, true);
}
@@ -1051,7 +1049,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
if (_config->FindB("APT::Get::Purge",false) == true)
{
pkgCache::PkgIterator I = Cache->PkgBegin();
- for (; I.end() == false; I++)
+ for (; I.end() == false; ++I)
{
if (I.Purge() == false && Cache[I].Mode == pkgDepCache::ModeDelete)
Cache->MarkDelete(I,true);
@@ -1245,7 +1243,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
if (_config->FindB("APT::Get::Print-URIs") == true)
{
pkgAcquire::UriIterator I = Fetcher.UriBegin();
- for (; I != Fetcher.UriEnd(); I++)
+ for (; I != Fetcher.UriEnd(); ++I)
cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' <<
I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl;
return true;
@@ -1269,7 +1267,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
{
if ((*I)->Local == true)
{
- I++;
+ ++I;
continue;
}
@@ -1289,7 +1287,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
// Print out errors
bool Failed = false;
- for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++)
+ for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); ++I)
{
if ((*I)->Status == pkgAcquire::Item::StatDone &&
(*I)->Complete == true)
@@ -1449,7 +1447,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
// we have a default release, try to locate the pkg. we do it like
// this because GetCandidateVer() will not "downgrade", that means
// "apt-get source -t stable apt" won't work on a unstable system
- for (pkgCache::VerIterator Ver = Pkg.VersionList();; Ver++)
+ for (pkgCache::VerIterator Ver = Pkg.VersionList();; ++Ver)
{
// try first only exact matches, later fuzzy matches
if (Ver.end() == true)
@@ -1470,7 +1468,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
continue;
for (pkgCache::VerFileIterator VF = Ver.FileList();
- VF.end() == false; VF++)
+ VF.end() == false; ++VF)
{
/* If this is the status file, and the current version is not the
version in the status file (ie it is not installed, or somesuch)
@@ -1622,7 +1620,7 @@ bool DoUpdate(CommandLine &CmdL)
return false;
pkgAcquire::UriIterator I = Fetcher.UriBegin();
- for (; I != Fetcher.UriEnd(); I++)
+ for (; I != Fetcher.UriEnd(); ++I)
cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' <<
I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl;
return true;
@@ -1632,7 +1630,8 @@ bool DoUpdate(CommandLine &CmdL)
if (_config->FindB("APT::Get::Download",true) == true)
ListUpdate(Stat, *List);
- // Rebuild the cache.
+ // Rebuild the cache.
+ pkgCacheFile::RemoveCaches();
if (Cache.BuildCaches() == false)
return false;
@@ -1690,8 +1689,9 @@ bool DoAutomaticRemove(CacheFile &Cache)
// install it in the first place, so nuke it instead of show it
if (Cache[Pkg].Install() == true && Pkg.CurrentVer() == 0)
{
+ if (Pkg.CandVersion() != 0)
+ tooMuch.insert(Pkg);
Cache->MarkDelete(Pkg, false);
- tooMuch.insert(Pkg);
}
// only show stuff in the list that is not yet marked for removal
else if(hideAutoRemove == false && Cache[Pkg].Delete() == false)
@@ -1715,33 +1715,41 @@ bool DoAutomaticRemove(CacheFile &Cache)
bool Changed;
do {
Changed = false;
- for (APT::PackageSet::const_iterator P = tooMuch.begin();
- P != tooMuch.end() && Changed == false; ++P)
+ for (APT::PackageSet::const_iterator Pkg = tooMuch.begin();
+ Pkg != tooMuch.end() && Changed == false; ++Pkg)
{
- for (pkgCache::DepIterator R = P.RevDependsList();
- R.end() == false; ++R)
- {
- if (R.IsNegative() == true ||
- Cache->IsImportantDep(R) == false)
- continue;
- pkgCache::PkgIterator N = R.ParentPkg();
- if (N.end() == true || (N->CurrentVer == 0 && (*Cache)[N].Install() == false))
- continue;
- if (Debug == true)
- std::clog << "Save " << P << " as another installed garbage package depends on it" << std::endl;
- Cache->MarkInstall(P, false);
- if(hideAutoRemove == false)
+ APT::PackageSet too;
+ too.insert(Pkg);
+ for (pkgCache::PrvIterator Prv = Cache[Pkg].CandidateVerIter(Cache).ProvidesList();
+ Prv.end() == false; ++Prv)
+ too.insert(Prv.ParentPkg());
+ for (APT::PackageSet::const_iterator P = too.begin();
+ P != too.end() && Changed == false; ++P) {
+ for (pkgCache::DepIterator R = P.RevDependsList();
+ R.end() == false; ++R)
{
- ++autoRemoveCount;
- if (smallList == false)
- {
- autoremovelist += P.FullName(true) + " ";
- autoremoveversions += string(Cache[P].CandVersion) + "\n";
- }
+ if (R.IsNegative() == true ||
+ Cache->IsImportantDep(R) == false)
+ continue;
+ pkgCache::PkgIterator N = R.ParentPkg();
+ if (N.end() == true || (N->CurrentVer == 0 && (*Cache)[N].Install() == false))
+ continue;
+ if (Debug == true)
+ std::clog << "Save " << Pkg << " as another installed garbage package depends on it" << std::endl;
+ Cache->MarkInstall(Pkg, false);
+ if (hideAutoRemove == false)
+ {
+ ++autoRemoveCount;
+ if (smallList == false)
+ {
+ autoremovelist += Pkg.FullName(true) + " ";
+ autoremoveversions += string(Cache[Pkg].CandVersion) + "\n";
+ }
+ }
+ tooMuch.erase(Pkg);
+ Changed = true;
+ break;
}
- tooMuch.erase(P);
- Changed = true;
- break;
}
}
} while (Changed == true);
@@ -2007,7 +2015,7 @@ bool DoInstall(CommandLine &CmdL)
if(Start.TargetPkg().ProvidesList() != 0)
{
pkgCache::PrvIterator I = Start.TargetPkg().ProvidesList();
- for (; I.end() == false; I++)
+ for (; I.end() == false; ++I)
{
pkgCache::PkgIterator Pkg = I.OwnerPkg();
if (Cache[Pkg].CandidateVerIter(Cache) == I.OwnerVer() &&
@@ -2030,7 +2038,7 @@ bool DoInstall(CommandLine &CmdL)
if (Start >= End)
break;
- Start++;
+ ++Start;
}
if(foundInstalledInOrGroup == false)
@@ -2144,7 +2152,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
// Install everything with the install flag set
pkgCache::PkgIterator I = Cache->PkgBegin();
- for (;I.end() != true; I++)
+ for (;I.end() != true; ++I)
{
/* Install the package only if it is a new install, the autoupgrader
will deal with the rest */
@@ -2154,7 +2162,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
/* Now install their deps too, if we do this above then order of
the status file is significant for | groups */
- for (I = Cache->PkgBegin();I.end() != true; I++)
+ for (I = Cache->PkgBegin();I.end() != true; ++I)
{
/* Install the package only if it is a new install, the autoupgrader
will deal with the rest */
@@ -2163,7 +2171,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
}
// Apply erasures now, they override everything else.
- for (I = Cache->PkgBegin();I.end() != true; I++)
+ for (I = Cache->PkgBegin();I.end() != true; ++I)
{
// Remove packages
if (I->SelectedState == pkgCache::State::DeInstall ||
@@ -2180,7 +2188,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
// Hold back held packages.
if (_config->FindB("APT::Ignore-Hold",false) == false)
{
- for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() == false; I++)
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() == false; ++I)
{
if (I->SelectedState == pkgCache::State::Hold)
{
@@ -2212,10 +2220,14 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
/* */
bool DoClean(CommandLine &CmdL)
{
+ std::string const archivedir = _config->FindDir("Dir::Cache::archives");
+ std::string const pkgcache = _config->FindFile("Dir::cache::pkgcache");
+ std::string const srcpkgcache = _config->FindFile("Dir::cache::srcpkgcache");
+
if (_config->FindB("APT::Get::Simulate") == true)
{
- cout << "Del " << _config->FindDir("Dir::Cache::archives") << "* " <<
- _config->FindDir("Dir::Cache::archives") << "partial/*" << endl;
+ cout << "Del " << archivedir << "* " << archivedir << "partial/*"<< endl
+ << "Del " << pkgcache << " " << srcpkgcache << endl;
return true;
}
@@ -2223,14 +2235,17 @@ bool DoClean(CommandLine &CmdL)
FileFd Lock;
if (_config->FindB("Debug::NoLocking",false) == false)
{
- Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
+ Lock.Fd(GetLock(archivedir + "lock"));
if (_error->PendingError() == true)
return _error->Error(_("Unable to lock the download directory"));
}
pkgAcquire Fetcher;
- Fetcher.Clean(_config->FindDir("Dir::Cache::archives"));
- Fetcher.Clean(_config->FindDir("Dir::Cache::archives") + "partial/");
+ Fetcher.Clean(archivedir);
+ Fetcher.Clean(archivedir + "partial/");
+
+ pkgCacheFile::RemoveCaches();
+
return true;
}
/*}}}*/
@@ -2328,7 +2343,7 @@ bool DoDownload(CommandLine &CmdL)
if (_config->FindB("APT::Get::Print-URIs") == true)
{
pkgAcquire::UriIterator I = Fetcher.UriBegin();
- for (; I != Fetcher.UriEnd(); I++)
+ for (; I != Fetcher.UriEnd(); ++I)
cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' <<
I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl;
return true;
@@ -2446,7 +2461,7 @@ bool DoSource(CommandLine &CmdL)
// Load them into the fetcher
for (vector<pkgSrcRecords::File>::const_iterator I = Lst.begin();
- I != Lst.end(); I++)
+ I != Lst.end(); ++I)
{
// Try to guess what sort of file it is we are getting.
if (I->Type == "dsc")
@@ -2548,7 +2563,7 @@ bool DoSource(CommandLine &CmdL)
if (_config->FindB("APT::Get::Print-URIs") == true)
{
pkgAcquire::UriIterator I = Fetcher.UriBegin();
- for (; I != Fetcher.UriEnd(); I++)
+ for (; I != Fetcher.UriEnd(); ++I)
cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' <<
I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl;
delete[] Dsc;
@@ -2564,7 +2579,7 @@ bool DoSource(CommandLine &CmdL)
// Print error messages
bool Failed = false;
- for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++)
+ for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); ++I)
{
if ((*I)->Status == pkgAcquire::Item::StatDone &&
(*I)->Complete == true)
@@ -2593,7 +2608,7 @@ bool DoSource(CommandLine &CmdL)
if (Process == 0)
{
bool const fixBroken = _config->FindB("APT::Get::Fix-Broken", false);
- for (unsigned I = 0; I != J; I++)
+ for (unsigned I = 0; I != J; ++I)
{
string Dir = Dsc[I].Package + '-' + Cache->VS().UpstreamVersion(Dsc[I].Version.c_str());
@@ -2742,7 +2757,7 @@ bool DoBuildDep(CommandLine &CmdL)
BuildDeps.push_back(rec);
}
- if (BuildDeps.size() == 0)
+ if (BuildDeps.empty() == true)
{
ioprintf(c1out,_("%s has no build depends.\n"),Src.c_str());
continue;
@@ -2752,7 +2767,7 @@ bool DoBuildDep(CommandLine &CmdL)
vector <pkgSrcRecords::Parser::BuildDepRec>::iterator D;
pkgProblemResolver Fix(Cache);
bool skipAlternatives = false; // skip remaining alternatives in an or group
- for (D = BuildDeps.begin(); D != BuildDeps.end(); D++)
+ for (D = BuildDeps.begin(); D != BuildDeps.end(); ++D)
{
bool hasAlternatives = (((*D).Op & pkgCache::Dep::Or) == pkgCache::Dep::Or);
@@ -2931,7 +2946,7 @@ bool DoBuildDep(CommandLine &CmdL)
* installed
*/
pkgCache::PrvIterator Prv = Pkg.ProvidesList();
- for (; Prv.end() != true; Prv++)
+ for (; Prv.end() != true; ++Prv)
{
if (_config->FindB("Debug::BuildDeps",false) == true)
cout << " Checking provider " << Prv.OwnerPkg().FullName() << endl;
diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc
index ef6c688fe..1b636e4d5 100644
--- a/cmdline/apt-internal-solver.cc
+++ b/cmdline/apt-internal-solver.cc
@@ -11,10 +11,12 @@
#include <apt-pkg/cmndline.h>
#include <apt-pkg/init.h>
#include <apt-pkg/cachefile.h>
+#include <apt-pkg/cacheset.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/edsp.h>
#include <apt-pkg/algorithms.h>
#include <apt-pkg/fileutl.h>
+#include <apt-pkg/pkgsystem.h>
#include <config.h>
#include <apti18n.h>
diff --git a/cmdline/apt-key b/cmdline/apt-key
index e632be706..97d6e0323 100755
--- a/cmdline/apt-key
+++ b/cmdline/apt-key
@@ -152,7 +152,7 @@ if [ "$1" = "--keyring" ]; then
#echo "keyfile given"
shift
TRUSTEDFILE="$1"
- if [ -r "$TRUSTEDFILE" ]; then
+ if [ -r "$TRUSTEDFILE" ] || [ "$2" = 'add' ]; then
GPG="$GPG --keyring $TRUSTEDFILE --primary-keyring $TRUSTEDFILE"
else
echo >&2 "Error: The specified keyring »$TRUSTEDFILE« is missing or not readable"
diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc
index b2c664979..339cbdf44 100644
--- a/cmdline/apt-mark.cc
+++ b/cmdline/apt-mark.cc
@@ -5,17 +5,19 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cacheset.h>
#include <apt-pkg/cmndline.h>
#include <apt-pkg/error.h>
#include <apt-pkg/init.h>
#include <apt-pkg/strutl.h>
-
-#include <config.h>
-#include <apti18n.h>
+#include <apt-pkg/pkgsystem.h>
#include <algorithm>
+
+#include <apti18n.h>
/*}}}*/
using namespace std;
diff --git a/cmdline/apt-sortpkgs.cc b/cmdline/apt-sortpkgs.cc
index 171b0ba13..20ae14f2a 100644
--- a/cmdline/apt-sortpkgs.cc
+++ b/cmdline/apt-sortpkgs.cc
@@ -12,21 +12,24 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/tagfile.h>
#include <apt-pkg/error.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/cmndline.h>
#include <apt-pkg/init.h>
#include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/pkgsystem.h>
-#include <config.h>
-#include <apti18n.h>
-
#include <vector>
#include <algorithm>
#include <locale.h>
#include <unistd.h>
+
+#include <apti18n.h>
/*}}}*/
using namespace std;
@@ -106,7 +109,7 @@ bool DoIt(string InFile)
// Emit
unsigned char *Buffer = new unsigned char[Largest+1];
- for (vector<PkgName>::iterator I = List.begin(); I != List.end(); I++)
+ for (vector<PkgName>::iterator I = List.begin(); I != List.end(); ++I)
{
// Read in the Record.
if (Fd.Seek(I->Offset) == false || Fd.Read(Buffer,I->Length) == false)