From a1421e1e452e36b3f82a1cf23d2bf806ca9262c1 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Mon, 4 Apr 2011 11:57:04 +0200 Subject: install EDSP protocol description in apt-doc --- debian/apt-doc.docs | 1 + 1 file changed, 1 insertion(+) (limited to 'debian') diff --git a/debian/apt-doc.docs b/debian/apt-doc.docs index 86aa69ceb..4ec23f55d 100644 --- a/debian/apt-doc.docs +++ b/debian/apt-doc.docs @@ -1,2 +1,3 @@ README.progress-reporting README.MultiArch +doc/external-dependency-solver-protocol.txt -- cgit v1.2.3-70-g09d2 From ff859c7f94e7ba2b698208d3db43a2b3bdbbb736 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 3 May 2011 14:15:52 +0200 Subject: ship the apt-internal-solver in apt-utils package and link it to /usr/lib/apt/solvers so we have it available for playing as 'apt' --- debian/apt-utils.links | 1 + debian/rules | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 debian/apt-utils.links (limited to 'debian') diff --git a/debian/apt-utils.links b/debian/apt-utils.links new file mode 100644 index 000000000..5bf138c4a --- /dev/null +++ b/debian/apt-utils.links @@ -0,0 +1 @@ +usr/bin/apt-internal-solver usr/lib/apt/solvers/apt diff --git a/debian/rules b/debian/rules index 640900678..c8aefee63 100755 --- a/debian/rules +++ b/debian/rules @@ -62,7 +62,7 @@ configure.in: endif # APT Programs in apt-utils -APT_UTILS=ftparchive sortpkgs extracttemplates +APT_UTILS=ftparchive sortpkgs extracttemplates internal-solver # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -- cgit v1.2.3-70-g09d2 From 7f4713547665e12e032501228a98586e5add48f7 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 3 May 2011 17:27:11 +0200 Subject: add a tiny dump solver to quickly output a scenario --- cmdline/apt-dump-solver.cc | 50 ++++++++++++++++++++++++++++++++++++++++++++++ cmdline/makefile | 7 +++++++ debian/apt-utils.install | 1 + debian/apt.dirs | 1 + debian/rules | 2 +- 5 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 cmdline/apt-dump-solver.cc (limited to 'debian') diff --git a/cmdline/apt-dump-solver.cc b/cmdline/apt-dump-solver.cc new file mode 100644 index 000000000..5bcfe4f06 --- /dev/null +++ b/cmdline/apt-dump-solver.cc @@ -0,0 +1,50 @@ +// -*- mode: cpp; mode: fold -*- +// Description /*{{{*/ +/* ##################################################################### + + dummy solver to get quickly a scenario file out of APT + + ##################################################################### */ + /*}}}*/ +// Include Files /*{{{*/ +#include + +#include + +#include + /*}}}*/ + +// ShowHelp - Show a help screen /*{{{*/ +// --------------------------------------------------------------------- +/* */ +bool ShowHelp() { + + std::cout << + PACKAGE " " VERSION " for " COMMON_ARCH " compiled on " __DATE__ " " __TIME__ << std::endl << + "Usage: apt-dump-resolver\n" + "\n" + "apt-dump-resolver is a dummy solver who just dumps its input to the\n" + "file /tmp/dump.edsp and exists with a proper EDSP error.\n" + "\n" + " This dump has lost Super Cow Powers.\n"; + return true; +} + /*}}}*/ +int main(int argc,const char *argv[]) /*{{{*/ +{ + if (argc > 1 && (strcmp(argv[1], "--help") == 0 || strcmp(argv[1],"-h") == 0 || + strcmp(argv[1],"-v") == 0 || strcmp(argv[1],"--version") == 0)) { + ShowHelp(); + return 0; + } + + FILE* input = fdopen(STDIN_FILENO, "r"); + FILE* output = fopen("/tmp/dump.edsp", "w"); + char buffer[400]; + while (fgets(buffer, sizeof(buffer), input) != NULL) + fputs(buffer, output); + fclose(output); + fclose(input); + + EDSP::WriteError("I am too dumb, i can just dump!", stdout); +} diff --git a/cmdline/makefile b/cmdline/makefile index 4462ccaf4..aea5d1db5 100644 --- a/cmdline/makefile +++ b/cmdline/makefile @@ -71,3 +71,10 @@ SLIBS = -lapt-pkg $(INTLLIBS) LIB_MAKES = apt-pkg/makefile SOURCE = apt-internal-solver.cc include $(PROGRAM_H) + +# The internal solver acting as an external +PROGRAM=apt-dump-solver +SLIBS = -lapt-pkg $(INTLLIBS) +LIB_MAKES = apt-pkg/makefile +SOURCE = apt-dump-solver.cc +include $(PROGRAM_H) diff --git a/debian/apt-utils.install b/debian/apt-utils.install index d947f26d4..0c72bfdc8 100644 --- a/debian/apt-utils.install +++ b/debian/apt-utils.install @@ -1 +1,2 @@ bin/libapt-inst*.so.* usr/lib/ +bin/apt-dump-solver usr/lib/apt/solvers/dump diff --git a/debian/apt.dirs b/debian/apt.dirs index 2770d79bb..f9c0b6c3e 100644 --- a/debian/apt.dirs +++ b/debian/apt.dirs @@ -1,5 +1,6 @@ usr/bin usr/lib/apt/methods +usr/lib/apt/solvers usr/lib/dpkg/methods/apt etc/apt etc/apt/apt.conf.d diff --git a/debian/rules b/debian/rules index c8aefee63..77a7b4fdb 100755 --- a/debian/rules +++ b/debian/rules @@ -182,7 +182,7 @@ apt: build build-doc dh_install -p$@ --sourcedir=$(BLD) # Remove the bits that are in apt-utils - rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS)) + rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver) # https has its own package rm debian/$@/usr/lib/apt/methods/https -- cgit v1.2.3-70-g09d2 From 66b6fe055a0604d2a8372e61032e492f88f49f86 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 9 May 2011 21:55:32 +0200 Subject: fix package building so 'dump' is a binary not a directory --- debian/apt-utils.dirs | 2 +- debian/apt-utils.install | 1 - debian/rules | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'debian') diff --git a/debian/apt-utils.dirs b/debian/apt-utils.dirs index 14f5b95d7..681e55192 100644 --- a/debian/apt-utils.dirs +++ b/debian/apt-utils.dirs @@ -1,2 +1,2 @@ -usr/lib +usr/lib/apt/solvers usr/bin diff --git a/debian/apt-utils.install b/debian/apt-utils.install index 0c72bfdc8..d947f26d4 100644 --- a/debian/apt-utils.install +++ b/debian/apt-utils.install @@ -1,2 +1 @@ bin/libapt-inst*.so.* usr/lib/ -bin/apt-dump-solver usr/lib/apt/solvers/dump diff --git a/debian/rules b/debian/rules index 77a7b4fdb..c83796e03 100755 --- a/debian/rules +++ b/debian/rules @@ -236,8 +236,10 @@ apt-utils: build dh_installdirs -p$@ cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/ + cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump dh_install -p$@ --sourcedir=$(BLD) + dh_link -p$@ dh_installdocs -p$@ dh_installexamples -p$@ -- cgit v1.2.3-70-g09d2 From 894d672e9b7517573266cda333612e70441cbda8 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 17 May 2011 18:14:25 +0200 Subject: * apt-pkg/pkgcache.h: - clean up mess with the "all" handling in MultiArch to fix LP: #733741 cleanly for everyone now --- apt-pkg/cacheiterators.h | 4 +--- apt-pkg/deb/deblistparser.cc | 11 +++-------- apt-pkg/edsp.cc | 6 +++--- apt-pkg/packagemanager.cc | 4 ++-- apt-pkg/pkgcache.h | 17 ++++++++++------- debian/changelog | 6 ++++-- 6 files changed, 23 insertions(+), 25 deletions(-) (limited to 'debian') diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index 0c9813c6d..535253099 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -206,9 +206,7 @@ class pkgCache::VerIterator : public Iterator { inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;}; inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}; inline const char *Arch() const { - if (S->MultiArch == pkgCache::Version::All || - S->MultiArch == pkgCache::Version::AllForeign || - S->MultiArch == pkgCache::Version::AllAllowed) + if (S->MultiArch == pkgCache::Version::All) return "all"; return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch; }; diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 4a9e94c85..a94b79f05 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -128,12 +128,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver) } if (ArchitectureAll() == true) - switch (Ver->MultiArch) - { - case pkgCache::Version::Foreign: Ver->MultiArch = pkgCache::Version::AllForeign; break; - case pkgCache::Version::Allowed: Ver->MultiArch = pkgCache::Version::AllAllowed; break; - default: Ver->MultiArch = pkgCache::Version::All; - } + Ver->MultiArch |= pkgCache::Version::All; // Archive Size Ver->Size = Section.FindULL("Size"); @@ -687,12 +682,12 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver) if (MultiArchEnabled == false) return true; - else if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed) + else if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed) { string const Package = string(Ver.ParentPkg().Name()).append(":").append("any"); return NewProvidesAllArch(Ver, Package, Ver.VerStr()); } - else if (Ver->MultiArch == pkgCache::Version::Foreign || Ver->MultiArch == pkgCache::Version::AllForeign) + else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign) return NewProvidesAllArch(Ver, Ver.ParentPkg().Name(), Ver.VerStr()); return true; diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index 02ef7d04b..4d2230613 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -82,11 +82,11 @@ void EDSP::WriteScenarioVersion(pkgDepCache &Cache, FILE* output, pkgCache::PkgI if ((Pkg->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential) fprintf(output, "Essential: yes\n"); fprintf(output, "Section: %s\n", Ver.Section()); - if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed) + if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed) fprintf(output, "Multi-Arch: allowed\n"); - else if (Ver->MultiArch == pkgCache::Version::Foreign || Ver->MultiArch == pkgCache::Version::AllForeign) + else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign) fprintf(output, "Multi-Arch: foreign\n"); - else if (Ver->MultiArch == pkgCache::Version::Same) + else if ((Ver->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same) fprintf(output, "Multi-Arch: same\n"); signed short Pin = std::numeric_limits::min(); for (pkgCache::VerFileIterator File = Ver.FileList(); File.end() == false; ++File) { diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index fe9f6eb68..1ae09347a 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -319,7 +319,7 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg) List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States); } - if (Cache[Pkg].InstVerIter(Cache)->MultiArch == pkgCache::Version::Same) + if ((Cache[Pkg].InstVerIter(Cache)->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same) for (PkgIterator P = Pkg.Group().PackageList(); P.end() == false; P = Pkg.Group().NextPkg(P)) { @@ -602,7 +602,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate) List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States); - if (instVer->MultiArch == pkgCache::Version::Same) + if ((instVer->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same) for (PkgIterator P = Pkg.Group().PackageList(); P.end() == false; P = Pkg.Group().NextPkg(P)) { diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 1b1743724..280f37bca 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -500,15 +500,18 @@ struct pkgCache::Version map_ptrloc VerStr; // StringItem /** \brief section this version is filled in */ map_ptrloc Section; // StringItem + + /** \brief Multi-Arch capabilities of a package version */ + enum VerMultiArch { None = 0, /*!< is the default and doesn't trigger special behaviour */ + All = (1<<0), /*!< will cause that Ver.Arch() will report "all" */ + Foreign = (1<<1), /*!< can satisfy dependencies in another architecture */ + Same = (1<<2), /*!< can be co-installed with itself from other architectures */ + Allowed = (1<<3) /*!< other packages are allowed to depend on thispkg:any */ }; /** \brief stores the MultiArch capabilities of this version - None is the default and doesn't trigger special behaviour, - Foreign means that this version can fulfill dependencies even - if it is built for another architecture as the requester. - Same indicates that builds for different architectures can - be co-installed on the system */ - /* FIXME: A bitflag would be better with the next abibreak… */ - enum {None, All, Foreign, Same, Allowed, AllForeign, AllAllowed} MultiArch; + Flags used are defined in pkgCache::Version::VerMultiArch + */ + unsigned char MultiArch; /** \brief references all the PackageFile's that this version came from diff --git a/debian/changelog b/debian/changelog index 1b691a33d..f1f076a68 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,13 +7,15 @@ apt (0.8.15) UNRELEASED; urgency=low * provide two edsp solvers in apt-utils: - 'dump' to quickly output a complete scenario and - 'apt' to use the internal as an external resolver + * apt-pkg/pkgcache.h: + - clean up mess with the "all" handling in MultiArch to + fix LP: #733741 cleanly for everyone now [ Stefano Zacchiroli ] * doc/external-dependency-solver-protocol.txt: - describe EDSP and the configuration interface around it - - -- David Kalnischkies Tue, 17 May 2011 17:34:56 +0200 + -- David Kalnischkies Tue, 17 May 2011 17:44:16 +0200 apt (0.8.14.2) UNRELEASED; urgency=low -- cgit v1.2.3-70-g09d2 From 6935cd05677544028e0d6baefc2e29933bf5fe8b Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 17 May 2011 18:22:18 +0200 Subject: * apt-pkg/depcache.cc: - use a boolean instead of an int for Add/Remove in AddStates similar to how it works with AddSizes --- apt-pkg/depcache.cc | 5 +++-- apt-pkg/depcache.h | 6 +++--- debian/changelog | 5 ++++- 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'debian') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index a91144466..b7b2f302f 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -407,7 +407,7 @@ bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res) // DepCache::AddSizes - Add the packages sizes to the counters /*{{{*/ // --------------------------------------------------------------------- /* Call with Inverse = true to preform the inverse opration */ -void pkgDepCache::AddSizes(const PkgIterator &Pkg, bool const &Inverse) +void pkgDepCache::AddSizes(const PkgIterator &Pkg, bool const Inverse) { StateCache &P = PkgState[Pkg->ID]; @@ -478,8 +478,9 @@ void pkgDepCache::AddSizes(const PkgIterator &Pkg, bool const &Inverse) calld Remove/Add itself. Remember, dependencies can be circular so while processing a dep for Pkg it is possible that Add/Remove will be called on Pkg */ -void pkgDepCache::AddStates(const PkgIterator &Pkg,int Add) +void pkgDepCache::AddStates(const PkgIterator &Pkg, bool const Invert) { + signed char const Add = (Invert == false) ? 1 : -1; StateCache &State = PkgState[Pkg->ID]; // The Package is broken (either minimal dep or policy dep) diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index d3f9e3924..1a982ea18 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -316,10 +316,10 @@ class pkgDepCache : protected pkgCache::Namespace void Update(PkgIterator const &P); // Count manipulators - void AddSizes(const PkgIterator &Pkg, bool const &Invert = false); + void AddSizes(const PkgIterator &Pkg, bool const Invert = false); inline void RemoveSizes(const PkgIterator &Pkg) {AddSizes(Pkg, true);}; - void AddStates(const PkgIterator &Pkg,int Add = 1); - inline void RemoveStates(const PkgIterator &Pkg) {AddStates(Pkg,-1);}; + void AddStates(const PkgIterator &Pkg, bool const Invert = false); + inline void RemoveStates(const PkgIterator &Pkg) {AddStates(Pkg,true);}; public: diff --git a/debian/changelog b/debian/changelog index f1f076a68..499f7f8d8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,12 +10,15 @@ apt (0.8.15) UNRELEASED; urgency=low * apt-pkg/pkgcache.h: - clean up mess with the "all" handling in MultiArch to fix LP: #733741 cleanly for everyone now + * apt-pkg/depcache.cc: + - use a boolean instead of an int for Add/Remove in AddStates + similar to how it works with AddSizes [ Stefano Zacchiroli ] * doc/external-dependency-solver-protocol.txt: - describe EDSP and the configuration interface around it - -- David Kalnischkies Tue, 17 May 2011 17:44:16 +0200 + -- David Kalnischkies Tue, 17 May 2011 17:51:10 +0200 apt (0.8.14.2) UNRELEASED; urgency=low -- cgit v1.2.3-70-g09d2 From 3d619a202a6fbcaaaf6a6540b06c5deb3a50a3be Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 17 May 2011 18:22:46 +0200 Subject: let the Mark methods return if their marking was successful --- apt-pkg/depcache.cc | 39 +++++++++++++++++++++------------------ apt-pkg/depcache.h | 6 +++--- debian/changelog | 3 ++- 3 files changed, 26 insertions(+), 22 deletions(-) (limited to 'debian') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index b7b2f302f..f84ec25ca 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -755,17 +755,17 @@ void pkgDepCache::Update(PkgIterator const &Pkg) // DepCache::MarkKeep - Put the package in the keep state /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser, +bool pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser, unsigned long Depth) { if (IsModeChangeOk(ModeKeep, Pkg, Depth, FromUser) == false) - return; + return false; /* Reject an attempt to keep a non-source broken installed package, those must be upgraded */ if (Pkg.State() == PkgIterator::NeedsUnpack && Pkg.CurrentVer().Downloadable() == false) - return; + return false; /* We changed the soft state all the time so the UI is a bit nicer to use */ @@ -773,7 +773,7 @@ void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser, // Check that it is not already kept if (P.Mode == ModeKeep) - return; + return true; if (Soft == true) P.iFlags |= AutoKept; @@ -806,31 +806,31 @@ void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser, P.InstallVer = Pkg.CurrentVer(); AddStates(Pkg); - Update(Pkg); - AddSizes(Pkg); + + return true; } /*}}}*/ // DepCache::MarkDelete - Put the package in the delete state /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge, +bool pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge, unsigned long Depth, bool FromUser) { if (IsModeChangeOk(ModeDelete, Pkg, Depth, FromUser) == false) - return; + return false; StateCache &P = PkgState[Pkg->ID]; // Check that it is not already marked for delete if ((P.Mode == ModeDelete || P.InstallVer == 0) && (Pkg.Purge() == true || rPurge == false)) - return; + return true; // check if we are allowed to remove the package if (IsDeleteOk(Pkg,rPurge,Depth,FromUser) == false) - return; + return false; P.iFlags &= ~(AutoKept | Purge); if (rPurge == true) @@ -854,6 +854,7 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge, Update(Pkg); AddSizes(Pkg); + return true; } /*}}}*/ // DepCache::IsDeleteOk - check if it is ok to remove this package /*{{{*/ @@ -934,18 +935,18 @@ bool pkgDepCache::IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg, // DepCache::MarkInstall - Put the package in the install state /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, +bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, unsigned long Depth, bool FromUser, bool ForceImportantDeps) { if (IsModeChangeOk(ModeInstall, Pkg, Depth, FromUser) == false) - return; + return false; StateCache &P = PkgState[Pkg->ID]; // See if there is even any possible instalation candidate if (P.CandidateVer == 0) - return; + return false; /* Check that it is not already marked for install and that it can be installed */ @@ -954,13 +955,13 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, P.CandidateVer == (Version *)Pkg.CurrentVer())) { if (P.CandidateVer == (Version *)Pkg.CurrentVer() && P.InstallVer == 0) - MarkKeep(Pkg, false, FromUser, Depth+1); - return; + return MarkKeep(Pkg, false, FromUser, Depth+1); + return true; } // check if we are allowed to install the package if (IsInstallOk(Pkg,AutoInst,Depth,FromUser) == false) - return; + return false; ActionGroup group(*this); P.iFlags &= ~AutoKept; @@ -996,7 +997,7 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, AddSizes(Pkg); if (AutoInst == false || _config->Find("APT::Solver", "internal") != "internal") - return; + return true; if (DebugMarker == true) std::clog << OutputInDepth(Depth) << "MarkInstall " << Pkg << " FU=" << FromUser << std::endl; @@ -1040,7 +1041,7 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, continue; // if the dependency was critical, we can't install it, so remove it again MarkDelete(Pkg,false,Depth + 1, false); - return; + return false; } /* Check if any ImportantDep() (but not Critical) were added @@ -1179,6 +1180,8 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, continue; } } + + return true; } /*}}}*/ // DepCache::IsInstallOk - check if it is ok to install this package /*{{{*/ diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index 1a982ea18..2942558b0 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -388,11 +388,11 @@ class pkgDepCache : protected pkgCache::Namespace /** \name State Manipulators */ // @{ - void MarkKeep(PkgIterator const &Pkg, bool Soft = false, + bool MarkKeep(PkgIterator const &Pkg, bool Soft = false, bool FromUser = true, unsigned long Depth = 0); - void MarkDelete(PkgIterator const &Pkg, bool Purge = false, + bool MarkDelete(PkgIterator const &Pkg, bool Purge = false, unsigned long Depth = 0, bool FromUser = true); - void MarkInstall(PkgIterator const &Pkg,bool AutoInst = true, + bool MarkInstall(PkgIterator const &Pkg,bool AutoInst = true, unsigned long Depth = 0, bool FromUser = true, bool ForceImportantDeps = false); void MarkProtected(PkgIterator const &Pkg) { PkgState[Pkg->ID].iFlags |= Protected; }; diff --git a/debian/changelog b/debian/changelog index 499f7f8d8..837571173 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,12 +13,13 @@ apt (0.8.15) UNRELEASED; urgency=low * apt-pkg/depcache.cc: - use a boolean instead of an int for Add/Remove in AddStates similar to how it works with AddSizes + - let the Mark methods return if their marking was successful [ Stefano Zacchiroli ] * doc/external-dependency-solver-protocol.txt: - describe EDSP and the configuration interface around it - -- David Kalnischkies Tue, 17 May 2011 17:51:10 +0200 + -- David Kalnischkies Tue, 17 May 2011 17:53:44 +0200 apt (0.8.14.2) UNRELEASED; urgency=low -- cgit v1.2.3-70-g09d2 From a16dec4dbe7847597025f44f84027bb3f25f4f42 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 17 May 2011 18:23:20 +0200 Subject: if a Breaks can't be upgraded, remove it. If it or a Conflict can't be removed the installation of the breaker fails. --- apt-pkg/depcache.cc | 11 ++++++----- debian/changelog | 4 +++- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'debian') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index f84ec25ca..1d905df2e 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1172,16 +1172,17 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, continue; if (PkgState[Pkg->ID].CandidateVer != *I && - Start->Type == Dep::DpkgBreaks) - MarkInstall(Pkg,true,Depth + 1, false, ForceImportantDeps); - else - MarkDelete(Pkg,false,Depth + 1, false); + Start->Type == Dep::DpkgBreaks && + MarkInstall(Pkg,true,Depth + 1, false, ForceImportantDeps) == true) + continue; + else if (MarkDelete(Pkg,false,Depth + 1, false) == false) + break; } continue; } } - return true; + return Dep.end() == true; } /*}}}*/ // DepCache::IsInstallOk - check if it is ok to install this package /*{{{*/ diff --git a/debian/changelog b/debian/changelog index 837571173..9fc6dc193 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,12 +14,14 @@ apt (0.8.15) UNRELEASED; urgency=low - use a boolean instead of an int for Add/Remove in AddStates similar to how it works with AddSizes - let the Mark methods return if their marking was successful + - if a Breaks can't be upgraded, remove it. If it or a Conflict + can't be removed the installation of the breaker fails. [ Stefano Zacchiroli ] * doc/external-dependency-solver-protocol.txt: - describe EDSP and the configuration interface around it - -- David Kalnischkies Tue, 17 May 2011 17:53:44 +0200 + -- David Kalnischkies Tue, 17 May 2011 17:59:24 +0200 apt (0.8.14.2) UNRELEASED; urgency=low -- cgit v1.2.3-70-g09d2 From d953d210bb54accb416f2144104b79dcd29198ba Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 17 May 2011 20:20:46 +0200 Subject: * cmdline/apt-get.cc: - do not discard the error messages from the resolver and instead only show the general 'Broken packages' message if nothing else --- cmdline/apt-get.cc | 10 ++++++---- debian/changelog | 5 ++++- test/integration/test-handling-broken-orgroups | 4 ++-- test/integration/test-release-candidate-switching | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) (limited to 'debian') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index d48ca18f9..65eaef0d8 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1886,8 +1886,7 @@ bool DoInstall(CommandLine &CmdL) { // Call the scored problem resolver Fix->InstallProtect(); - if (Fix->Resolve(true) == false) - ; //FIXME: is there a valid reason for? _error->Discard(); + Fix->Resolve(true); delete Fix; } @@ -1913,8 +1912,11 @@ bool DoInstall(CommandLine &CmdL) c1out << _("The following information may help to resolve the situation:") << endl; c1out << endl; ShowBroken(c1out,Cache,false); - return _error->Error(_("Broken packages")); - } + if (_error->PendingError() == true) + return false; + else + return _error->Error(_("Broken packages")); + } } if (!DoAutomaticRemove(Cache)) return false; diff --git a/debian/changelog b/debian/changelog index 9fc6dc193..71f64dc23 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,12 +16,15 @@ apt (0.8.15) UNRELEASED; urgency=low - let the Mark methods return if their marking was successful - if a Breaks can't be upgraded, remove it. If it or a Conflict can't be removed the installation of the breaker fails. + * cmdline/apt-get.cc: + - do not discard the error messages from the resolver and instead + only show the general 'Broken packages' message if nothing else [ Stefano Zacchiroli ] * doc/external-dependency-solver-protocol.txt: - describe EDSP and the configuration interface around it - -- David Kalnischkies Tue, 17 May 2011 17:59:24 +0200 + -- David Kalnischkies Tue, 17 May 2011 18:43:21 +0200 apt (0.8.14.2) UNRELEASED; urgency=low diff --git a/test/integration/test-handling-broken-orgroups b/test/integration/test-handling-broken-orgroups index d88ad0000..20b314074 100755 --- a/test/integration/test-handling-broken-orgroups +++ b/test/integration/test-handling-broken-orgroups @@ -58,7 +58,7 @@ The following information may help to resolve the situation: The following packages have unmet dependencies: coolstuff-broken : Depends: cool2 but it is not installable or stuff2 but it is not installable -E: Broken packages' aptget install coolstuff-broken -s +E: Unable to correct problems, you have held broken packages.' aptget install coolstuff-broken -s testequal 'Reading package lists... Building dependency tree... @@ -105,4 +105,4 @@ The following information may help to resolve the situation: The following packages have unmet dependencies: coolstuff-provided-broken : Depends: cool2 but it is not installable or stuff-abi-2 -E: Broken packages' aptget install coolstuff-provided-broken -s +E: Unable to correct problems, you have held broken packages.' aptget install coolstuff-provided-broken -s diff --git a/test/integration/test-release-candidate-switching b/test/integration/test-release-candidate-switching index b6dbe99db..0970cb935 100755 --- a/test/integration/test-release-candidate-switching +++ b/test/integration/test-release-candidate-switching @@ -416,4 +416,4 @@ The following information may help to resolve the situation: The following packages have unmet dependencies: uninstallablepkg : Depends: libmtp8 (>= 10:0.20.1) but it is not going to be installed Depends: amarok-utils (= 2.3.2-2+exp) but 2.3.1-1+sid is to be installed -E: Broken packages" aptget install uninstallablepkg/experimental --trivial-only -V -q=0 +E: Unable to correct problems, you have held broken packages." aptget install uninstallablepkg/experimental --trivial-only -V -q=0 -- cgit v1.2.3-70-g09d2