summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-cache.cc49
-rw-r--r--cmdline/apt-get.cc8
2 files changed, 37 insertions, 20 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index e61914298..117a44292 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -749,9 +749,9 @@ static bool ShowDepends(CommandLine &CmdL, bool const RevDepends)
}
// Display all solutions
- SPtrArray<pkgCache::Version *> List = D.AllTargets();
- pkgPrioSortList(*Cache,List);
- for (pkgCache::Version **I = List; *I != 0; I++)
+ std::unique_ptr<pkgCache::Version *[]> List(D.AllTargets());
+ pkgPrioSortList(*Cache,List.get());
+ for (pkgCache::Version **I = List.get(); *I != 0; I++)
{
pkgCache::VerIterator V(*Cache,*I);
if (V != Cache->VerP + V.ParentPkg()->VersionList ||
@@ -1667,19 +1667,33 @@ static bool Policy(CommandLine &CmdL)
pkgCache::PkgIterator I = Cache->PkgBegin();
for (;I.end() != true; ++I)
{
- if (Plcy->GetPriority(I) == 0)
+ // Old code for debugging
+ if (_config->FindI("APT::Policy", 1) < 1) {
+ if (Plcy->GetPriority(I) == 0)
+ continue;
+
+ // Print the package name and the version we are forcing to
+ cout << " " << I.FullName(true) << " -> ";
+
+ pkgCache::VerIterator V = Plcy->GetMatch(I);
+ if (V.end() == true)
+ cout << _("(not found)") << endl;
+ else
+ cout << V.VerStr() << endl;
+
continue;
+ }
+ // New code
+ for (pkgCache::VerIterator V = I.VersionList(); !V.end(); V++) {
+ auto Prio = Plcy->GetPriority(V, false);
+ if (Prio == 0)
+ continue;
- // Print the package name and the version we are forcing to
- cout << " " << I.FullName(true) << " -> ";
-
- pkgCache::VerIterator V = Plcy->GetMatch(I);
- if (V.end() == true)
- cout << _("(not found)") << endl;
- else
- cout << V.VerStr() << endl;
- }
-
+ cout << " ";
+ // Print the package name and the version we are forcing to
+ ioprintf(cout, _("%s -> %s with priority %d\n"), I.FullName(true).c_str(), V.VerStr(), Prio);
+ }
+ }
return true;
}
@@ -1715,7 +1729,7 @@ static bool Policy(CommandLine &CmdL)
cout << V.VerStr() << endl;
// Pinned version
- if (Plcy->GetPriority(Pkg) != 0)
+ if (_config->FindI("APT::Policy", 1) < 1 && Plcy->GetPriority(Pkg) != 0)
{
cout << _(" Package pin: ");
V = Plcy->GetMatch(Pkg);
@@ -1733,7 +1747,10 @@ static bool Policy(CommandLine &CmdL)
cout << " *** " << V.VerStr();
else
cout << " " << V.VerStr();
- cout << " " << Plcy->GetPriority(V) << endl;
+ if (_config->FindI("APT::Policy", 1) < 1)
+ cout << " " << Plcy->GetPriority(Pkg) << endl;
+ else
+ cout << " " << Plcy->GetPriority(V) << endl;
for (pkgCache::VerFileIterator VF = V.FileList(); VF.end() == false; ++VF)
{
// Locate the associated index files so we can derive a description
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index b0e646833..61ed41164 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -701,7 +701,7 @@ static bool DoSource(CommandLine &CmdL)
AcqTextStatus Stat(std::cout, ScreenWidth,_config->FindI("quiet",0));
pkgAcquire Fetcher(&Stat);
- SPtrArray<DscFile> Dsc = new DscFile[CmdL.FileSize()];
+ std::unique_ptr<DscFile[]> Dsc(new DscFile[CmdL.FileSize()]);
// insert all downloaded uris into this set to avoid downloading them
// twice
@@ -1000,7 +1000,7 @@ static bool DoBuildDep(CommandLine &CmdL)
{
string Src;
pkgSrcRecords::Parser *Last = 0;
- SPtr<pkgSrcRecords::Parser> LastOwner;
+ std::unique_ptr<pkgSrcRecords::Parser> LastOwner;
// an unpacked debian source tree
using APT::String::Startswith;
@@ -1012,7 +1012,7 @@ static bool DoBuildDep(CommandLine &CmdL)
std::string TypeName = "Debian control file";
pkgIndexFile::Type *Type = pkgIndexFile::Type::GetType(TypeName.c_str());
if(Type != NULL)
- LastOwner = Last = Type->CreateSrcPkgParser(*I);
+ LastOwner.reset(Last = Type->CreateSrcPkgParser(*I));
}
// if its a local file (e.g. .dsc) use this
else if (FileExists(*I))
@@ -1023,7 +1023,7 @@ static bool DoBuildDep(CommandLine &CmdL)
string TypeName = "Debian " + flExtension(*I) + " file";
pkgIndexFile::Type *Type = pkgIndexFile::Type::GetType(TypeName.c_str());
if(Type != NULL)
- LastOwner = Last = Type->CreateSrcPkgParser(*I);
+ LastOwner.reset(Last = Type->CreateSrcPkgParser(*I));
} else {
// normal case, search the cache for the source file
Last = FindSrc(*I,SrcRecs,Src,Cache);