summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-item.cc6
-rw-r--r--apt-pkg/algorithms.cc103
-rw-r--r--apt-pkg/cacheiterators.h3
-rw-r--r--apt-pkg/cdrom.cc2
-rw-r--r--apt-pkg/contrib/fileutl.cc11
-rw-r--r--apt-pkg/contrib/fileutl.h3
-rw-r--r--apt-pkg/contrib/strutl.cc2
-rw-r--r--apt-pkg/deb/debsystem.cc2
-rw-r--r--apt-pkg/deb/dpkgpm.cc6
-rw-r--r--apt-pkg/depcache.cc11
-rw-r--r--apt-pkg/indexcopy.cc11
-rw-r--r--apt-pkg/init.cc3
-rw-r--r--apt-pkg/pkgcache.cc32
-rw-r--r--apt-pkg/pkgcachegen.cc4
14 files changed, 133 insertions, 66 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index a289fb7ba..752bc6a99 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -280,7 +280,7 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile) /*{{{*/
ss >> ServerSha1 >> size;
unsigned long const ServerSize = atol(size.c_str());
- FileFd fd(CurrentPackagesFile, FileFd::ReadOnlyGzip);
+ FileFd fd(CurrentPackagesFile, FileFd::ReadOnly);
SHA1Summation SHA1;
SHA1.AddFD(fd.Fd(), fd.Size());
string const local_sha1 = SHA1.Result();
@@ -297,7 +297,7 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile) /*{{{*/
else
{
if(Debug)
- std::clog << "SHA1-Current: " << ServerSha1 << std::endl;
+ std::clog << "SHA1-Current: " << ServerSha1 << " and we start at "<< fd.Name() << " " << fd.Size() << " " << local_sha1 << std::endl;
// check the historie and see what patches we need
string const history = Tags.FindS("SHA1-History");
@@ -511,7 +511,7 @@ bool pkgAcqIndexDiffs::QueueNextDiff() /*{{{*/
string FinalFile = _config->FindDir("Dir::State::lists");
FinalFile += URItoFileName(RealURI);
- FileFd fd(FinalFile, FileFd::ReadOnlyGzip);
+ FileFd fd(FinalFile, FileFd::ReadOnly);
SHA1Summation SHA1;
SHA1.AddFD(fd.Fd(), fd.Size());
string local_sha1 = string(SHA1.Result());
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index f17c76d6c..3c8711b74 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -58,7 +58,7 @@ void pkgSimulate::Describe(PkgIterator Pkg,ostream &out,bool Current,bool Candid
{
VerIterator Ver(Sim);
- out << Pkg.Name();
+ out << Pkg.FullName(true);
if (Current == true)
{
@@ -123,9 +123,9 @@ bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/)
{
if ((Sim[End] & pkgDepCache::DepGInstall) == 0)
{
- cout << " [" << I.Name() << " on " << Start.TargetPkg().Name() << ']';
+ cout << " [" << I.FullName(false) << " on " << Start.TargetPkg().FullName(false) << ']';
if (Start->Type == pkgCache::Dep::Conflicts)
- _error->Error("Fatal, conflicts violated %s",I.Name());
+ _error->Error("Fatal, conflicts violated %s",I.FullName(false).c_str());
}
}
}
@@ -165,7 +165,7 @@ bool pkgSimulate::Configure(PkgIterator iPkg)
// Sim.MarkInstall(Pkg,false);
if (Sim[Pkg].InstBroken() == true)
{
- cout << "Conf " << Pkg.Name() << " broken" << endl;
+ cout << "Conf " << Pkg.FullName(false) << " broken" << endl;
Sim.Update();
@@ -177,17 +177,17 @@ bool pkgSimulate::Configure(PkgIterator iPkg)
continue;
if (D->Type == pkgCache::Dep::Obsoletes)
- cout << " Obsoletes:" << D.TargetPkg().Name();
+ cout << " Obsoletes:" << D.TargetPkg().FullName(false);
else if (D->Type == pkgCache::Dep::Conflicts)
- cout << " Conflicts:" << D.TargetPkg().Name();
+ cout << " Conflicts:" << D.TargetPkg().FullName(false);
else if (D->Type == pkgCache::Dep::DpkgBreaks)
- cout << " Breaks:" << D.TargetPkg().Name();
+ cout << " Breaks:" << D.TargetPkg().FullName(false);
else
- cout << " Depends:" << D.TargetPkg().Name();
+ cout << " Depends:" << D.TargetPkg().FullName(false);
}
cout << endl;
- _error->Error("Conf Broken %s",Pkg.Name());
+ _error->Error("Conf Broken %s",Pkg.FullName(false).c_str());
}
else
{
@@ -254,7 +254,7 @@ void pkgSimulate::ShortBreaks()
if (Sim[I].InstBroken() == true)
{
if (Flags[I->ID] == 0)
- cout << I.Name() << ' ';
+ cout << I.FullName(false) << ' ';
/* else
cout << I.Name() << "! ";*/
}
@@ -290,7 +290,7 @@ bool pkgApplyStatus(pkgDepCache &Cache)
Cache.MarkInstall(I, false, 0, false);
else
return _error->Error(_("The package %s needs to be reinstalled, "
- "but I can't find an archive for it."),I.Name());
+ "but I can't find an archive for it."),I.FullName(true).c_str());
}
continue;
@@ -325,7 +325,7 @@ bool pkgApplyStatus(pkgDepCache &Cache)
default:
if (I->InstState != pkgCache::State::Ok)
return _error->Error("The package %s is not ok and I "
- "don't know how to fix it!",I.Name());
+ "don't know how to fix it!",I.FullName(false).c_str());
}
}
return true;
@@ -709,7 +709,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
if ((Flags[P->ID] & Protected) == Protected)
{
if (Debug == true)
- clog << " Reinst Failed because of protected " << P.Name() << endl;
+ clog << " Reinst Failed because of protected " << P.FullName(false) << endl;
Fail = true;
}
else
@@ -720,7 +720,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
if (DoUpgrade(P) == false)
{
if (Debug == true)
- clog << " Reinst Failed because of " << P.Name() << endl;
+ clog << " Reinst Failed because of " << P.FullName(false) << endl;
Fail = true;
}
else
@@ -739,7 +739,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
break;
if (Debug == true)
- clog << " Reinst Failed early because of " << Start.TargetPkg().Name() << endl;
+ clog << " Reinst Failed early because of " << Start.TargetPkg().FullName(false) << endl;
Fail = true;
}
}
@@ -763,7 +763,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
}
if (Debug == true)
- clog << " Re-Instated " << Pkg.Name() << endl;
+ clog << " Re-Instated " << Pkg.FullName(false) << endl;
return true;
}
/*}}}*/
@@ -847,6 +847,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
not be possible for a loop to form (that is a < b < c and fixing b by
changing a breaks c) */
bool Change = true;
+ bool const TryFixByInstall = _config->FindB("pkgProblemResolver::FixByInstall", true);
for (int Counter = 0; Counter != 10 && Change == true; Counter++)
{
Change = false;
@@ -863,7 +864,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
(Flags[I->ID] & ReInstateTried) == 0)
{
if (Debug == true)
- clog << " Try to Re-Instate " << I.Name() << endl;
+ clog << " Try to Re-Instate (" << Counter << ") " << I.FullName(false) << endl;
unsigned long OldBreaks = Cache.BrokenCount();
pkgCache::Version *OldVer = Cache[I].InstallVer;
Flags[I->ID] &= ReInstateTried;
@@ -879,14 +880,14 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
}
else
if (Debug == true)
- clog << "Re-Instated " << I.Name() << " (" << OldBreaks << " vs " << Cache.BrokenCount() << ')' << endl;
+ clog << "Re-Instated " << I.FullName(false) << " (" << OldBreaks << " vs " << Cache.BrokenCount() << ')' << endl;
}
if (Cache[I].InstallVer == 0 || Cache[I].InstBroken() == false)
continue;
if (Debug == true)
- clog << "Investigating " << I.Name() << endl;
+ clog << "Investigating (" << Counter << ") " << I << endl;
// Isolate the problem dependency
PackageKill KillList[100];
@@ -904,22 +905,22 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
if (Start == End)
{
// Decide what to do
- if (InOr == true)
+ if (InOr == true && OldEnd == LEnd)
{
- if (OldEnd == LEnd && OrOp == OrRemove)
+ if (OrOp == OrRemove)
{
if ((Flags[I->ID] & Protected) != Protected)
{
if (Debug == true)
- clog << " Or group remove for " << I.Name() << endl;
+ clog << " Or group remove for " << I.FullName(false) << endl;
Cache.MarkDelete(I);
Change = true;
- }
- }
- if (OldEnd == LEnd && OrOp == OrKeep)
+ }
+ }
+ else if (OrOp == OrKeep)
{
if (Debug == true)
- clog << " Or group keep for " << I.Name() << endl;
+ clog << " Or group keep for " << I.FullName(false) << endl;
Cache.MarkKeep(I, false, false);
Change = true;
}
@@ -956,7 +957,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
}
if (Debug == true)
- clog << "Package " << I.Name() << " has broken " << Start.DepType() << " on " << Start.TargetPkg().Name() << endl;
+ clog << "Broken " << Start << endl;
/* Look across the version list. If there are no possible
targets then we keep the package and bail. This is necessary
@@ -987,8 +988,8 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
pkgCache::PkgIterator Pkg = Ver.ParentPkg();
if (Debug == true)
- clog << " Considering " << Pkg.Name() << ' ' << (int)Scores[Pkg->ID] <<
- " as a solution to " << I.Name() << ' ' << (int)Scores[I->ID] << endl;
+ clog << " Considering " << Pkg.FullName(false) << ' ' << (int)Scores[Pkg->ID] <<
+ " as a solution to " << I.FullName(false) << ' ' << (int)Scores[I->ID] << endl;
/* Try to fix the package under consideration rather than
fiddle with the VList package */
@@ -1026,7 +1027,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
Cache.MarkInstall(I, false, 0, false);
if (Debug == true)
- clog << " Holding Back " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl;
+ clog << " Holding Back " << I.FullName(false) << " rather than change " << Start.TargetPkg().FullName(false) << endl;
}
else
{
@@ -1036,11 +1037,29 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
if (InOr == false)
{
if (Debug == true)
- clog << " Removing " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl;
+ clog << " Removing " << I.FullName(false) << " rather than change " << Start.TargetPkg().FullName(false) << endl;
Cache.MarkDelete(I);
if (Counter > 1 && Scores[Pkg->ID] > Scores[I->ID])
Scores[I->ID] = Scores[Pkg->ID];
}
+ else if (TryFixByInstall == true &&
+ Start.TargetPkg()->CurrentVer == 0 &&
+ Cache[Start.TargetPkg()].Delete() == false &&
+ Cache.GetCandidateVer(Start.TargetPkg()).end() == false)
+ {
+ /* Before removing or keeping the package with the broken dependency
+ try instead to install the first not previously installed package
+ solving this dependency. This helps every time a previous solver
+ is removed by the resolver because of a conflict or alike but it is
+ dangerous as it could trigger new breaks/conflicts… */
+ if (Debug == true)
+ clog << " Try Installing " << Start.TargetPkg() << " before changing " << I.FullName(false) << std::endl;
+ unsigned long const OldBroken = Cache.BrokenCount();
+ Cache.MarkInstall(Start.TargetPkg(), true, 1, false);
+ // FIXME: we should undo the complete MarkInstall process here
+ if (Cache[Start.TargetPkg()].InstBroken() == true || Cache.BrokenCount() > OldBroken)
+ Cache.MarkDelete(Start.TargetPkg(), false, 1, false);
+ }
}
}
@@ -1068,7 +1087,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
if (Cache[End] & pkgDepCache::DepGCVer)
{
if (Debug)
- clog << " Upgrading " << Pkg.Name() << " due to Breaks field in " << I.Name() << endl;
+ clog << " Upgrading " << Pkg.FullName(false) << " due to Breaks field in " << I.FullName(false) << endl;
Cache.MarkInstall(Pkg, false, 0, false);
continue;
}
@@ -1079,7 +1098,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
continue;
if (Debug == true)
- clog << " Added " << Pkg.Name() << " to the remove list" << endl;
+ clog << " Added " << Pkg.FullName(false) << " to the remove list" << endl;
LEnd->Pkg = Pkg;
LEnd->Dep = End;
@@ -1111,12 +1130,12 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
Cache.MarkInstall(I, false, 0, false);
if (Debug == true)
- clog << " Holding Back " << I.Name() << " because I can't find " << Start.TargetPkg().Name() << endl;
+ clog << " Holding Back " << I.FullName(false) << " because I can't find " << Start.TargetPkg().FullName(false) << endl;
}
else
{
if (Debug == true)
- clog << " Removing " << I.Name() << " because I can't find " << Start.TargetPkg().Name() << endl;
+ clog << " Removing " << I.FullName(false) << " because I can't find " << Start.TargetPkg().FullName(false) << endl;
if (InOr == false)
Cache.MarkDelete(I);
}
@@ -1146,14 +1165,14 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
J->Dep->Type == pkgCache::Dep::Obsoletes)
{
if (Debug == true)
- clog << " Fixing " << I.Name() << " via remove of " << J->Pkg.Name() << endl;
+ clog << " Fixing " << I.FullName(false) << " via remove of " << J->Pkg.FullName(false) << endl;
Cache.MarkDelete(J->Pkg);
}
}
else
{
if (Debug == true)
- clog << " Fixing " << I.Name() << " via keep of " << J->Pkg.Name() << endl;
+ clog << " Fixing " << I.FullName(false) << " via keep of " << J->Pkg.FullName(false) << endl;
Cache.MarkKeep(J->Pkg, false, false);
}
@@ -1189,7 +1208,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
for (;I.end() != true; I++) {
if (Cache[I].NewInstall() && !(Flags[I->ID] & PreInstalled)) {
if(_config->FindI("Debug::pkgAutoRemove",false)) {
- std::clog << "Resolve installed new pkg: " << I.Name()
+ std::clog << "Resolve installed new pkg: " << I.FullName(false)
<< " (now marking it as auto)" << std::endl;
}
Cache[I].Flags |= pkgCache::Flag::Auto;
@@ -1252,7 +1271,7 @@ bool pkgProblemResolver::ResolveByKeep()
if ((Flags[I->ID] & Protected) == 0)
{
if (Debug == true)
- clog << "Keeping package " << I.Name() << endl;
+ clog << "Keeping package " << I.FullName(false) << endl;
Cache.MarkKeep(I, false, false);
if (Cache[I].InstBroken() == false)
{
@@ -1283,7 +1302,7 @@ bool pkgProblemResolver::ResolveByKeep()
while (true)
{
if (Debug == true)
- clog << "Package " << I.Name() << " has broken " << Start.DepType() << " on " << Start.TargetPkg().Name() << endl;
+ clog << "Package " << I.FullName(false) << " " << Start << endl;
// Look at all the possible provides on this package
SPtrArray<pkgCache::Version *> VList = Start.AllTargets();
@@ -1300,7 +1319,7 @@ bool pkgProblemResolver::ResolveByKeep()
if ((Flags[I->ID] & Protected) == 0)
{
if (Debug == true)
- clog << " Keeping Package " << Pkg.Name() << " due to " << Start.DepType() << endl;
+ clog << " Keeping Package " << Pkg.FullName(false) << " due to " << Start.DepType() << endl;
Cache.MarkKeep(Pkg, false, false);
}
@@ -1325,7 +1344,7 @@ bool pkgProblemResolver::ResolveByKeep()
// Restart again.
if (K == LastStop)
- return _error->Error("Internal Error, pkgProblemResolver::ResolveByKeep is looping on package %s.",I.Name());
+ return _error->Error("Internal Error, pkgProblemResolver::ResolveByKeep is looping on package %s.",I.FullName(false).c_str());
LastStop = K;
K = PList - 1;
}
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index 0be9368bd..26070636e 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -293,6 +293,9 @@ class pkgCache::DepIterator : public Iterator<Dependency, DepIterator> {
inline const char *CompType() const {return Owner->CompType(S->CompareOp);};
inline const char *DepType() const {return Owner->DepType(S->Type);};
+ //Nice printable representation
+ friend std::ostream& operator <<(std::ostream& out, DepIterator D);
+
inline DepIterator(pkgCache &Owner, Dependency *Trg, Version* = 0) :
Iterator<Dependency, DepIterator>(Owner, Trg), Type(DepVer) {
if (S == 0)
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index e3e0027fc..0e36f44a2 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -229,7 +229,7 @@ bool pkgCdrom::DropBinaryArch(vector<string> &List)
// Between Start and End is the architecture
Start += 8;
if ((End = strstr(Start,"/")) != 0 && Start != End &&
- APT::Configuration::checkArchitecture(string(Start, --End)) == true)
+ APT::Configuration::checkArchitecture(string(Start, End)) == true)
continue; // okay, architecture is accepted
// not accepted -> Erase it
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 2a3b8a87d..91aecee65 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -669,7 +669,7 @@ bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms)
}
break;
- case WriteEmpty:
+ case WriteAtomic:
{
Flags |= Replace;
char *name = strdup((FileName + ".XXXXXX").c_str());
@@ -678,6 +678,15 @@ bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms)
free(name);
break;
}
+
+ case WriteEmpty:
+ {
+ struct stat Buf;
+ if (lstat(FileName.c_str(),&Buf) == 0 && S_ISLNK(Buf.st_mode))
+ unlink(FileName.c_str());
+ iFd = open(FileName.c_str(),O_RDWR | O_CREAT | O_TRUNC,Perms);
+ break;
+ }
case WriteExists:
iFd = open(FileName.c_str(),O_RDWR);
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index 62705478d..cb4655798 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -46,7 +46,8 @@ class FileFd
gzFile gz;
public:
- enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp,ReadOnlyGzip};
+ enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp,ReadOnlyGzip,
+ WriteAtomic};
inline bool Read(void *To,unsigned long Size,bool AllowEof)
{
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index ace74cb37..c1844de40 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -1161,7 +1161,7 @@ void strprintf(string &out,const char *format,...)
char *safe_snprintf(char *Buffer,char *End,const char *Format,...)
{
va_list args;
- unsigned long Did;
+ int Did;
va_start(args,Format);
diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc
index 7056d771d..ab08a8f4d 100644
--- a/apt-pkg/deb/debsystem.cc
+++ b/apt-pkg/deb/debsystem.cc
@@ -165,7 +165,7 @@ bool debSystem::Initialize(Configuration &Cnf)
which is yet to be determined. The functions in pkgcachegen should
be the only users of these */
Cnf.CndSet("Dir::State::extended_states", Cnf.FindDir("Dir::State").append("extended_states"));
- Cnf.CndSet("Dir::State::status","/var/lib/dpkg/status");
+ Cnf.CndSet("Dir::State::status", Cnf.FindDir("Dir", "/").append("var/lib/dpkg/status"));
Cnf.CndSet("Dir::Bin::dpkg","/usr/bin/dpkg");
if (StatusFile) {
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index aa0b04bd5..5530ef129 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -554,7 +554,7 @@ void pkgDPkgPM::handleDisappearAction(string const &pkgname)
// the disappeared package was auto-installed - nothing to do
if ((Cache[Pkg].Flags & pkgCache::Flag::Auto) == pkgCache::Flag::Auto)
return;
- pkgCache::VerIterator PkgVer = Pkg.CurrentVer();
+ pkgCache::VerIterator PkgVer = Cache[Pkg].InstVerIter(Cache);
if (unlikely(PkgVer.end() == true))
return;
/* search in the list of dependencies for (Pre)Depends,
@@ -571,7 +571,9 @@ void pkgDPkgPM::handleDisappearAction(string const &pkgname)
// the package is already marked as manual
if ((Cache[Tar].Flags & pkgCache::Flag::Auto) != pkgCache::Flag::Auto)
continue;
- pkgCache::VerIterator TarVer = Tar.CurrentVer();
+ pkgCache::VerIterator TarVer = Cache[Tar].InstVerIter(Cache);
+ if (TarVer.end() == true)
+ continue;
for (pkgCache::DepIterator Rep = TarVer.DependsList(); Rep.end() != true; ++Rep)
{
if (Rep->Type != pkgCache::Dep::Replaces)
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index bc663a8e9..00bf68af1 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -227,7 +227,7 @@ bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly) /*{{{*/
// if it does not exist, create a empty one
if(!FileExists(state))
{
- StateFile.Open(state, FileFd::WriteEmpty);
+ StateFile.Open(state, FileFd::WriteAtomic);
StateFile.Close();
}
@@ -1425,10 +1425,13 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
VerIterator Ver(*this,*I);
PkgIterator Pkg = Ver.ParentPkg();
- if (Start->Type != Dep::DpkgBreaks)
- MarkDelete(Pkg,false,Depth + 1, false);
- else if (PkgState[Pkg->ID].CandidateVer != *I)
+
+
+ if (PkgState[Pkg->ID].CandidateVer != *I &&
+ Start->Type == Dep::DpkgBreaks)
MarkInstall(Pkg,true,Depth + 1, false, ForceImportantDeps);
+ else
+ MarkDelete(Pkg,false,Depth + 1, false);
}
continue;
}
diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc
index 621c18716..a2a1d5934 100644
--- a/apt-pkg/indexcopy.cc
+++ b/apt-pkg/indexcopy.cc
@@ -134,7 +134,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
TargetF += URItoFileName(S);
if (_config->FindB("APT::CDROM::NoAct",false) == true)
TargetF = "/dev/null";
- FileFd Target(TargetF,FileFd::WriteEmpty);
+ FileFd Target(TargetF,FileFd::WriteAtomic);
FILE *TargetFl = fdopen(dup(Target.Fd()),"w");
if (_error->PendingError() == true)
return false;
@@ -565,7 +565,7 @@ bool SigVerify::CopyMetaIndex(string CDROM, string CDName, /*{{{*/
FileFd Target;
FileFd Rel;
- Target.Open(TargetF,FileFd::WriteEmpty);
+ Target.Open(TargetF,FileFd::WriteAtomic);
Rel.Open(prefix + file,FileFd::ReadOnly);
if (_error->PendingError() == true)
return false;
@@ -661,9 +661,8 @@ bool SigVerify::RunGPGV(std::string const &File, std::string const &FileGPG,
{
string const gpgvpath = _config->Find("Dir::Bin::gpg", "/usr/bin/gpgv");
// FIXME: remove support for deprecated APT::GPGV setting
- string const trustedFile = _config->FindFile("Dir::Etc::Trusted",
- _config->Find("APT::GPGV::TrustedKeyring", "/etc/apt/trusted.gpg").c_str());
- string const trustedPath = _config->FindDir("Dir::Etc::TrustedParts", "/etc/apt/trusted.gpg.d");
+ string const trustedFile = _config->FindFile("Dir::Etc::Trusted");
+ string const trustedPath = _config->FindDir("Dir::Etc::TrustedParts");
bool const Debug = _config->FindB("Debug::Acquire::gpgv", false);
@@ -840,7 +839,7 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/
TargetF += URItoFileName(S);
if (_config->FindB("APT::CDROM::NoAct",false) == true)
TargetF = "/dev/null";
- FileFd Target(TargetF,FileFd::WriteEmpty);
+ FileFd Target(TargetF,FileFd::WriteAtomic);
FILE *TargetFl = fdopen(dup(Target.Fd()),"w");
if (_error->PendingError() == true)
return false;
diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc
index 7a332c86e..846b27313 100644
--- a/apt-pkg/init.cc
+++ b/apt-pkg/init.cc
@@ -70,6 +70,9 @@ bool pkgInitConfig(Configuration &Cnf)
Cnf.Set("Dir::Etc::parts","apt.conf.d");
Cnf.Set("Dir::Etc::preferences","preferences");
Cnf.Set("Dir::Etc::preferencesparts","preferences.d");
+ string const deprecated = _config->Find("APT::GPGV::TrustedKeyring");
+ Cnf.Set("Dir::Etc::trusted", deprecated.empty() ? "trusted.gpg" : deprecated);
+ Cnf.Set("Dir::Etc::trustedparts","trusted.gpg.d");
Cnf.Set("Dir::Bin::methods","/usr/lib/apt/methods");
Cnf.Set("Dir::Media::MountPath","/media/apt");
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 9e1f8b633..a66a5198d 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -111,7 +111,10 @@ bool pkgCache::Header::CheckSizes(Header &Against) const
/* */
pkgCache::pkgCache(MMap *Map, bool DoMap) : Map(*Map)
{
- MultiArchEnabled = APT::Configuration::getArchitectures().size() > 1;
+ // call getArchitectures() with cached=false to ensure that the
+ // architectures cache is re-evaulated. this is needed in cases
+ // when the APT::Architecture field changes between two cache creations
+ MultiArchEnabled = APT::Configuration::getArchitectures(false).size() > 1;
if (DoMap == true)
ReMap();
}
@@ -661,6 +664,30 @@ void pkgCache::DepIterator::GlobOr(DepIterator &Start,DepIterator &End)
}
}
/*}}}*/
+// ostream operator to handle string representation of a dependecy /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+std::ostream& operator<<(ostream& out, pkgCache::DepIterator D)
+{
+ if (D.end() == true)
+ return out << "invalid dependency";
+
+ pkgCache::PkgIterator P = D.ParentPkg();
+ pkgCache::PkgIterator T = D.TargetPkg();
+
+ out << (P.end() ? "invalid pkg" : P.FullName(false)) << " " << D.DepType()
+ << " on ";
+ if (T.end() == true)
+ out << "invalid pkg";
+ else
+ out << T;
+
+ if (D->Version != 0)
+ out << " (" << D.CompType() << " " << D.TargetVer() << ")";
+
+ return out;
+}
+ /*}}}*/
// VerIterator::CompareVer - Fast version compare for same pkgs /*{{{*/
// ---------------------------------------------------------------------
/* This just looks over the version list to see if B is listed before A. In
@@ -867,7 +894,8 @@ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const
pkgCache::DescIterator Desc = DescDefault;
for (; Desc.end() == false; Desc++)
- if (*l == Desc.LanguageCode())
+ if (*l == Desc.LanguageCode() ||
+ (*l == "en" && strcmp(Desc.LanguageCode(),"") == 0))
break;
if (Desc.end() == true)
Desc = DescDefault;
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index c9a9a753c..ed35174bb 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -1192,7 +1192,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
if (Writeable == true && CacheFile.empty() == false)
{
unlink(CacheFile.c_str());
- CacheF = new FileFd(CacheFile,FileFd::WriteEmpty);
+ CacheF = new FileFd(CacheFile,FileFd::WriteAtomic);
fchmod(CacheF->Fd(),0644);
Map = CreateDynamicMMap(CacheF, MMap::Public);
if (_error->PendingError() == true)
@@ -1254,7 +1254,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
// Write it back
if (Writeable == true && SrcCacheFile.empty() == false)
{
- FileFd SCacheF(SrcCacheFile,FileFd::WriteEmpty);
+ FileFd SCacheF(SrcCacheFile,FileFd::WriteAtomic);
if (_error->PendingError() == true)
return false;