summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/acquire-item.cc24
-rw-r--r--apt-pkg/algorithms.cc65
-rw-r--r--apt-pkg/algorithms.h4
-rw-r--r--apt-pkg/aptconfiguration.cc33
-rw-r--r--apt-pkg/cacheiterators.h4
-rw-r--r--apt-pkg/deb/debindexfile.h4
-rw-r--r--apt-pkg/deb/deblistparser.cc35
-rw-r--r--apt-pkg/deb/deblistparser.h11
-rw-r--r--apt-pkg/deb/dpkgpm.cc8
-rw-r--r--apt-pkg/depcache.cc158
-rw-r--r--apt-pkg/depcache.h11
-rw-r--r--apt-pkg/edsp.cc309
-rw-r--r--apt-pkg/edsp.h39
-rw-r--r--apt-pkg/edsp/edspindexfile.cc78
-rw-r--r--apt-pkg/edsp/edspindexfile.h25
-rw-r--r--apt-pkg/edsp/edsplistparser.cc87
-rw-r--r--apt-pkg/edsp/edsplistparser.h38
-rw-r--r--apt-pkg/edsp/edspsystem.cc124
-rw-r--r--apt-pkg/edsp/edspsystem.h38
-rw-r--r--apt-pkg/makefile10
-rw-r--r--apt-pkg/pkgcache.cc12
-rw-r--r--apt-pkg/pkgcache.h4
-rw-r--r--apt-pkg/pkgcachegen.cc16
-rw-r--r--apt-pkg/policy.cc4
-rw-r--r--apt-pkg/policy.h7
-rw-r--r--apt-pkg/vendor.h3
-rw-r--r--apt-pkg/vendorlist.cc11
-rw-r--r--apt-pkg/vendorlist.h3
-rw-r--r--cmdline/apt-get.cc71
-rw-r--r--cmdline/apt-internal-solver.cc129
-rw-r--r--cmdline/makefile7
-rw-r--r--debian/apt.conf.autoremove1
-rw-r--r--debian/changelog36
-rw-r--r--doc/apt_preferences.5.xml13
-rw-r--r--test/integration/framework45
-rwxr-xr-xtest/integration/test-bug-549968-install-depends-of-not-installed6
-rwxr-xr-xtest/integration/test-bug-590438-broken-provides-thanks-to-remove-order8
-rwxr-xr-xtest/integration/test-bug-593360-modifiers-in-names16
-rwxr-xr-xtest/integration/test-bug-612099-multiarch-conflicts12
-rwxr-xr-xtest/integration/test-bug-612958-use-dpkg-multiarch-config59
-rwxr-xr-xtest/integration/test-bug-618848-always-respect-user-requests32
-rwxr-xr-xtest/integration/test-release-candidate-switching30
42 files changed, 1412 insertions, 218 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 2ecb8ed6e..cf88ded7b 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -17,7 +17,6 @@
#include <apt-pkg/configuration.h>
#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/sourcelist.h>
-#include <apt-pkg/vendorlist.h>
#include <apt-pkg/error.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/fileutl.h>
@@ -1390,29 +1389,6 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/
/*}}}*/
bool pkgAcqMetaIndex::VerifyVendor(string Message) /*{{{*/
{
-// // Maybe this should be made available from above so we don't have
-// // to read and parse it every time?
-// pkgVendorList List;
-// List.ReadMainList();
-
-// const Vendor* Vndr = NULL;
-// for (std::vector<string>::const_iterator I = GPGVOutput.begin(); I != GPGVOutput.end(); I++)
-// {
-// string::size_type pos = (*I).find("VALIDSIG ");
-// if (_config->FindB("Debug::Vendor", false))
-// std::cerr << "Looking for VALIDSIG in \"" << (*I) << "\": pos " << pos
-// << std::endl;
-// if (pos != std::string::npos)
-// {
-// string Fingerprint = (*I).substr(pos+sizeof("VALIDSIG"));
-// if (_config->FindB("Debug::Vendor", false))
-// std::cerr << "Looking for \"" << Fingerprint << "\" in vendor..." <<
-// std::endl;
-// Vndr = List.FindVendor(Fingerprint) != "";
-// if (Vndr != NULL);
-// break;
-// }
-// }
string::size_type pos;
// check for missing sigs (that where not fatal because otherwise we had
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index 0b4366e5e..bbe315ef7 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -20,12 +20,15 @@
#include <apt-pkg/version.h>
#include <apt-pkg/sptr.h>
#include <apt-pkg/acquire-item.h>
-
+#include <apt-pkg/edsp.h>
+
#include <apti18n.h>
#include <sys/types.h>
#include <cstdlib>
#include <algorithm>
#include <iostream>
+
+#include <stdio.h>
/*}}}*/
using namespace std;
@@ -731,7 +734,57 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
return true;
}
/*}}}*/
-// ProblemResolver::Resolve - Run the resolution pass /*{{{*/
+// ProblemResolver::Resolve - calls a resolver to fix the situation /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool pkgProblemResolver::Resolve(bool BrokenFix)
+{
+ std::string const solver = _config->Find("APT::Solver::Name", "internal");
+
+ if (solver != "internal")
+ {
+// std::string const file = _config->FindDir("Dir::Bin::Solvers") + solver;
+ std::string const file = solver;
+ if (RealFileExists(file.c_str()) == false)
+ return _error->Error("Can't call external solver '%s' as it is not available: %s", solver.c_str(), file.c_str());
+ int external[4] = {-1, -1, -1, -1};
+ if (pipe(external) != 0 || pipe(external + 2) != 0)
+ return _error->Errno("Resolve", "Can't create needed IPC pipes for EDSP");
+ for (int i = 0; i < 4; ++i)
+ SetCloseExec(external[i], true);
+
+ pid_t Solver = ExecFork();
+ if (Solver == 0)
+ {
+ dup2(external[0], STDIN_FILENO);
+ dup2(external[3], STDOUT_FILENO);
+ const char* calling[2] = { file.c_str(), 0 };
+ execv(calling[0], (char**) calling);
+ std::cerr << "Failed to execute solver '" << solver << "'!" << std::endl;
+ _exit(100);
+ }
+ close(external[0]);
+ close(external[3]);
+
+ if (WaitFd(external[1], true, 5) == false)
+ return _error->Errno("Resolve", "Waiting on availability of solver stdin timed out");
+
+ FILE* output = fdopen(external[1], "w");
+ if (output == NULL)
+ return _error->Errno("Resolve", "fdopen on solver stdin failed");
+ EDSP::WriteRequest(Cache, output);
+ EDSP::WriteScenario(Cache, output);
+ fclose(output);
+
+ if (EDSP::ReadResponse(external[2], Cache) == false)
+ return _error->Error("Reading solver response failed");
+
+ return ExecWait(Solver, solver.c_str(), false);
+ }
+ return ResolveInternal(BrokenFix);
+}
+ /*}}}*/
+// ProblemResolver::ResolveInternal - Run the resolution pass /*{{{*/
// ---------------------------------------------------------------------
/* This routines works by calculating a score for each package. The score
is derived by considering the package's priority and all reverse
@@ -745,12 +798,10 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
The BrokenFix flag enables a mode where the algorithm tries to
upgrade packages to advoid problems. */
-bool pkgProblemResolver::Resolve(bool BrokenFix)
+bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
{
pkgDepCache::ActionGroup group(Cache);
- unsigned long Size = Cache.Head().PackageCount;
-
// Record which packages are marked for install
bool Again = false;
do
@@ -780,7 +831,9 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
clog << "Starting" << endl;
MakeScores();
-
+
+ unsigned long const Size = Cache.Head().PackageCount;
+
/* We have to order the packages so that the broken fixing pass
operates from highest score to lowest. This prevents problems when
high score packages cause the removal of lower score packages that
diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h
index cf4a98c4f..0778ec722 100644
--- a/apt-pkg/algorithms.h
+++ b/apt-pkg/algorithms.h
@@ -105,10 +105,12 @@ class pkgProblemResolver /*{{{*/
void MakeScores();
bool DoUpgrade(pkgCache::PkgIterator Pkg);
+
+ bool ResolveInternal(bool const BrokenFix = false);
public:
- inline void Protect(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] |= Protected;};
+ inline void Protect(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] |= Protected; Cache.MarkProtected(Pkg);};
inline void Remove(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] |= ToRemove;};
inline void Clear(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] &= ~(Protected | ToRemove);};
diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc
index b23e12acb..14ee09e0d 100644
--- a/apt-pkg/aptconfiguration.cc
+++ b/apt-pkg/aptconfiguration.cc
@@ -17,6 +17,7 @@
#include <sys/types.h>
#include <dirent.h>
+#include <stdio.h>
#include <algorithm>
#include <string>
@@ -314,11 +315,41 @@ std::vector<std::string> const Configuration::getArchitectures(bool const &Cache
if (likely(Cached == true) && archs.empty() == false)
return archs;
- archs = _config->FindVector("APT::Architectures");
string const arch = _config->Find("APT::Architecture");
+ archs = _config->FindVector("APT::Architectures");
+
if (unlikely(arch.empty() == true))
return archs;
+ // FIXME: It is a bit unclean to have debian specific code here…
+ if (archs.empty() == true) {
+ archs.push_back(arch);
+ string dpkgcall = _config->Find("Dir::Bin::dpkg", "dpkg");
+ std::vector<string> const dpkgoptions = _config->FindVector("DPkg::options");
+ for (std::vector<string>::const_iterator o = dpkgoptions.begin();
+ o != dpkgoptions.end(); ++o)
+ dpkgcall.append(" ").append(*o);
+ dpkgcall.append(" --print-foreign-architectures 2> /dev/null");
+ FILE *dpkg = popen(dpkgcall.c_str(), "r");
+ char buf[1024];
+ if(dpkg != NULL) {
+ if (fgets(buf, sizeof(buf), dpkg) != NULL) {
+ char* arch = strtok(buf, " ");
+ while (arch != NULL) {
+ for (; isspace(*arch) != 0; ++arch);
+ if (arch != '\0') {
+ char const* archend = arch;
+ for (; isspace(*archend) == 0 && *archend != '\0'; ++archend);
+ archs.push_back(string(arch, (archend - arch)));
+ }
+ arch = strtok(NULL, " ");
+ }
+ }
+ pclose(dpkg);
+ }
+ return archs;
+ }
+
if (archs.empty() == true ||
std::find(archs.begin(), archs.end(), arch) == archs.end())
archs.push_back(arch);
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index 31b3aced3..8f9f811da 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -206,6 +206,10 @@ class pkgCache::VerIterator : public Iterator<Version, VerIterator> {
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)
+ return "all";
return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch;
};
__deprecated inline const char *Arch(bool const pseudo) const {
diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h
index b5085992d..6697c5f26 100644
--- a/apt-pkg/deb/debindexfile.h
+++ b/apt-pkg/deb/debindexfile.h
@@ -22,8 +22,9 @@
class debStatusIndex : public pkgIndexFile
{
+ protected:
string File;
-
+
public:
virtual const Type *GetType() const;
@@ -36,6 +37,7 @@ class debStatusIndex : public pkgIndexFile
virtual bool HasPackages() const {return true;};
virtual unsigned long Size() const;
virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
+ bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog, unsigned long const Flag) const;
virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
debStatusIndex(string File);
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index edc001abb..4be626741 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -106,7 +106,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
Ver->MultiArch = pkgCache::Version::None;
else if (MultiArch == "same") {
// Parse multi-arch
- if (Section.FindS("Architecture") == "all")
+ if (ArchitectureAll() == true)
{
/* Arch all packages can't be Multi-Arch: same */
_error->Warning("Architecture: all package '%s' can't be Multi-Arch: same",
@@ -127,6 +127,14 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
Ver->MultiArch = pkgCache::Version::None;
}
+ 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;
+ }
+
// Archive Size
Ver->Size = Section.FindULL("Size");
// Unpacked Size (in K)
@@ -624,7 +632,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver,
while (1)
{
- Start = ParseDepends(Start,Stop,Package,Version,Op);
+ Start = ParseDepends(Start,Stop,Package,Version,Op,false,!MultiArchEnabled);
if (Start == 0)
return _error->Error("Problem parsing dependency %s",Tag);
@@ -677,27 +685,28 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver)
}
}
- if (Ver->MultiArch == pkgCache::Version::Allowed)
+ if (MultiArchEnabled == false)
+ return true;
+ else if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed)
{
string const Package = string(Ver.ParentPkg().Name()).append(":").append("any");
- NewProvides(Ver, Package, "any", Ver.VerStr());
+ return NewProvidesAllArch(Ver, Package, Ver.VerStr());
}
+ else if (Ver->MultiArch == pkgCache::Version::Foreign || Ver->MultiArch == pkgCache::Version::AllForeign)
+ return NewProvidesAllArch(Ver, Ver.ParentPkg().Name(), Ver.VerStr());
- if (Ver->MultiArch != pkgCache::Version::Foreign)
- return true;
-
- if (MultiArchEnabled == false)
- return true;
-
- string const Package = Ver.ParentPkg().Name();
- string const Version = Ver.VerStr();
+ return true;
+}
+ /*}}}*/
+// ListParser::NewProvides - add provides for all architectures /*{{{*/
+bool debListParser::NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package,
+ string const &Version) {
for (std::vector<string>::const_iterator a = Architectures.begin();
a != Architectures.end(); ++a)
{
if (NewProvides(Ver, Package, *a, Version) == false)
return false;
}
-
return true;
}
/*}}}*/
diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h
index 4bc1bd93c..8b8aff788 100644
--- a/apt-pkg/deb/deblistparser.h
+++ b/apt-pkg/deb/deblistparser.h
@@ -25,9 +25,9 @@ class debListParser : public pkgCacheGenerator::ListParser
const char *Str;
unsigned char Val;
};
-
- private:
-
+
+ protected:
+
pkgTagFile Tags;
pkgTagSection Section;
unsigned long iOffset;
@@ -36,10 +36,11 @@ class debListParser : public pkgCacheGenerator::ListParser
bool MultiArchEnabled;
unsigned long UniqFindTagWrite(const char *Tag);
- bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
+ virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag,
unsigned int Type);
bool ParseProvides(pkgCache::VerIterator &Ver);
+ bool NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package, string const &Version);
static bool GrabWord(string Word,WordList *List,unsigned char &Out);
public:
@@ -69,7 +70,7 @@ class debListParser : public pkgCacheGenerator::ListParser
static const char *ParseDepends(const char *Start,const char *Stop,
string &Package,string &Ver,unsigned int &Op,
bool const &ParseArchFlags = false,
- bool const &StripMultiArch = false);
+ bool const &StripMultiArch = true);
static const char *ConvertRelation(const char *I,unsigned int &Op);
debListParser(FileFd *File, string const &Arch = "");
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index eb9abe909..01808be24 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -1002,6 +1002,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
else
{
string const nativeArch = _config->Find("APT::Architecture");
+ unsigned long const oldSize = I->Op == Item::Configure ? Size : 0;
for (;I != J && Size < MaxArgBytes; I++)
{
if((*I).Pkg.end() == true)
@@ -1016,8 +1017,11 @@ bool pkgDPkgPM::Go(int OutStatusFd)
Args[n++] = Packages[pkgcount++];
}
Size += strlen(Args[n-1]);
- }
- }
+ }
+ // skip configure action if all sheduled packages disappeared
+ if (oldSize == Size)
+ continue;
+ }
Args[n] = 0;
J = I;
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index fba6ad054..ed9e2084c 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -819,8 +819,7 @@ void pkgDepCache::Update(PkgIterator const &Pkg)
void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser,
unsigned long Depth)
{
- // Simplifies other routines.
- if (Pkg.end() == true)
+ if (IsModeChangeOk(ModeKeep, Pkg, Depth, FromUser) == false)
return;
/* Reject an attempt to keep a non-source broken installed package, those
@@ -828,25 +827,22 @@ void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser,
if (Pkg.State() == PkgIterator::NeedsUnpack &&
Pkg.CurrentVer().Downloadable() == false)
return;
-
- /** \todo Can this be moved later in the method? */
- ActionGroup group(*this);
/* We changed the soft state all the time so the UI is a bit nicer
to use */
StateCache &P = PkgState[Pkg->ID];
+
+ // Check that it is not already kept
+ if (P.Mode == ModeKeep)
+ return;
+
if (Soft == true)
P.iFlags |= AutoKept;
else
P.iFlags &= ~AutoKept;
-
- // Check that it is not already kept
- if (P.Mode == ModeKeep)
- return;
- // We dont even try to keep virtual packages..
- if (Pkg->VersionList == 0)
- return;
+ ActionGroup group(*this);
+
#if 0 // reseting the autoflag here means we lose the
// auto-mark information if a user selects a package for removal
// but changes his mind then and sets it for keep again
@@ -883,30 +879,26 @@ void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser,
void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge,
unsigned long Depth, bool FromUser)
{
- // Simplifies other routines.
- if (Pkg.end() == true)
+ if (IsModeChangeOk(ModeDelete, Pkg, Depth, FromUser) == false)
return;
- ActionGroup group(*this);
+ StateCache &P = PkgState[Pkg->ID];
// Check that it is not already marked for delete
- StateCache &P = PkgState[Pkg->ID];
- P.iFlags &= ~(AutoKept | Purge);
- if (rPurge == true)
- P.iFlags |= Purge;
-
if ((P.Mode == ModeDelete || P.InstallVer == 0) &&
(Pkg.Purge() == true || rPurge == false))
return;
-
- // We dont even try to delete virtual packages..
- if (Pkg->VersionList == 0)
- return;
- // check if we are allowed to install the package
+ // check if we are allowed to remove the package
if (IsDeleteOk(Pkg,rPurge,Depth,FromUser) == false)
return;
+ P.iFlags &= ~(AutoKept | Purge);
+ if (rPurge == true)
+ P.iFlags |= Purge;
+
+ ActionGroup group(*this);
+
if (DebugMarker == true)
std::clog << OutputInDepth(Depth) << (rPurge ? "MarkPurge " : "MarkDelete ") << Pkg << " FU=" << FromUser << std::endl;
@@ -927,19 +919,12 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge,
/*}}}*/
// DepCache::IsDeleteOk - check if it is ok to remove this package /*{{{*/
// ---------------------------------------------------------------------
-/* The default implementation just honors dpkg hold
- But an application using this library can override this method
- to control the MarkDelete behaviour */
+/* The default implementation tries to prevent deletion of install requests.
+ dpkg holds are enforced by the private IsModeChangeOk */
bool pkgDepCache::IsDeleteOk(PkgIterator const &Pkg,bool rPurge,
unsigned long Depth, bool FromUser)
{
- if (FromUser == false && Pkg->SelectedState == pkgCache::State::Hold && _config->FindB("APT::Ignore-Hold",false) == false)
- {
- if (DebugMarker == true)
- std::clog << OutputInDepth(Depth) << "Hold prevents MarkDelete of " << Pkg << " FU=" << FromUser << std::endl;
- return false;
- }
- else if (FromUser == false && Pkg->CurrentVer == 0)
+ if (FromUser == false && Pkg->CurrentVer == 0)
{
StateCache &P = PkgState[Pkg->ID];
if (P.InstallVer != 0 && P.Status == 2 && (P.Flags & Flag::Auto) != Flag::Auto)
@@ -952,6 +937,61 @@ bool pkgDepCache::IsDeleteOk(PkgIterator const &Pkg,bool rPurge,
return true;
}
/*}}}*/
+// DepCache::IsModeChangeOk - check if it is ok to change the mode /*{{{*/
+// ---------------------------------------------------------------------
+/* this is used by all Mark methods on the very first line to check sanity
+ and prevents mode changes for packages on hold for example.
+ If you want to check Mode specific stuff you can use the virtual public
+ Is<Mode>Ok methods instead */
+char const* PrintMode(char const mode)
+{
+ switch (mode)
+ {
+ case pkgDepCache::ModeInstall: return "Install";
+ case pkgDepCache::ModeKeep: return "Keep";
+ case pkgDepCache::ModeDelete: return "Delete";
+ default: return "UNKNOWN";
+ }
+}
+bool pkgDepCache::IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg,
+ unsigned long const Depth, bool const FromUser)
+{
+ // we are not trying to hard…
+ if (unlikely(Depth > 100))
+ return false;
+
+ // general sanity
+ if (unlikely(Pkg.end() == true || Pkg->VersionList == 0))
+ return false;
+
+ // the user is always right
+ if (FromUser == true)
+ return true;
+
+ StateCache &P = PkgState[Pkg->ID];
+
+ // if previous state was set by user only user can reset it
+ if ((P.iFlags & Protected) == Protected)
+ {
+ if (unlikely(DebugMarker == true) && P.Mode != mode)
+ std::clog << OutputInDepth(Depth) << "Ignore Mark" << PrintMode(mode)
+ << " of " << Pkg << " as its mode (" << PrintMode(P.Mode)
+ << ") is protected" << std::endl;
+ return false;
+ }
+ // enforce dpkg holds
+ else if (mode != ModeKeep && Pkg->SelectedState == pkgCache::State::Hold &&
+ _config->FindB("APT::Ignore-Hold",false) == false)
+ {
+ if (unlikely(DebugMarker == true) && P.Mode != mode)
+ std::clog << OutputInDepth(Depth) << "Hold prevents Mark" << PrintMode(mode)
+ << " of " << Pkg << std::endl;
+ return false;
+ }
+
+ return true;
+}
+ /*}}}*/
// DepCache::MarkInstall - Put the package in the install state /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -959,19 +999,17 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
unsigned long Depth, bool FromUser,
bool ForceImportantDeps)
{
- if (Depth > 100)
+ if (IsModeChangeOk(ModeInstall, Pkg, Depth, FromUser) == false)
return;
-
- // Simplifies other routines.
- if (Pkg.end() == true)
+
+ StateCache &P = PkgState[Pkg->ID];
+
+ // See if there is even any possible instalation candidate
+ if (P.CandidateVer == 0)
return;
-
- ActionGroup group(*this);
/* Check that it is not already marked for install and that it can be
installed */
- StateCache &P = PkgState[Pkg->ID];
- P.iFlags &= ~AutoKept;
if ((P.InstPolicyBroken() == false && P.InstBroken() == false) &&
(P.Mode == ModeInstall ||
P.CandidateVer == (Version *)Pkg.CurrentVer()))
@@ -981,17 +1019,13 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
return;
}
- // See if there is even any possible instalation candidate
- if (P.CandidateVer == 0)
- return;
- // We dont even try to install virtual packages..
- if (Pkg->VersionList == 0)
- return;
-
// check if we are allowed to install the package
if (IsInstallOk(Pkg,AutoInst,Depth,FromUser) == false)
return;
+ ActionGroup group(*this);
+ P.iFlags &= ~AutoKept;
+
/* Target the candidate version and remove the autoflag. We reset the
autoflag below if this was called recursively. Otherwise the user
should have the ability to de-auto a package by changing its state */
@@ -1022,7 +1056,7 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
Update(Pkg);
AddSizes(Pkg);
- if (AutoInst == false)
+ if (AutoInst == false || _config->Find("APT::Solver::Name", "internal") != "internal")
return;
if (DebugMarker == true)
@@ -1204,18 +1238,11 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
/*}}}*/
// DepCache::IsInstallOk - check if it is ok to install this package /*{{{*/
// ---------------------------------------------------------------------
-/* The default implementation just honors dpkg hold
- But an application using this library can override this method
- to control the MarkInstall behaviour */
+/* The default implementation does nothing.
+ dpkg holds are enforced by the private IsModeChangeOk */
bool pkgDepCache::IsInstallOk(PkgIterator const &Pkg,bool AutoInst,
unsigned long Depth, bool FromUser)
{
- if (FromUser == false && Pkg->SelectedState == pkgCache::State::Hold && _config->FindB("APT::Ignore-Hold",false) == false)
- {
- if (DebugMarker == true)
- std::clog << OutputInDepth(Depth) << "Hold prevents MarkInstall of " << Pkg << " FU=" << FromUser << std::endl;
- return false;
- }
return true;
}
/*}}}*/
@@ -1240,11 +1267,6 @@ void pkgDepCache::SetReInstall(PkgIterator const &Pkg,bool To)
AddStates(Pkg);
AddSizes(Pkg);
-
- if (unlikely(Pkg.CurrentVer().end() == true))
- return;
-
- SetReInstall(Pkg.Group().FindPkg("all"), To);
}
/*}}}*/
// DepCache::SetCandidateVersion - Change the candidate version /*{{{*/
@@ -1556,6 +1578,12 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator const &Dep)
return false;
}
/*}}}*/
+// Policy::GetPriority - Get the priority of the package pin /*{{{*/
+signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgIterator const &Pkg)
+{ return 0; };
+signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgFileIterator const &File)
+{ return 0; };
+ /*}}}*/
pkgDepCache::InRootSetFunc *pkgDepCache::GetRootSetFunc() /*{{{*/
{
DefaultRootSetFunc *f = new DefaultRootSetFunc;
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index b95681118..b15cd527d 100644
--- a/apt-pkg/depcache.h
+++ b/apt-pkg/depcache.h
@@ -119,7 +119,7 @@ class pkgDepCache : protected pkgCache::Namespace
DepCandPolicy = (1 << 4), DepCandMin = (1 << 5)};
// These flags are used in StateCache::iFlags
- enum InternalFlags {AutoKept = (1 << 0), Purge = (1 << 1), ReInstall = (1 << 2)};
+ enum InternalFlags {AutoKept = (1 << 0), Purge = (1 << 1), ReInstall = (1 << 2), Protected = (1 << 3)};
enum VersionTypes {NowVersion, InstallVersion, CandidateVersion};
enum ModeList {ModeDelete = 0, ModeKeep = 1, ModeInstall = 2};
@@ -258,7 +258,9 @@ class pkgDepCache : protected pkgCache::Namespace
virtual VerIterator GetCandidateVer(PkgIterator const &Pkg);
virtual bool IsImportantDep(DepIterator const &Dep);
-
+ virtual signed short GetPriority(PkgIterator const &Pkg);
+ virtual signed short GetPriority(PkgFileIterator const &File);
+
virtual ~Policy() {};
};
@@ -393,6 +395,7 @@ class pkgDepCache : protected pkgCache::Namespace
void 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; };
void SetReInstall(PkgIterator const &Pkg,bool To);
// FIXME: Remove the unused boolean parameter on abi break
@@ -486,6 +489,10 @@ class pkgDepCache : protected pkgCache::Namespace
__deprecated bool RemovePseudoInstalledPkg(PkgIterator &Pkg, std::set<unsigned long> &recheck) { return true; };
__deprecated bool ReInstallPseudoForGroup(unsigned long const &Grp, std::set<unsigned long> &recheck) { return true; };
__deprecated bool ReInstallPseudoForGroup(pkgCache::PkgIterator const &P, std::set<unsigned long> &recheck) { return true; };
+
+
+ bool IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg,
+ unsigned long const Depth, bool const FromUser);
};
#endif
diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc
new file mode 100644
index 000000000..e6dc16536
--- /dev/null
+++ b/apt-pkg/edsp.cc
@@ -0,0 +1,309 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+ Set of methods to help writing and reading everything needed for EDSP
+ ##################################################################### */
+ /*}}}*/
+// Include Files /*{{{*/
+#include <apt-pkg/edsp.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/version.h>
+#include <apt-pkg/policy.h>
+#include <apt-pkg/tagfile.h>
+
+#include <apti18n.h>
+#include <limits>
+
+#include <stdio.h>
+ /*}}}*/
+
+// EDSP::WriteScenario - to the given file descriptor /*{{{*/
+bool EDSP::WriteScenario(pkgDepCache &Cache, FILE* output)
+{
+ // we could use pkgCache::DepType and ::Priority, but these would be lokalized strings…
+ const char * const PrioMap[] = {0, "important", "required", "standard",
+ "optional", "extra"};
+ const char * const DepMap[] = {"", "Depends", "PreDepends", "Suggests",
+ "Recommends" , "Conflicts", "Replaces",
+ "Obsoletes", "Breaks", "Enhances"};
+
+ for (pkgCache::PkgIterator Pkg = Cache.PkgBegin(); Pkg.end() == false; ++Pkg)
+ {
+ for (pkgCache::VerIterator Ver = Pkg.VersionList(); Ver.end() == false; ++Ver)
+ {
+ fprintf(output, "Package: %s\n", Pkg.Name());
+ fprintf(output, "Architecture: %s\n", Ver.Arch());
+ fprintf(output, "Version: %s\n", Ver.VerStr());
+ if (Pkg.CurrentVer() == Ver)
+ fprintf(output, "Installed: yes\n");
+ if (Pkg->SelectedState == pkgCache::State::Hold)
+ fprintf(output, "Hold: yes\n");
+ fprintf(output, "APT-ID: %u\n", Ver->ID);
+ fprintf(output, "Priority: %s\n", PrioMap[Ver->Priority]);
+ 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)
+ fprintf(output, "Multi-Arch: allowed\n");
+ else if (Ver->MultiArch == pkgCache::Version::Foreign || Ver->MultiArch == pkgCache::Version::AllForeign)
+ fprintf(output, "Multi-Arch: foreign\n");
+ else if (Ver->MultiArch == pkgCache::Version::Same)
+ fprintf(output, "Multi-Arch: same\n");
+ signed short Pin = std::numeric_limits<signed short>::min();
+ for (pkgCache::VerFileIterator File = Ver.FileList(); File.end() == false; ++File) {
+ signed short const p = Cache.GetPolicy().GetPriority(File.File());
+ if (Pin < p)
+ Pin = p;
+ }
+ fprintf(output, "APT-Pin: %d\n", Pin);
+ if (Cache.GetCandidateVer(Pkg) == Ver)
+ fprintf(output, "APT-Candidate: yes\n");
+ if ((Cache[Pkg].Flags & pkgCache::Flag::Auto) == pkgCache::Flag::Auto)
+ fprintf(output, "APT-Automatic: yes\n");
+ std::string dependencies[pkgCache::Dep::Enhances + 1];
+ bool orGroup = false;
+ for (pkgCache::DepIterator Dep = Ver.DependsList(); Dep.end() == false; ++Dep)
+ {
+ // Ignore implicit dependencies for multiarch here
+ if (strcmp(Pkg.Arch(), Dep.TargetPkg().Arch()) != 0)
+ continue;
+ if (orGroup == false)
+ dependencies[Dep->Type].append(", ");
+ dependencies[Dep->Type].append(Dep.TargetPkg().Name());
+ if (Dep->Version != 0)
+ dependencies[Dep->Type].append(" (").append(pkgCache::CompTypeDeb(Dep->CompareOp)).append(" ").append(Dep.TargetVer()).append(")");
+ if ((Dep->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or)
+ {
+ dependencies[Dep->Type].append(" | ");
+ orGroup = true;
+ }
+ else
+ orGroup = false;
+ }
+ for (int i = 1; i < pkgCache::Dep::Enhances + 1; ++i)
+ if (dependencies[i].empty() == false)
+ fprintf(output, "%s: %s\n", DepMap[i], dependencies[i].c_str()+2);
+ string provides;
+ for (pkgCache::PrvIterator Prv = Ver.ProvidesList(); Prv.end() == false; ++Prv)
+ {
+ // Ignore implicit provides for multiarch here
+ if (strcmp(Pkg.Arch(), Prv.ParentPkg().Arch()) != 0 || strcmp(Pkg.Name(),Prv.Name()) == 0)
+ continue;
+ provides.append(", ").append(Prv.Name());
+ }
+ if (provides.empty() == false)
+ fprintf(output, "Provides: %s\n", provides.c_str()+2);
+
+
+ fprintf(output, "\n");
+ }
+ }
+ return true;
+}
+ /*}}}*/
+// EDSP::WriteRequest - to the given file descriptor /*{{{*/
+bool EDSP::WriteRequest(pkgDepCache &Cache, FILE* output, bool const Upgrade,
+ bool const DistUpgrade, bool const AutoRemove)
+{
+ string del, inst;
+ for (pkgCache::PkgIterator Pkg = Cache.PkgBegin(); Pkg.end() == false; ++Pkg)
+ {
+ string* req;
+ if (Cache[Pkg].Delete() == true)
+ req = &del;
+ else if (Cache[Pkg].NewInstall() == true || Cache[Pkg].Upgrade() == true)
+ req = &inst;
+ else
+ continue;
+ req->append(" ").append(Pkg.FullName());
+ }
+ fprintf(output, "Request: EDSP 0.2\n");
+ if (del.empty() == false)
+ fprintf(output, "Remove: %s\n", del.c_str()+1);
+ if (inst.empty() == false)
+ fprintf(output, "Install: %s\n", inst.c_str()+1);
+ if (Upgrade == true)
+ fprintf(output, "Upgrade: yes\n");
+ if (DistUpgrade == true)
+ fprintf(output, "Dist-Upgrade: yes\n");
+ if (AutoRemove == true)
+ fprintf(output, "Autoremove: yes\n");
+ if (_config->FindB("APT::Solver::Strict-Pinning", true) == false)
+ fprintf(output, "Strict-Pinning: no\n");
+ string solverpref("APT::Solver::");
+ solverpref.append(_config->Find("APT::Solver::Name", "internal")).append("::Preferences");
+ if (_config->Exists(solverpref) == true)
+ fprintf(output, "Preferences: %s\n", _config->Find(solverpref,"").c_str());
+ fprintf(output, "\n");
+
+ return true;
+}
+ /*}}}*/
+// EDSP::ReadResponse - from the given file descriptor /*{{{*/
+bool EDSP::ReadResponse(int const input, pkgDepCache &Cache) {
+ FileFd in;
+ in.OpenDescriptor(input, FileFd::ReadOnly);
+ pkgTagFile response(&in);
+ pkgTagSection section;
+ while (response.Step(section) == true) {
+ std::string type;
+ if (section.Exists("Install") == true)
+ type = "Install";
+ else if (section.Exists("Remove") == true)
+ type = "Remove";
+ //FIXME: handle progress
+ else
+ continue;
+
+ int const id = section.FindI(type.c_str(), -1);
+ if (id == -1)
+ return _error->Error("Unable to parse %s request!", type.c_str());
+
+ //FIXME: find version by id and mark it correctly
+ }
+ return true;
+}
+ /*}}}*/
+// EDSP::ReadLine - first line from the given file descriptor /*{{{*/
+// ---------------------------------------------------------------------
+/* Little helper method to read a complete line into a string. Similar to
+ fgets but we need to use the low-level read() here as otherwise the
+ listparser will be confused later on as mixing of fgets and read isn't
+ a supported action according to the manpages and results are undefined */
+bool EDSP::ReadLine(int const input, std::string &line) {
+ char one;
+ ssize_t data = 0;
+ line.erase();
+ line.reserve(100);
+ while ((data = read(input, &one, sizeof(one))) != -1) {
+ if (data != 1)
+ continue;
+ if (one == '\n')
+ return true;
+ if (one == '\r')
+ continue;
+ if (line.empty() == true && isblank(one) != 0)
+ continue;
+ line += one;
+ }
+ return false;
+}
+ /*}}}*/
+// EDSP::StringToBool - convert yes/no to bool /*{{{*/
+// ---------------------------------------------------------------------
+/* we are not as lazy as we are in the global StringToBool as we really
+ only accept yes/no here - but we will ignore leading spaces */
+bool EDSP::StringToBool(char const *answer, bool const defValue) {
+ for (; isspace(*answer) != 0; ++answer);
+ if (strncasecmp(answer, "yes", 3) == 0)
+ return true;
+ else if (strncasecmp(answer, "no", 2) == 0)
+ return false;
+ else
+ _error->Warning("Value '%s' is not a boolean 'yes' or 'no'!", answer);
+ return defValue;
+}
+ /*}}}*/
+// EDSP::ReadRequest - first stanza from the given file descriptor /*{{{*/
+bool EDSP::ReadRequest(int const input, std::list<std::string> &install,
+ std::list<std::string> &remove, bool &upgrade,
+ bool &distUpgrade, bool &autoRemove)
+{
+ install.clear();
+ remove.clear();
+ upgrade = false;
+ distUpgrade = false;
+ autoRemove = false;
+ std::string line;
+ while (ReadLine(input, line) == true)
+ {
+ // Skip empty lines before request
+ if (line.empty() == true)
+ continue;
+ // The first Tag must be a request, so search for it
+ if (line.compare(0, 8, "Request:") != 0)
+ continue;
+
+ while (ReadLine(input, line) == true)
+ {
+ // empty lines are the end of the request
+ if (line.empty() == true)
+ return true;
+
+ std::list<std::string> *request = NULL;
+ if (line.compare(0, 8, "Install:") == 0)
+ {
+ line.erase(0, 8);
+ request = &install;
+ }
+ else if (line.compare(0, 7, "Remove:") == 0)
+ {
+ line.erase(0, 7);
+ request = &remove;
+ }
+ else if (line.compare(0, 8, "Upgrade:") == 0)
+ upgrade = EDSP::StringToBool(line.c_str() + 9, false);
+ else if (line.compare(0, 13, "Dist-Upgrade:") == 0)
+ distUpgrade = EDSP::StringToBool(line.c_str() + 14, false);
+ else if (line.compare(0, 11, "Autoremove:") == 0)
+ autoRemove = EDSP::StringToBool(line.c_str() + 12, false);
+ else
+ _error->Warning("Unknown line in EDSP Request stanza: %s", line.c_str());
+
+ if (request == NULL)
+ continue;
+ size_t end = line.length();
+ do {
+ size_t begin = line.rfind(' ');
+ if (begin == std::string::npos)
+ {
+ request->push_back(line.substr(0, end));
+ break;
+ }
+ else if (begin < end)
+ request->push_back(line.substr(begin + 1, end));
+ line.erase(begin);
+ end = line.find_last_not_of(' ');
+ } while (end != std::string::npos);
+ }
+ }
+ return false;
+}
+ /*}}}*/
+// EDSP::ApplyRequest - first stanza from the given file descriptor /*{{{*/
+bool EDSP::ApplyRequest(std::list<std::string> const &install,
+ std::list<std::string> const &remove,
+ pkgDepCache &Cache)
+{
+ for (std::list<std::string>::const_iterator i = install.begin();
+ i != install.end(); ++i)
+ Cache.MarkInstall(Cache.FindPkg(*i), false);
+
+ for (std::list<std::string>::const_iterator i = remove.begin();
+ i != remove.end(); ++i)
+ Cache.MarkDelete(Cache.FindPkg(*i));
+ return true;
+}
+ /*}}}*/
+// EDSP::WriteSolution - to the given file descriptor /*{{{*/
+bool EDSP::WriteSolution(pkgDepCache &Cache, FILE* output)
+{
+ bool const Debug = _config->FindB("Debug::EDSP::WriteSolution", false);
+ for (pkgCache::PkgIterator Pkg = Cache.PkgBegin(); Pkg.end() == false; ++Pkg)
+ {
+ if (Cache[Pkg].Delete() == true)
+ fprintf(output, "Remove: %d\n", Cache.GetCandidateVer(Pkg)->ID);
+ else if (Cache[Pkg].NewInstall() == true || Cache[Pkg].Upgrade() == true)
+ fprintf(output, "Install: %d\n", Cache.GetCandidateVer(Pkg)->ID);
+ else
+ continue;
+ if (Debug == true)
+ fprintf(output, "Package: %s\nVersion: %s\n", Pkg.FullName().c_str(), Cache.GetCandidateVer(Pkg).VerStr());
+ fprintf(output, "\n");
+ }
+
+ return true;
+}
+ /*}}}*/
+bool EDSP::WriteError(std::string const &message, FILE* output) { return false; }
diff --git a/apt-pkg/edsp.h b/apt-pkg/edsp.h
new file mode 100644
index 000000000..31f8891f3
--- /dev/null
+++ b/apt-pkg/edsp.h
@@ -0,0 +1,39 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+ Set of methods to help writing and reading everything needed for EDSP
+ ##################################################################### */
+ /*}}}*/
+#ifndef PKGLIB_EDSP_H
+#define PKGLIB_EDSP_H
+
+#include <apt-pkg/depcache.h>
+
+#include <string>
+
+class EDSP /*{{{*/
+{
+ bool static ReadLine(int const input, std::string &line);
+ bool static StringToBool(char const *answer, bool const defValue);
+
+public:
+ bool static WriteRequest(pkgDepCache &Cache, FILE* output,
+ bool const upgrade = false,
+ bool const distUpgrade = false,
+ bool const autoRemove = false);
+ bool static WriteScenario(pkgDepCache &Cache, FILE* output);
+ bool static ReadResponse(int const input, pkgDepCache &Cache);
+
+ // ReadScenario is provided by the listparser infrastructure
+ bool static ReadRequest(int const input, std::list<std::string> &install,
+ std::list<std::string> &remove, bool &upgrade,
+ bool &distUpgrade, bool &autoRemove);
+ bool static ApplyRequest(std::list<std::string> const &install,
+ std::list<std::string> const &remove,
+ pkgDepCache &Cache);
+ bool static WriteSolution(pkgDepCache &Cache, FILE* output);
+ bool static WriteError(std::string const &message, FILE* output);
+
+};
+ /*}}}*/
+#endif
diff --git a/apt-pkg/edsp/edspindexfile.cc b/apt-pkg/edsp/edspindexfile.cc
new file mode 100644
index 000000000..f5881e663
--- /dev/null
+++ b/apt-pkg/edsp/edspindexfile.cc
@@ -0,0 +1,78 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+ The scenario file is designed to work as an intermediate file between
+ APT and the resolver. Its on propose very similar to a dpkg status file
+ ##################################################################### */
+ /*}}}*/
+// Include Files /*{{{*/
+#include <apt-pkg/edspindexfile.h>
+#include <apt-pkg/edsplistparser.h>
+#include <apt-pkg/sourcelist.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/progress.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/acquire-item.h>
+
+#include <sys/stat.h>
+ /*}}}*/
+
+// edspIndex::edspIndex - Constructor /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+edspIndex::edspIndex(string File) : debStatusIndex(File)
+{
+}
+ /*}}}*/
+// StatusIndex::Merge - Load the index file into a cache /*{{{*/
+bool edspIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
+{
+ FileFd Pkg;
+ if (File != "stdin")
+ Pkg.Open(File, FileFd::ReadOnly);
+ else
+ Pkg.OpenDescriptor(STDIN_FILENO, FileFd::ReadOnly);
+ if (_error->PendingError() == true)
+ return false;
+ edspListParser Parser(&Pkg);
+ if (_error->PendingError() == true)
+ return false;
+
+ if (Prog != NULL)
+ Prog->SubProgress(0,File);
+ if (Gen.SelectFile(File,string(),*this) == false)
+ return _error->Error("Problem with SelectFile %s",File.c_str());
+
+ // Store the IMS information
+ pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
+ struct stat St;
+ if (fstat(Pkg.Fd(),&St) != 0)
+ return _error->Errno("fstat","Failed to stat");
+ CFile->Size = St.st_size;
+ CFile->mtime = St.st_mtime;
+ CFile->Archive = Gen.WriteUniqString("edsp::scenario");
+
+ if (Gen.MergeList(Parser) == false)
+ return _error->Error("Problem with MergeList %s",File.c_str());
+ return true;
+}
+ /*}}}*/
+// Index File types for APT /*{{{*/
+class edspIFType: public pkgIndexFile::Type
+{
+ public:
+ virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator File) const
+ {
+ // we don't have a record parser for this type as the file is not presistent
+ return NULL;
+ };
+ edspIFType() {Label = "EDSP scenario file";};
+};
+static edspIFType _apt_Universe;
+
+const pkgIndexFile::Type *edspIndex::GetType() const
+{
+ return &_apt_Universe;
+}
+ /*}}}*/
diff --git a/apt-pkg/edsp/edspindexfile.h b/apt-pkg/edsp/edspindexfile.h
new file mode 100644
index 000000000..87c06557c
--- /dev/null
+++ b/apt-pkg/edsp/edspindexfile.h
@@ -0,0 +1,25 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+ The scenario file is designed to work as an intermediate file between
+ APT and the resolver. Its on propose very similar to a dpkg status file
+ ##################################################################### */
+ /*}}}*/
+#ifndef PKGLIB_EDSPINDEXFILE_H
+#define PKGLIB_EDSPINDEXFILE_H
+
+#include <apt-pkg/indexfile.h>
+#include <apt-pkg/debindexfile.h>
+
+class edspIndex : public debStatusIndex
+{
+ public:
+
+ virtual const Type *GetType() const;
+
+ virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
+
+ edspIndex(string File);
+};
+
+#endif
diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc
new file mode 100644
index 000000000..913455efa
--- /dev/null
+++ b/apt-pkg/edsp/edsplistparser.cc
@@ -0,0 +1,87 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+
+ Package Cache Generator - Generator for the cache structure.
+
+ This builds the cache structure from the abstract package list parser.
+
+ ##################################################################### */
+ /*}}}*/
+// Include Files /*{{{*/
+#include <apt-pkg/edsplistparser.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/md5.h>
+#include <apt-pkg/macros.h>
+ /*}}}*/
+
+// ListParser::edspListParser - Constructor /*{{{*/
+edspListParser::edspListParser(FileFd *File, string const &Arch) : debListParser(File, Arch)
+{}
+ /*}}}*/
+// ListParser::NewVersion - Fill in the version structure /*{{{*/
+bool edspListParser::NewVersion(pkgCache::VerIterator &Ver)
+{
+ Ver->ID = Section.FindI("APT-ID", Ver->ID);
+ return debListParser::NewVersion(Ver);
+}
+ /*}}}*/
+// ListParser::Description - Return the description string /*{{{*/
+// ---------------------------------------------------------------------
+/* Sorry, no description for the resolvers… */
+string edspListParser::Description()
+{
+ return "";
+}
+string edspListParser::DescriptionLanguage()
+{
+ return "";
+}
+MD5SumValue edspListParser::Description_md5()
+{
+ return MD5SumValue("");
+}
+ /*}}}*/
+// ListParser::VersionHash - Compute a unique hash for this version /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+unsigned short edspListParser::VersionHash()
+{
+ if (Section.Exists("APT-Hash") == true)
+ return Section.FindI("APT-Hash");
+ else if (Section.Exists("APT-ID") == true)
+ return Section.FindI("APT-ID");
+ return 0;
+}
+ /*}}}*/
+// ListParser::ParseStatus - Parse the status field /*{{{*/
+// ---------------------------------------------------------------------
+/* The Status: line here is not a normal dpkg one but just one which tells
+ use if the package is installed or not, where missing means not. */
+bool edspListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
+ pkgCache::VerIterator &Ver)
+{
+ if (Section.FindFlag("Hold",Pkg->Flags,pkgCache::State::Installed) == false)
+ return false;
+
+ unsigned long state = 0;
+ if (Section.FindFlag("Installed",state,pkgCache::State::Installed) == false)
+ return false;
+ if (state != 0)
+ {
+ Pkg->CurrentState = pkgCache::State::Installed;
+ Pkg->CurrentVer = Ver.Index();
+ }
+
+ return true;
+}
+ /*}}}*/
+// ListParser::LoadReleaseInfo - Load the release information /*{{{*/
+bool edspListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
+ FileFd &File, string component)
+{
+ return true;
+}
+ /*}}}*/
diff --git a/apt-pkg/edsp/edsplistparser.h b/apt-pkg/edsp/edsplistparser.h
new file mode 100644
index 000000000..ec9f09905
--- /dev/null
+++ b/apt-pkg/edsp/edsplistparser.h
@@ -0,0 +1,38 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+
+ EDSP Package List Parser - This implements the abstract parser
+ interface for the APT specific intermediate format which is passed
+ to external resolvers
+
+ ##################################################################### */
+ /*}}}*/
+#ifndef PKGLIB_EDSPLISTPARSER_H
+#define PKGLIB_EDSPLISTPARSER_H
+
+#include <apt-pkg/deblistparser.h>
+#include <apt-pkg/pkgcachegen.h>
+#include <apt-pkg/indexfile.h>
+#include <apt-pkg/tagfile.h>
+
+class edspListParser : public debListParser
+{
+ public:
+ virtual bool NewVersion(pkgCache::VerIterator &Ver);
+ virtual string Description();
+ virtual string DescriptionLanguage();
+ virtual MD5SumValue Description_md5();
+ virtual unsigned short VersionHash();
+
+ bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File,
+ string section);
+
+ edspListParser(FileFd *File, string const &Arch = "");
+
+ protected:
+ virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
+
+};
+
+#endif
diff --git a/apt-pkg/edsp/edspsystem.cc b/apt-pkg/edsp/edspsystem.cc
new file mode 100644
index 000000000..ac0bb8beb
--- /dev/null
+++ b/apt-pkg/edsp/edspsystem.cc
@@ -0,0 +1,124 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+
+ This system provides the abstraction to use the scenario file as the
+ only source of package information to be able to feed the created file
+ back to APT for its own consumption (eat your own dogfood).
+
+ ##################################################################### */
+ /*}}}*/
+// Include Files /*{{{*/
+#include <apt-pkg/edspsystem.h>
+#include <apt-pkg/debversion.h>
+#include <apt-pkg/edspindexfile.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
+#include <apti18n.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <dirent.h>
+#include <errno.h>
+ /*}}}*/
+
+edspSystem edspSys;
+
+// System::debSystem - Constructor /*{{{*/
+edspSystem::edspSystem()
+{
+ StatusFile = 0;
+
+ Label = "Debian APT solver interface";
+ VS = &debVS;
+}
+ /*}}}*/
+// System::~debSystem - Destructor /*{{{*/
+edspSystem::~edspSystem()
+{
+ delete StatusFile;
+}
+ /*}}}*/
+// System::Lock - Get the lock /*{{{*/
+bool edspSystem::Lock()
+{
+ return true;
+}
+ /*}}}*/
+// System::UnLock - Drop a lock /*{{{*/
+bool edspSystem::UnLock(bool NoErrors)
+{
+ return true;
+}
+ /*}}}*/
+// System::CreatePM - Create the underlying package manager /*{{{*/
+// ---------------------------------------------------------------------
+/* we can't use edsp input as input for real installations - just a
+ simulation can work, but everything else will fail bigtime */
+pkgPackageManager *edspSystem::CreatePM(pkgDepCache *Cache) const
+{
+ return NULL;
+}
+ /*}}}*/
+// System::Initialize - Setup the configuration space.. /*{{{*/
+bool edspSystem::Initialize(Configuration &Cnf)
+{
+ Cnf.Set("Dir::State::extended_states", "/dev/null");
+ Cnf.Set("Dir::State::status","/dev/null");
+ Cnf.Set("Dir::State::lists","/dev/null");
+
+ Cnf.Set("Debug::NoLocking", "true");
+ Cnf.Set("APT::Get::Simulate", "true");
+
+ if (StatusFile) {
+ delete StatusFile;
+ StatusFile = 0;
+ }
+ return true;
+}
+ /*}}}*/
+// System::ArchiveSupported - Is a file format supported /*{{{*/
+bool edspSystem::ArchiveSupported(const char *Type)
+{
+ return false;
+}
+ /*}}}*/
+// System::Score - Determine if we should use the edsp system /*{{{*/
+signed edspSystem::Score(Configuration const &Cnf)
+{
+ if (Cnf.Find("edsp::scenario", "") == "stdin")
+ return 1000;
+ if (FileExists(Cnf.FindFile("edsp::scenario","")) == true)
+ return 1000;
+ return -1000;
+}
+ /*}}}*/
+// System::AddStatusFiles - Register the status files /*{{{*/
+bool edspSystem::AddStatusFiles(vector<pkgIndexFile *> &List)
+{
+ if (StatusFile == 0)
+ {
+ if (_config->Find("edsp::scenario", "") == "stdin")
+ StatusFile = new edspIndex("stdin");
+ else
+ StatusFile = new edspIndex(_config->FindFile("edsp::scenario"));
+ }
+ List.push_back(StatusFile);
+ return true;
+}
+ /*}}}*/
+// System::FindIndex - Get an index file for status files /*{{{*/
+bool edspSystem::FindIndex(pkgCache::PkgFileIterator File,
+ pkgIndexFile *&Found) const
+{
+ if (StatusFile == 0)
+ return false;
+ if (StatusFile->FindInCache(*File.Cache()) == File)
+ {
+ Found = StatusFile;
+ return true;
+ }
+
+ return false;
+}
+ /*}}}*/
diff --git a/apt-pkg/edsp/edspsystem.h b/apt-pkg/edsp/edspsystem.h
new file mode 100644
index 000000000..bc5be61d1
--- /dev/null
+++ b/apt-pkg/edsp/edspsystem.h
@@ -0,0 +1,38 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+// $Id: debsystem.h,v 1.4 2003/01/11 07:16:33 jgg Exp $
+/* ######################################################################
+
+ System - Debian version of the System Class
+
+ ##################################################################### */
+ /*}}}*/
+#ifndef PKGLIB_EDSPSYSTEM_H
+#define PKGLIB_EDSPSYSTEM_H
+
+#include <apt-pkg/pkgsystem.h>
+
+class edspIndex;
+class edspSystem : public pkgSystem
+{
+ edspIndex *StatusFile;
+
+ public:
+
+ virtual bool Lock();
+ virtual bool UnLock(bool NoErrors = false);
+ virtual pkgPackageManager *CreatePM(pkgDepCache *Cache) const;
+ virtual bool Initialize(Configuration &Cnf);
+ virtual bool ArchiveSupported(const char *Type);
+ virtual signed Score(Configuration const &Cnf);
+ virtual bool AddStatusFiles(std::vector<pkgIndexFile *> &List);
+ virtual bool FindIndex(pkgCache::PkgFileIterator File,
+ pkgIndexFile *&Found) const;
+
+ edspSystem();
+ ~edspSystem();
+};
+
+extern edspSystem edspSys;
+
+#endif
diff --git a/apt-pkg/makefile b/apt-pkg/makefile
index 4e5ec107f..e6bcf8524 100644
--- a/apt-pkg/makefile
+++ b/apt-pkg/makefile
@@ -3,7 +3,7 @@ BASE=..
SUBDIR=apt-pkg
# Header location
-SUBDIRS = deb contrib
+SUBDIRS = deb edsp contrib
HEADER_TARGETDIRS = apt-pkg
# Bring in the default rules
@@ -35,7 +35,7 @@ SOURCE+= pkgcache.cc version.cc depcache.cc \
srcrecords.cc cachefile.cc versionmatch.cc policy.cc \
pkgsystem.cc indexfile.cc pkgcachegen.cc acquire-item.cc \
indexrecords.cc vendor.cc vendorlist.cc cdrom.cc indexcopy.cc \
- aptconfiguration.cc cachefilter.cc cacheset.cc
+ aptconfiguration.cc cachefilter.cc cacheset.cc edsp.cc
HEADERS+= algorithms.h depcache.h pkgcachegen.h cacheiterators.h \
orderlist.h sourcelist.h packagemanager.h tagfile.h \
init.h pkgcache.h version.h progress.h pkgrecords.h \
@@ -43,7 +43,7 @@ HEADERS+= algorithms.h depcache.h pkgcachegen.h cacheiterators.h \
clean.h srcrecords.h cachefile.h versionmatch.h policy.h \
pkgsystem.h indexfile.h metaindex.h indexrecords.h vendor.h \
vendorlist.h cdrom.h indexcopy.h aptconfiguration.h \
- cachefilter.h cacheset.h
+ cachefilter.h cacheset.h edsp.h
# Source code for the debian specific components
# In theory the deb headers do not need to be exported..
@@ -53,6 +53,10 @@ SOURCE+= deb/deblistparser.cc deb/debrecords.cc deb/dpkgpm.cc \
HEADERS+= debversion.h debsrcrecords.h dpkgpm.h debrecords.h \
deblistparser.h debsystem.h debindexfile.h debmetaindex.h
+# Source code for the APT resolver interface specific components
+SOURCE+= edsp/edsplistparser.cc edsp/edspindexfile.cc edsp/edspsystem.cc
+HEADERS+= edsplistparser.h edspindexfile.h edspsystem.h
+
HEADERS := $(addprefix apt-pkg/,$(HEADERS))
include $(LIBRARY_H)
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 7014aee22..c6326abf1 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -317,22 +317,22 @@ pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) const {
if (unlikely(IsGood() == false || S->FirstPackage == 0))
return PkgIterator(*Owner, 0);
+ /* If we accept any package we simply return the "first"
+ package in this group (the last one added). */
+ if (Arch == "any")
+ return PkgIterator(*Owner, Owner->PkgP + S->FirstPackage);
+
static string const myArch = _config->Find("APT::Architecture");
/* Most of the time the package for our native architecture is
the one we add at first to the cache, but this would be the
last one we check, so we do it now. */
- if (Arch == "native" || Arch == myArch) {
+ if (Arch == "native" || Arch == myArch || Arch == "all") {
Arch = myArch;
pkgCache::Package *Pkg = Owner->PkgP + S->LastPackage;
if (stringcasecmp(Arch, Owner->StrP + Pkg->Arch) == 0)
return PkgIterator(*Owner, Pkg);
}
- /* If we accept any package we simply return the "first"
- package in this group (the last one added). */
- if (Arch == "any")
- return PkgIterator(*Owner, Owner->PkgP + S->FirstPackage);
-
/* Iterate over the list to find the matching arch
unfortunately this list includes "package noise"
(= different packages with same calculated hash),
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index 89a296ce9..d654a2976 100644
--- a/apt-pkg/pkgcache.h
+++ b/apt-pkg/pkgcache.h
@@ -506,8 +506,8 @@ struct pkgCache::Version
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: remove All on abi break
- enum {None, All, Foreign, Same, Allowed} MultiArch;
+ /* FIXME: A bitflag would be better with the next abibreak… */
+ enum {None, All, Foreign, Same, Allowed, AllForeign, AllAllowed} MultiArch;
/** \brief references all the PackageFile's that this version came from
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index d44dbf3a9..46dd22007 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -178,12 +178,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
if (PackageName.empty() == true)
return false;
- /* Treat Arch all packages as the same as the native arch. */
- string Arch;
- if (List.ArchitectureAll() == true)
- Arch = _config->Find("APT::Architecture");
- else
- Arch = List.Architecture();
+ string const Arch = List.Architecture();
// Get a pointer to the package structure
pkgCache::PkgIterator Pkg;
@@ -484,7 +479,7 @@ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name
// Set the name, arch and the ID
Pkg->Name = Grp->Name;
Pkg->Group = Grp.Index();
- map_ptrloc const idxArch = WriteUniqString(Arch.c_str());
+ map_ptrloc const idxArch = WriteUniqString((Arch == "all") ? _config->Find("APT::Architecture") : Arch.c_str());
if (unlikely(idxArch == 0))
return false;
Pkg->Arch = idxArch;
@@ -643,10 +638,10 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress)
- 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::Same);
+ bool const coInstall = ((V->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same);
for (vector<string>::const_iterator A = archs.begin(); A != archs.end(); ++A)
{
- if (*A == Arch)
+ if (Arch == 0 || *A == Arch)
continue;
/* We allow only one installed arch at the time
per group, therefore each group member conflicts
@@ -787,7 +782,8 @@ bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator &Ver,
pkgCache &Cache = Owner->Cache;
// We do not add self referencing provides
- if (Ver.ParentPkg().Name() == PkgName && PkgArch == Ver.Arch())
+ if (Ver.ParentPkg().Name() == PkgName && (PkgArch == Ver.ParentPkg().Arch() ||
+ (PkgArch == "all" && _config->Find("APT::Architecture") == Ver.ParentPkg().Arch())))
return true;
// Get a structure
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc
index 94c7fd4af..4e4077feb 100644
--- a/apt-pkg/policy.cc
+++ b/apt-pkg/policy.cc
@@ -270,6 +270,10 @@ signed short pkgPolicy::GetPriority(pkgCache::PkgIterator const &Pkg)
return 0;
}
+signed short pkgPolicy::GetPriority(pkgCache::PkgFileIterator const &File)
+{
+ return PFPriority[File->ID];
+}
/*}}}*/
// PreferenceSection class - Overriding the default TrimRecord method /*{{{*/
// ---------------------------------------------------------------------
diff --git a/apt-pkg/policy.h b/apt-pkg/policy.h
index f8b2678de..e7f36d618 100644
--- a/apt-pkg/policy.h
+++ b/apt-pkg/policy.h
@@ -69,14 +69,13 @@ class pkgPolicy : public pkgDepCache::Policy
// Things for manipulating pins
void CreatePin(pkgVersionMatch::MatchType Type,string Pkg,
string Data,signed short Priority);
- inline signed short GetPriority(pkgCache::PkgFileIterator const &File)
- {return PFPriority[File->ID];};
- signed short GetPriority(pkgCache::PkgIterator const &Pkg);
pkgCache::VerIterator GetMatch(pkgCache::PkgIterator const &Pkg);
// Things for the cache interface.
virtual pkgCache::VerIterator GetCandidateVer(pkgCache::PkgIterator const &Pkg);
- virtual bool IsImportantDep(pkgCache::DepIterator const &Dep) {return pkgDepCache::Policy::IsImportantDep(Dep);};
+ virtual signed short GetPriority(pkgCache::PkgIterator const &Pkg);
+ virtual signed short GetPriority(pkgCache::PkgFileIterator const &File);
+
bool InitDefaults();
pkgPolicy(pkgCache *Owner);
diff --git a/apt-pkg/vendor.h b/apt-pkg/vendor.h
index 2d39fd15f..df229737a 100644
--- a/apt-pkg/vendor.h
+++ b/apt-pkg/vendor.h
@@ -4,11 +4,12 @@
#include <vector>
#include <map>
+#include <apt-pkg/macros.h>
using std::string;
// A class representing a particular software provider.
-class Vendor
+class __deprecated Vendor
{
public:
struct Fingerprint
diff --git a/apt-pkg/vendorlist.cc b/apt-pkg/vendorlist.cc
index 92ff38894..48ac12cee 100644
--- a/apt-pkg/vendorlist.cc
+++ b/apt-pkg/vendorlist.cc
@@ -1,8 +1,13 @@
-#include <apt-pkg/vendorlist.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/error.h>
#include <apti18n.h>
+#if __GNUC__ >= 4
+ #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
+#include <apt-pkg/vendorlist.h>
+
pkgVendorList::~pkgVendorList()
{
for (vector<const Vendor *>::const_iterator I = VendorList.begin();
@@ -143,3 +148,7 @@ const Vendor* pkgVendorList::FindVendor(const std::vector<string> GPGVOutput) /*
return NULL;
}
/*}}}*/
+
+#if __GNUC__ >= 4
+ #pragma GCC diagnostic warning "-Wdeprecated-declarations"
+#endif
diff --git a/apt-pkg/vendorlist.h b/apt-pkg/vendorlist.h
index ff2f4ed5d..eaeecb173 100644
--- a/apt-pkg/vendorlist.h
+++ b/apt-pkg/vendorlist.h
@@ -17,12 +17,13 @@
#include <vector>
#include <apt-pkg/vendor.h>
#include <apt-pkg/configuration.h>
+#include <apt-pkg/macros.h>
using std::string;
using std::vector;
-class pkgVendorList
+class __deprecated pkgVendorList
{
protected:
vector<Vendor const *> VendorList;
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 6a30c5a50..a1264f54a 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -764,7 +764,7 @@ struct TryToInstall {
unsigned long AutoMarkChanged;
APT::PackageSet doAutoInstallLater;
- TryToInstall(pkgCacheFile &Cache, pkgProblemResolver &PM, bool const &FixBroken) : Cache(&Cache), Fix(&PM),
+ TryToInstall(pkgCacheFile &Cache, pkgProblemResolver *PM, bool const &FixBroken) : Cache(&Cache), Fix(PM),
FixBroken(FixBroken), AutoMarkChanged(0) {};
void operator() (pkgCache::VerIterator const &Ver) {
@@ -782,8 +782,10 @@ struct TryToInstall {
ioprintf(c1out,_("Skipping %s, it is not installed and only upgrades are requested.\n"),
Pkg.FullName(true).c_str());
else {
- Fix->Clear(Pkg);
- Fix->Protect(Pkg);
+ if (Fix != NULL) {
+ Fix->Clear(Pkg);
+ Fix->Protect(Pkg);
+ }
Cache->GetDepCache()->MarkInstall(Pkg,false);
if (State.Install() == false) {
@@ -871,16 +873,19 @@ struct TryToRemove {
bool PurgePkgs;
unsigned long AutoMarkChanged;
- TryToRemove(pkgCacheFile &Cache, pkgProblemResolver &PM) : Cache(&Cache), Fix(&PM),
+ TryToRemove(pkgCacheFile &Cache, pkgProblemResolver *PM) : Cache(&Cache), Fix(PM),
PurgePkgs(_config->FindB("APT::Get::Purge", false)) {};
void operator() (pkgCache::VerIterator const &Ver)
{
pkgCache::PkgIterator Pkg = Ver.ParentPkg();
- Fix->Clear(Pkg);
- Fix->Protect(Pkg);
- Fix->Remove(Pkg);
+ if (Fix != NULL)
+ {
+ Fix->Clear(Pkg);
+ Fix->Protect(Pkg);
+ Fix->Remove(Pkg);
+ }
if ((Pkg->CurrentVer == 0 && PurgePkgs == false) ||
(PurgePkgs == true && Pkg->CurrentState == pkgCache::State::NotInstalled))
@@ -1385,10 +1390,10 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache,
if (Remove == true)
{
- TryToRemove RemoveAction(Cache, Fix);
+ TryToRemove RemoveAction(Cache, &Fix);
RemoveAction(Pkg.VersionList());
} else if (Cache[Pkg].CandidateVer != 0) {
- TryToInstall InstallAction(Cache, Fix, BrokenFix);
+ TryToInstall InstallAction(Cache, &Fix, BrokenFix);
InstallAction(Cache[Pkg].CandidateVerIter(Cache));
InstallAction.doAutoInstall();
} else
@@ -1791,8 +1796,10 @@ bool DoInstall(CommandLine &CmdL)
bool BrokenFix = false;
if (Cache->BrokenCount() != 0)
BrokenFix = true;
-
- pkgProblemResolver Fix(Cache);
+
+ pkgProblemResolver* Fix = NULL;
+ if (_config->FindB("APT::Get::CallResolver", true) == true)
+ Fix = new pkgProblemResolver(Cache);
static const unsigned short MOD_REMOVE = 1;
static const unsigned short MOD_INSTALL = 2;
@@ -1823,6 +1830,8 @@ bool DoInstall(CommandLine &CmdL)
if (_error->PendingError() == true)
{
helper.showVirtualPackageErrors(Cache);
+ if (Fix != NULL)
+ delete Fix;
return false;
}
@@ -1837,17 +1846,29 @@ bool DoInstall(CommandLine &CmdL)
for (unsigned short i = 0; order[i] != 0; ++i)
{
- if (order[i] == MOD_INSTALL) {
+ if (order[i] == MOD_INSTALL)
InstallAction = std::for_each(verset[MOD_INSTALL].begin(), verset[MOD_INSTALL].end(), InstallAction);
+ else if (order[i] == MOD_REMOVE)
+ RemoveAction = std::for_each(verset[MOD_REMOVE].begin(), verset[MOD_REMOVE].end(), RemoveAction);
+ }
+
+ if (Fix != NULL && _config->FindB("APT::Get::AutoSolving", true) == true)
+ {
+ for (unsigned short i = 0; order[i] != 0; ++i)
+ {
+ if (order[i] != MOD_INSTALL)
+ continue;
InstallAction.propergateReleaseCandiateSwitching(helper.selectedByRelease, c0out);
InstallAction.doAutoInstall();
}
- else if (order[i] == MOD_REMOVE)
- RemoveAction = std::for_each(verset[MOD_REMOVE].begin(), verset[MOD_REMOVE].end(), RemoveAction);
}
if (_error->PendingError() == true)
+ {
+ if (Fix != NULL)
+ delete Fix;
return false;
+ }
/* If we are in the Broken fixing mode we do not attempt to fix the
problems. This is if the user invoked install without -f and gave
@@ -1856,14 +1877,19 @@ bool DoInstall(CommandLine &CmdL)
{
c1out << _("You might want to run 'apt-get -f install' to correct these:") << endl;
ShowBroken(c1out,Cache,false);
-
+ if (Fix != NULL)
+ delete Fix;
return _error->Error(_("Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution)."));
}
-
- // Call the scored problem resolver
- Fix.InstallProtect();
- if (Fix.Resolve(true) == false)
- _error->Discard();
+
+ if (Fix != NULL)
+ {
+ // Call the scored problem resolver
+ Fix->InstallProtect();
+ if (Fix->Resolve(true) == false)
+ ; //FIXME: is there a valid reason for? _error->Discard();
+ delete Fix;
+ }
// Now we check the state of the packages,
if (Cache->BrokenCount() != 0)
@@ -3278,7 +3304,10 @@ int main(int argc,const char *argv[]) /*{{{*/
}
// simulate user-friendly if apt-get has no root privileges
- if (getuid() != 0 && _config->FindB("APT::Get::Simulate") == true)
+ if (getuid() != 0 && _config->FindB("APT::Get::Simulate") == true &&
+ (CmdL.FileSize() == 0 ||
+ (strcmp(CmdL.FileList[0], "source") != 0 && strcmp(CmdL.FileList[0], "download") != 0 &&
+ strcmp(CmdL.FileList[0], "changelog") != 0)))
{
if (_config->FindB("APT::Get::Show-User-Simulation-Note",true) == true)
cout << _("NOTE: This is only a simulation!\n"
diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc
new file mode 100644
index 000000000..83d79e42a
--- /dev/null
+++ b/cmdline/apt-internal-solver.cc
@@ -0,0 +1,129 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* #####################################################################
+
+ cover around the internal solver to be able to run it like an external
+
+ ##################################################################### */
+ /*}}}*/
+// Include Files /*{{{*/
+#include <apt-pkg/error.h>
+#include <apt-pkg/cmndline.h>
+#include <apt-pkg/init.h>
+#include <apt-pkg/cachefile.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/edsp.h>
+#include <apt-pkg/algorithms.h>
+#include <apt-pkg/fileutl.h>
+
+#include <config.h>
+#include <apti18n.h>
+
+#include <unistd.h>
+#include <cstdio>
+ /*}}}*/
+
+// ShowHelp - Show a help screen /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool ShowHelp(CommandLine &CmdL) {
+ ioprintf(std::cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION,
+ COMMON_ARCH,__DATE__,__TIME__);
+
+ std::cout <<
+ _("Usage: apt-internal-resolver\n"
+ "\n"
+ "apt-internal-resolver is an interface to use the current internal\n"
+ "like an external resolver for the APT family for debugging or alike\n"
+ "\n"
+ "Options:\n"
+ " -h This help text.\n"
+ " -q Loggable output - no progress indicator\n"
+ " -c=? Read this configuration file\n"
+ " -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n"
+ "apt.conf(5) manual pages for more information and options.\n"
+ " This APT has Super Cow Powers.\n");
+ return true;
+}
+ /*}}}*/
+int main(int argc,const char *argv[]) /*{{{*/
+{
+ CommandLine::Args Args[] = {
+ {'h',"help","help",0},
+ {'v',"version","version",0},
+ {'q',"quiet","quiet",CommandLine::IntLevel},
+ {'q',"silent","quiet",CommandLine::IntLevel},
+ {0,0,0,0}};
+
+ CommandLine CmdL(Args,_config);
+ if (pkgInitConfig(*_config) == false ||
+ CmdL.Parse(argc,argv) == false) {
+ _error->DumpErrors();
+ return 2;
+ }
+
+ // See if the help should be shown
+ if (_config->FindB("help") == true ||
+ _config->FindB("version") == true) {
+ ShowHelp(CmdL);
+ return 1;
+ }
+
+ // Deal with stdout not being a tty
+ if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1)
+ _config->Set("quiet","1");
+
+ if (_config->FindI("quiet", 0) < 1)
+ _config->Set("Debug::EDSP::WriteSolution", true);
+
+ _config->Set("APT::Solver::Name", "internal");
+ _config->Set("edsp::scenario", "stdin");
+ int input = STDIN_FILENO;
+ FILE* output = stdout;
+ SetNonBlock(input, false);
+
+ if (pkgInitSystem(*_config,_system) == false) {
+ std::cerr << "System could not be initialized!" << std::endl;
+ return 1;
+ }
+
+ if (WaitFd(input, false, 5) == false)
+ std::cerr << "WAIT timed out in the resolver" << std::endl;
+
+ std::list<std::string> install, remove;
+ bool upgrade, distUpgrade, autoRemove;
+ if (EDSP::ReadRequest(input, install, remove, upgrade, distUpgrade, autoRemove) == false) {
+ std::cerr << "Parsing the request failed!" << std::endl;
+ return 2;
+ }
+
+ pkgCacheFile CacheFile;
+ CacheFile.Open(NULL, false);
+
+ if (EDSP::ApplyRequest(install, remove, CacheFile) == false) {
+ std::cerr << "Failed to apply request to depcache!" << std::endl;
+ return 3;
+ }
+ for (std::list<std::string>::const_iterator i = install.begin();
+ i != install.end(); ++i)
+ CacheFile->MarkInstall(CacheFile->FindPkg(*i), true);
+
+ pkgProblemResolver Fix(CacheFile);
+ if (Fix.Resolve() == false) {
+ EDSP::WriteError("An error occured", output);
+ return 0;
+ }
+
+ if (EDSP::WriteSolution(CacheFile, output) == false) {
+ std::cerr << "Failed to output the solution!" << std::endl;
+ return 4;
+ }
+
+ bool const Errors = _error->PendingError();
+ if (_config->FindI("quiet",0) > 0)
+ _error->DumpErrors();
+ else
+ _error->DumpErrors(GlobalError::DEBUG);
+ return Errors == true ? 100 : 0;
+}
+ /*}}}*/
diff --git a/cmdline/makefile b/cmdline/makefile
index 917ccc96a..4462ccaf4 100644
--- a/cmdline/makefile
+++ b/cmdline/makefile
@@ -64,3 +64,10 @@ include $(COPY_H)
#TO=$(BIN)
#TARGET=program
#include $(COPY_H)
+
+# The internal solver acting as an external
+PROGRAM=apt-internal-solver
+SLIBS = -lapt-pkg $(INTLLIBS)
+LIB_MAKES = apt-pkg/makefile
+SOURCE = apt-internal-solver.cc
+include $(PROGRAM_H)
diff --git a/debian/apt.conf.autoremove b/debian/apt.conf.autoremove
index ebe49c7cd..c7ad51e66 100644
--- a/debian/apt.conf.autoremove
+++ b/debian/apt.conf.autoremove
@@ -9,6 +9,7 @@ APT
"^linux-restricted-modules.*";
"^linux-ubuntu-modules-.*";
"^gnumach$";
+ "^gnumach-image.*";
};
Never-MarkAuto-Sections
diff --git a/debian/changelog b/debian/changelog
index c7bb429ff..e669077fe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,39 @@
+apt (0.8.13.1) UNRELEASED; urgency=low
+
+ [ David Kalnischkies ]
+ * apt-pkg/deb/dpkgpm.cc:
+ - skip --configure if all packages disappeared
+ * apt-pkg/vendor.cc, apt-pkg/vendorlist.cc:
+ - mark them as deprecated as they are unused
+ * apt-pkg/deb/deblistparser.h:
+ - enable StripMultiArch by default for ParseDepends
+ * debian/apt.conf.autoremove:
+ - adapt to new gnumach kernel package naming (Closes: #619337)
+ * doc/apt_preferences.5.xml:
+ - correct typo spotted by Charles Plessy (Closes: #619088)
+ - document ButAutomaticUpgrades together with NotAutomatic
+ as suggested by Charles Plessy (Closes: #619083)
+ * apt-pkg/depcache.cc:
+ - remove pseudo handling leftover from SetReInstall
+ - do not change protected packages in autoinstall (Closes: #618848)
+ * apt-pkg/pkgcachegen.cc:
+ - make "all"->"native" an implementation detail of NewPackage
+ rather than rewrite it in higher methods
+ * apt-pkg/cacheiterator.h:
+ - return "all" instead of native architecture without breaking the abi
+ (too much) by extending enum instead of using bitflags (LP: #733741)
+ * apt-pkg/aptconfiguration.cc:
+ - use dpkg --print-foreign-architectures to get multiarch configuration
+ if non is specified with APT::Architectures (Closes: #612958)
+ * cmdline/apt-get.cc:
+ - do not show simulation notice for non-root commands (Closes: #619072)
+ - be able to disable resolver with APT::Get::CallResolver and disable
+ auto installation with APT::Get::AutoSolving
+ * apt-pkg/deb/deblistparser.cc:
+ - create foo:any provides for all architectures for an allowed package
+
+ -- David Kalnischkies <kalnischkies@gmail.com> Tue, 29 Mar 2011 13:12:45 +0200
+
apt (0.8.13) unstable; urgency=low
[ Thorsten Spindler ]
diff --git a/doc/apt_preferences.5.xml b/doc/apt_preferences.5.xml
index 0d22d0413..219da7cd1 100644
--- a/doc/apt_preferences.5.xml
+++ b/doc/apt_preferences.5.xml
@@ -105,12 +105,16 @@ algorithm to set the priorities of the versions of a package. Assign:
<varlistentry>
<term>priority 1</term>
<listitem><simpara>to the versions coming from archives which in their <filename>Release</filename>
-files are marked as "NotAutomatic: yes" like the debian experimental archive.</simpara></listitem>
+files are marked as "NotAutomatic: yes" but <emphasis>not</emphasis> as "ButAutomaticUpgrades: yes"
+like the debian <literal>experimental</literal> archive.</simpara></listitem>
</varlistentry>
<varlistentry>
<term>priority 100</term>
-<listitem><simpara>to the version that is already installed (if any).</simpara></listitem>
+<listitem><simpara>to the version that is already installed (if any) and to the versions coming
+from archives which in their <filename>Release</filename> files are marked as "NotAutomatic: yes" and
+"ButAutomaticUpgrades: yes" like the debian backports archive since <literal>squeeze-backports</literal>.
+</simpara></listitem>
</varlistentry>
<varlistentry>
@@ -127,9 +131,10 @@ files are marked as "NotAutomatic: yes" like the debian experimental archive.</s
<para>If the target release has not been specified then APT simply assigns
priority 100 to all installed package versions and priority 500 to all
-uninstalled package versions, expect versions coming from archives which
+uninstalled package versions, except versions coming from archives which
in their <filename>Release</filename> files are marked as "NotAutomatic: yes" -
-these versions get the priority 1.</para>
+these versions get the priority 1 or priority 100 if it is additionally marked
+as "ButAutomaticUpgrades: yes".</para>
<para>APT then applies the following rules, listed in order of precedence,
to determine which version of a package to install.
diff --git a/test/integration/framework b/test/integration/framework
index 71e7e476c..013a71ec0 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -261,18 +261,22 @@ Package: $NAME" > ${BUILDDIR}/debian/control
fi
echo '3.0 (native)' > ${BUILDDIR}/debian/source/format
local SRCS="$( (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | grep '^dpkg-source: info: building' | grep -o '[a-z0-9._+~-]*$')"
-
- mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin
- cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}
- cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian/tmp/usr/bin
- (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$ARCH)
- (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums)
-
- dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. 2> /dev/null > /dev/null
- echo "pool/${NAME}_${VERSION}_${ARCH}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist
for SRC in $SRCS; do
echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist
done
+
+ for arch in $(echo "$ARCH" | sed -e 's#,#\n#g'); do
+ rm -rf ${BUILDDIR}/debian/tmp
+ mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin
+ cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}
+ cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}
+ (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$arch)
+ (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums)
+
+ dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. 2> /dev/null > /dev/null
+ echo "pool/${NAME}_${VERSION}_${arch}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist
+ done
+
mkdir -p ${BUILDDIR}/../${NAME}_${VERSION}
cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}/
cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}.changelog
@@ -418,6 +422,29 @@ Filename: pool/main/${NAME}/${NAME}_${VERSION}_${ARCH}.deb" >> $FILE
done
}
+insertinstalledpackage() {
+ local NAME="$1"
+ local ARCH="$2"
+ local VERSION="$3"
+ local DEPENDENCIES="$4"
+ local FILE="rootdir/var/lib/dpkg/status"
+ echo "Package: $NAME
+Status: install ok installed
+Priority: optional
+Section: other
+Installed-Size: 42
+Maintainer: Joe Sixpack <joe@example.org>
+Architecture: $ARCH
+Version: $VERSION" >> $FILE
+ test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
+ echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ If you find such a package installed on your system,
+ YOU did something horribly wrong! They are autogenerated
+ und used only by testcases for APT and surf no other propose…
+" >> $FILE
+}
+
+
buildaptarchivefromincoming() {
msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on incoming packages…"
cd aptarchive
diff --git a/test/integration/test-bug-549968-install-depends-of-not-installed b/test/integration/test-bug-549968-install-depends-of-not-installed
index 871d236b9..78c0801f2 100755
--- a/test/integration/test-bug-549968-install-depends-of-not-installed
+++ b/test/integration/test-bug-549968-install-depends-of-not-installed
@@ -17,10 +17,10 @@ setupaptarchive
testequal 'Reading package lists...
Building dependency tree...
MarkInstall coolstuff [ i386 ] < none -> 1.0 > ( other ) FU=1
- Hold prevents MarkInstall of extracoolstuff [ i386 ] < none -> 1.0 > ( other ) FU=0
+ Ignore MarkInstall of extracoolstuff [ i386 ] < none -> 1.0 > ( other ) as its mode (Keep) is protected
Package extracoolstuff is not installed, so not removed
The following NEW packages will be installed:
coolstuff
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
-Inst coolstuff (1.0 unstable [i386])
-Conf coolstuff (1.0 unstable [i386])' aptget install coolstuff extracoolstuff- -o Debug::pkgDepCache::Marker=1 -s
+Inst coolstuff (1.0 unstable [all])
+Conf coolstuff (1.0 unstable [all])' aptget install coolstuff extracoolstuff- -o Debug::pkgDepCache::Marker=1 -s
diff --git a/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order b/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order
index 72de6eacb..0f6493948 100755
--- a/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order
+++ b/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order
@@ -62,13 +62,13 @@ predependsgawk2() {
echo "$pkgbasefile
Pre-Depends: $1
" >> rootdir/var/lib/dpkg/status
- testequalor2 "Inst coolstuff (1-1 localhost [i386])
-Conf coolstuff (1-1 localhost [i386])
+ testequalor2 "Inst coolstuff (1-1 localhost [all])
+Conf coolstuff (1-1 localhost [all])
Inst gawk2 (1:3.1.7.dfsg-5 localhost [i386])
Conf gawk2 (1:3.1.7.dfsg-5 localhost [i386])
-Remv mawk [1.3.3-15]" "Inst coolstuff (1-1 localhost [i386])
+Remv mawk [1.3.3-15]" "Inst coolstuff (1-1 localhost [all])
Inst gawk2 (1:3.1.7.dfsg-5 localhost [i386])
-Conf coolstuff (1-1 localhost [i386])
+Conf coolstuff (1-1 localhost [all])
Conf gawk2 (1:3.1.7.dfsg-5 localhost [i386])
Remv mawk [1.3.3-15]" aptget install gawk2 mawk- -sqq -o PreDepends=$(echo "$1" | sed 's/ //g')
}
diff --git a/test/integration/test-bug-593360-modifiers-in-names b/test/integration/test-bug-593360-modifiers-in-names
index c34b499b0..83a3cfabf 100755
--- a/test/integration/test-bug-593360-modifiers-in-names
+++ b/test/integration/test-bug-593360-modifiers-in-names
@@ -36,29 +36,29 @@ Building dependency tree...
The following NEW packages will be installed:
apt
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
-Inst apt (0.8.8 localhost [i386])
-Conf apt (0.8.8 localhost [i386])' aptget install apt -s
+Inst apt (0.8.8 localhost [all])
+Conf apt (0.8.8 localhost [all])' aptget install apt -s
testequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
apt+
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
-Inst apt+ (0.8.8 localhost [i386])
-Conf apt+ (0.8.8 localhost [i386])' aptget install apt+ -s
+Inst apt+ (0.8.8 localhost [all])
+Conf apt+ (0.8.8 localhost [all])' aptget install apt+ -s
testequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
apt+
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
-Inst apt+ (0.8.8 localhost [i386])
-Conf apt+ (0.8.8 localhost [i386])' aptget install apt++ -s
+Inst apt+ (0.8.8 localhost [all])
+Conf apt+ (0.8.8 localhost [all])' aptget install apt++ -s
testequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
apt+
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
-Inst apt+ (0.8.8 localhost [i386])
-Conf apt+ (0.8.8 localhost [i386])' aptget purge apt++ -s
+Inst apt+ (0.8.8 localhost [all])
+Conf apt+ (0.8.8 localhost [all])' aptget purge apt++ -s
diff --git a/test/integration/test-bug-612099-multiarch-conflicts b/test/integration/test-bug-612099-multiarch-conflicts
index 6d09a4fa1..b8cfe59e2 100755
--- a/test/integration/test-bug-612099-multiarch-conflicts
+++ b/test/integration/test-bug-612099-multiarch-conflicts
@@ -67,9 +67,9 @@ The following NEW packages will be installed:
The following packages will be upgraded:
libc6
1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
-Inst libc6 [1.0] (2.0 testing [i386])
+Inst libc6 [1.0] (2.0 testing [all])
Inst foobar (1.0 stable [i386])
-Conf libc6 (2.0 testing [i386])
+Conf libc6 (2.0 testing [all])
Conf foobar (1.0 stable [i386])' aptget install foobar/stable libc6 -st testing
testequal 'Reading package lists...
@@ -78,8 +78,8 @@ Reading state information...
The following packages will be upgraded:
libc6
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
-Inst libc6 [1.0] (2.0 testing [i386])
-Conf libc6 (2.0 testing [i386])' aptget upgrade -t testing -s
+Inst libc6 [1.0] (2.0 testing [all])
+Conf libc6 (2.0 testing [all])' aptget upgrade -t testing -s
aptget upgrade -y -qq 2>&1 > /dev/null
testdpkginstalled libc6
@@ -171,8 +171,8 @@ Reading state information...
The following packages will be upgraded:
libc6-same
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
-Inst libc6-same [1.0] (2.0 testing [i386])
-Conf libc6-same (2.0 testing [i386])' aptget upgrade -t testing -s
+Inst libc6-same [1.0] (2.0 testing [all])
+Conf libc6-same (2.0 testing [all])' aptget upgrade -t testing -s
aptget upgrade -y -qq 2>&1 > /dev/null
testdpkginstalled libc6-same
diff --git a/test/integration/test-bug-612958-use-dpkg-multiarch-config b/test/integration/test-bug-612958-use-dpkg-multiarch-config
new file mode 100755
index 000000000..4f31c3953
--- /dev/null
+++ b/test/integration/test-bug-612958-use-dpkg-multiarch-config
@@ -0,0 +1,59 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+setupaptarchive
+
+insertinstalledpackage 'libapt' 'i386' '1.0'
+insertinstalledpackage 'libapt' 'amd64' '1.0'
+insertinstalledpackage 'libapt' 'armel' '1.0'
+
+testpass() {
+ rm rootdir/var/cache/apt/*.bin
+ msgtest 'Test architecture handling' "$1 with $2"
+ aptcache show libapt:$2 2> /dev/null > /dev/null && msgpass || msgfail
+}
+
+testfail() {
+ rm rootdir/var/cache/apt/*.bin
+ msgtest 'Test architecture handling' "$1 with $2"
+ aptcache show libapt:$2 2> /dev/null > /dev/null && msgfail || msgpass
+}
+
+testpass 'no config' 'i386'
+testfail 'no config' 'amd64'
+testfail 'no config' 'armel'
+
+CONFFILE=rootdir/etc/apt/apt.conf.d/99multiarch
+echo '#clear APT::Architectures;' >> $CONFFILE
+echo 'APT::Architectures:: "i386";' >> $CONFFILE
+echo 'APT::Architectures:: "amd64";' >> $CONFFILE
+
+testpass 'apt config' 'i386'
+testpass 'apt config' 'amd64'
+testfail 'apt config' 'armel'
+
+echo 'APT::Architectures:: "armel";' >> $CONFFILE
+
+testpass 'apt config' 'armel'
+
+rm $CONFFILE
+
+echo '#clear APT::Architectures;' >> $CONFFILE
+echo 'Dir::Bin::dpkg "./dpkg-printer";' >> $CONFFILE
+
+echo '#! /bin/sh
+echo "amd64"' > ./dpkg-printer
+chmod +x ./dpkg-printer
+
+testpass 'dpkg config' 'i386'
+testpass 'dpkg config' 'amd64'
+testfail 'dpkg config' 'armel'
+
+echo '#! /bin/sh
+echo "amd64 armel"' > ./dpkg-printer
+
+testpass 'dpkg config' 'armel'
diff --git a/test/integration/test-bug-618848-always-respect-user-requests b/test/integration/test-bug-618848-always-respect-user-requests
new file mode 100755
index 000000000..5148be640
--- /dev/null
+++ b/test/integration/test-bug-618848-always-respect-user-requests
@@ -0,0 +1,32 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+
+insertinstalledpackage 'libdb4.8' 'all' '1.0'
+insertinstalledpackage 'exim4' 'all' '1.0' 'Depends: exim4-daemon-light | exim4-daemon-heavy'
+insertinstalledpackage 'exim4-daemon-light' 'all' '1.0' 'Depends: libdb4.8'
+insertpackage 'unstable' 'exim4-daemon-heavy' 'all' '1.0' 'Depends: libdb4.8'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+ MarkDelete libdb4.8 [ i386 ] < 1.0 > ( other ) FU=1
+ MarkDelete exim4-daemon-light [ i386 ] < 1.0 > ( other ) FU=1
+ MarkInstall exim4-daemon-heavy [ i386 ] < none -> 1.0 > ( other ) FU=0
+ Ignore MarkInstall of libdb4.8 [ i386 ] < 1.0 > ( other ) as its mode (Delete) is protected
+ MarkDelete exim4-daemon-heavy [ i386 ] < none -> 1.0 > ( other ) FU=0
+ MarkDelete exim4 [ i386 ] < 1.0 > ( other ) FU=1
+The following packages will be REMOVED:
+ exim4 exim4-daemon-light libdb4.8
+ MarkDelete exim4 [ i386 ] < 1.0 > ( other ) FU=1
+0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
+Remv exim4 [1.0]
+ MarkDelete exim4-daemon-light [ i386 ] < 1.0 > ( other ) FU=1
+Remv exim4-daemon-light [1.0]
+ MarkDelete libdb4.8 [ i386 ] < 1.0 > ( other ) FU=1
+Remv libdb4.8 [1.0]' aptget remove libdb4.8 -s -o Debug::pkgDepCache::Marker=1
diff --git a/test/integration/test-release-candidate-switching b/test/integration/test-release-candidate-switching
index b79828a9e..b6dbe99db 100755
--- a/test/integration/test-release-candidate-switching
+++ b/test/integration/test-release-candidate-switching
@@ -95,7 +95,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a
testequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok'
-Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok'
+Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok'
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok'
The following extra packages will be installed:
amarok-common (2.3.2-2+exp)
@@ -117,7 +117,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a
testequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-null'
-Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-null'
+Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-null'
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-null'
The following extra packages will be installed:
amarok-common (2.3.2-2+exp)
@@ -140,7 +140,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a
testequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok'
-Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok'
+Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok'
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok'
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-null'
The following extra packages will be installed:
@@ -170,7 +170,7 @@ Building dependency tree...
Selected version '2.3.2-2+exp' (experimental2 [i386]) for 'amarok-less'
Selected version '5:4.6.0+exp' (experimental [i386]) for 'phonon-backend-xine' because of 'amarok-less'
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-higher'
-Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-higher'
+Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-higher'
Selected version '5:4.6.0+exp' (experimental [i386]) for 'phonon-backend-xine' because of 'amarok-higher'
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-higher'
The following extra packages will be installed:
@@ -195,7 +195,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a
testequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-null2'
-Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-null2'
+Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-null2'
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-null2'
The following extra packages will be installed:
amarok-common (2.3.2-2+exp)
@@ -218,7 +218,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a
testequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine'
-Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-xine'
+Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine'
Selected version '5:4.6.0+exp' (experimental [i386]) for 'phonon-backend-xine' because of 'amarok-xine'
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-xine'
The following extra packages will be installed:
@@ -242,7 +242,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a
testequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine2'
-Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-xine2'
+Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine2'
Selected version '5:4.20.0+exp' (experimental [i386]) for 'phonon-backend-null' because of 'amarok-xine2'
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-xine2'
The following extra packages will be installed:
@@ -266,9 +266,9 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a
testequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine3'
-Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-xine3'
+Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine3'
Selected version '5:4.6.0+exp' (experimental [i386]) for 'phonon-backend-xine3' because of 'amarok-xine3'
-Selected version '2.0' (experimental [i386]) for 'intermediatepkg' because of 'phonon-backend-xine3'
+Selected version '2.0' (experimental [all]) for 'intermediatepkg' because of 'phonon-backend-xine3'
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-xine3'
The following extra packages will be installed:
amarok-common (2.3.2-2+exp)
@@ -293,7 +293,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a
testequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine4'
-Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-xine4'
+Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine4'
Selected version '5:4.20.0+exp' (experimental [i386]) for 'phonon-backend-null' because of 'amarok-xine4'
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-xine4'
The following extra packages will be installed:
@@ -317,7 +317,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a
testequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-broken'
-Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-broken'
+Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-broken'
Selected version '5:4.20.0+exp' (experimental [i386]) for 'phonon-backend-null' because of 'amarok-broken'
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-broken'
The following extra packages will be installed:
@@ -341,7 +341,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a
testequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-recommends'
-Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-recommends'
+Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-recommends'
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-recommends'
The following extra packages will be installed:
amarok-common (2.3.2-2+exp)
@@ -364,7 +364,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a
testequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-recommends'
-Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-recommends'
+Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-recommends'
The following extra packages will be installed:
amarok-common (2.3.2-2+exp)
Recommended packages:
@@ -385,7 +385,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a
testequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-recommends2'
-Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-recommends2'
+Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-recommends2'
The following extra packages will be installed:
amarok-common (2.3.2-2+exp)
libc6 (2.11.2-7+sid)
@@ -406,7 +406,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a
# if one depends doesn't work, we don't need to look deeper…
testequal "Reading package lists...
Building dependency tree...
-Selected version '1.0' (experimental [i386]) for 'uninstallablepkg'
+Selected version '1.0' (experimental [all]) for 'uninstallablepkg'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created