summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/algorithms.cc23
-rw-r--r--apt-pkg/contrib/error.cc31
-rw-r--r--apt-pkg/depcache.cc2
-rw-r--r--apt-pkg/pkgcachegen.cc18
4 files changed, 59 insertions, 15 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index fc520d744..66c182b23 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -162,7 +162,28 @@ bool pkgSimulate::Configure(PkgIterator iPkg)
}
}
-// Sim.MarkInstall(Pkg,false);
+ if (Sim[Pkg].InstBroken() == true)
+ {
+ /* We don't call Configure for Pseudo packages and if the 'all' is already installed
+ the simulation will think the pseudo package is not installed, so if something is
+ broken we walk over the dependencies and search for not installed pseudo packages */
+ for (pkgCache::DepIterator D = Sim[Pkg].InstVerIter(Sim).DependsList(); D.end() == false; D++)
+ {
+ if (Sim.IsImportantDep(D) == false ||
+ (Sim[D] & pkgDepCache::DepInstall) != 0)
+ continue;
+ pkgCache::PkgIterator T = D.TargetPkg();
+ if (T.end() == true || T->CurrentVer != 0 || Flags[T->ID] != 0)
+ continue;
+ pkgCache::PkgIterator A = T.Group().FindPkg("all");
+ if (A.end() == true || A->VersionList == 0 || A->CurrentVer == 0 ||
+ Cache.VS().CheckDep(A.CurVersion(), pkgCache::Dep::Equals, T.CandVersion()) == false)
+ continue;
+ Sim.MarkInstall(T, false);
+ Flags[T->ID] = 2;
+ }
+ }
+
if (Sim[Pkg].InstBroken() == true)
{
cout << "Conf " << Pkg.FullName(false) << " broken" << endl;
diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc
index e2e8d6e57..7dad11689 100644
--- a/apt-pkg/contrib/error.cc
+++ b/apt-pkg/contrib/error.cc
@@ -18,6 +18,7 @@
#include <iostream>
#include <errno.h>
#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
#include <string>
@@ -103,10 +104,21 @@ bool GlobalError::InsertErrno(MsgType const &type, const char *Function,
// GlobalError::InsertErrno - formats an error message with the errno /*{{{*/
bool GlobalError::InsertErrno(MsgType type, const char* Function,
const char* Description, va_list &args) {
- char S[400];
- snprintf(S, sizeof(S), "%s - %s (%i: %s)", Description,
- Function, errno, strerror(errno));
- return Insert(type, S, args);
+ int const errsv = errno;
+ char* S = (char*) malloc(400);
+ size_t const Ssize = snprintf(S, 400, "%s - %s (%i: %s)", Description,
+ Function, errsv, strerror(errsv)) + 1;
+
+ if (Ssize > 400) {
+ free(S);
+ S = (char*) malloc(Ssize);
+ snprintf(S, Ssize, "%s - %s (%i: %s)", Description,
+ Function, errsv, strerror(errsv));
+ }
+
+ bool const geins = Insert(type, S, args);
+ free(S);
+ return geins;
}
/*}}}*/
// GlobalError::Fatal - Add a fatal error to the list /*{{{*/
@@ -157,8 +169,14 @@ bool GlobalError::Insert(MsgType const &type, const char *Description,...)
// GlobalError::Insert - Insert a new item at the end /*{{{*/
bool GlobalError::Insert(MsgType type, const char* Description,
va_list &args) {
- char S[400];
- vsnprintf(S,sizeof(S),Description,args);
+ char* S = (char*) malloc(400);
+ size_t const Ssize = vsnprintf(S, 400, Description, args) + 1;
+
+ if (Ssize > 400) {
+ free(S);
+ S = (char*) malloc(Ssize);
+ vsnprintf(S, Ssize, Description, args);
+ }
Item const m(S, type);
Messages.push_back(m);
@@ -169,6 +187,7 @@ bool GlobalError::Insert(MsgType type, const char* Description,
if (type == FATAL || type == DEBUG)
std::clog << m << std::endl;
+ free(S);
return false;
}
/*}}}*/
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 5f59b6d49..7c09d3a38 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -339,7 +339,7 @@ bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res)
/* Check simple depends. A depends -should- never self match but
we allow it anyhow because dpkg does. Technically it is a packaging
bug. Conflicts may never self match */
- if (Dep.TargetPkg()->Group != Dep.ParentPkg()->Group ||
+ if (Dep.TargetPkg() != Dep.ParentPkg() ||
(Dep->Type != Dep::Conflicts && Dep->Type != Dep::DpkgBreaks && Dep->Type != Dep::Obsoletes))
{
PkgIterator Pkg = Dep.TargetPkg();
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index ed35174bb..5b943cca1 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -638,21 +638,19 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress)
Dynamic<pkgCache::PkgIterator> DynP(P);
for (; P.end() != true; P = G.NextPkg(P))
{
- if (strcmp(P.Arch(),"all") == 0)
- continue;
pkgCache::PkgIterator allPkg;
Dynamic<pkgCache::PkgIterator> DynallPkg(allPkg);
pkgCache::VerIterator V = P.VersionList();
Dynamic<pkgCache::VerIterator> DynV(V);
for (; V.end() != true; V++)
{
- string const Arch = V.Arch(true);
+ char const * const Arch = P.Arch();
map_ptrloc *OldDepLast = NULL;
/* MultiArch handling introduces a lot of implicit Dependencies:
- MultiArch: same → Co-Installable if they have the same version
- Architecture: all → Need to be Co-Installable for internal reasons
- All others conflict with all other group members */
- bool const coInstall = (V->MultiArch == pkgCache::Version::All ||
+ bool const coInstall = ((V->MultiArch == pkgCache::Version::All && strcmp(Arch, "all") != 0) ||
V->MultiArch == pkgCache::Version::Same);
if (V->MultiArch == pkgCache::Version::All && allPkg.end() == true)
allPkg = G.FindPkg("all");
@@ -686,9 +684,15 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress)
}
} else {
// Conflicts: ${self}:other
- NewDepends(D, V, "",
- pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts,
- OldDepLast);
+ if (strcmp(Arch, "all") == 0) {
+ NewDepends(D, V, V.VerStr(),
+ pkgCache::Dep::NotEquals, pkgCache::Dep::Conflicts,
+ OldDepLast);
+ } else {
+ NewDepends(D, V, "",
+ pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts,
+ OldDepLast);
+ }
}
}
}