From fbd64f76a595b61d2aaa9c0615903d9b68786930 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 11:23:28 +0100 Subject: * apt-pkg/algorithms.cc: - mark pseudo packages of installed all packages as configured in the simulation as we don't call configure for these packages --- apt-pkg/algorithms.cc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 0fbce3c2a..0d26f8f66 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; -- cgit v1.2.3 From 6a910c9db4d450241a57f61b2d3d3e302bb9c11c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 11:32:55 +0100 Subject: allow conflicts in the same group again (Closes: #612099) --- apt-pkg/depcache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') 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(); -- cgit v1.2.3 From a1ac2ca85ae4d7c8b3ab3c4e2f3ba6c26202c363 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 11:45:06 +0100 Subject: * apt-pkg/pkgcachegen.cc: - in multiarch, let :all packages conflict with :any packages with a different version to be sure --- apt-pkg/pkgcachegen.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'apt-pkg') 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 DynP(P); for (; P.end() != true; P = G.NextPkg(P)) { - if (strcmp(P.Arch(),"all") == 0) - continue; pkgCache::PkgIterator allPkg; Dynamic DynallPkg(allPkg); pkgCache::VerIterator V = P.VersionList(); Dynamic 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); + } } } } -- cgit v1.2.3 From 8f3853baea6191788da6befb437e92ba246c86a3 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 21:42:36 +0100 Subject: * apt-pkg/contrib/error.cc: - remove 400 char size limit of error messages (LP: #365611) --- apt-pkg/contrib/error.cc | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'apt-pkg') 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 #include #include +#include #include #include @@ -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; } /*}}}*/ -- cgit v1.2.3