c1out << _("Y") << endl;
return true;
}
+ else if (_config->FindB("APT::Get::Assume-No",false) == true)
+ {
+ c1out << _("N") << endl;
+ return false;
+ }
char response[1024] = "";
cin.getline(response, sizeof(response));
{
// Call the scored problem resolver
Fix->InstallProtect();
- if (Fix->Resolve(true) == false)
- _error->Discard();
+ Fix->Resolve(true);
delete Fix;
}
c1out << _("The following information may help to resolve the situation:") << endl;
c1out << endl;
ShowBroken(c1out,Cache,false);
- return _error->Error(_("Broken packages"));
- }
+ if (_error->PendingError() == true)
+ return false;
+ else
+ return _error->Error(_("Broken packages"));
+ }
}
if (!DoAutomaticRemove(Cache))
return false;
pkgAcquire Fetcher;
AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0));
- if (_config->FindB("APT::Get::Print-URIs") == true)
+ if (_config->FindB("APT::Get::Print-URIs") == false)
Fetcher.Setup(&Stat);
pkgRecords Recs(Cache);
strprintf(descr, _("Downloading %s %s"), Pkg.Name(), Ver.VerStr());
// get the most appropriate hash
HashString hash;
+ if (rec.SHA512Hash() != "")
+ hash = HashString("sha512", rec.SHA512Hash());
if (rec.SHA256Hash() != "")
hash = HashString("sha256", rec.SHA256Hash());
else if (rec.SHA1Hash() != "")
// Try to compile it with dpkg-buildpackage
if (_config->FindB("APT::Get::Compile",false) == true)
{
+ string buildopts = _config->Find("APT::Get::Host-Architecture");
+ if (buildopts.empty() == false)
+ buildopts = "-a " + buildopts + " ";
+ buildopts.append(_config->Find("DPkg::Build-Options","-b -uc"));
+
// Call dpkg-buildpackage
char S[500];
snprintf(S,sizeof(S),"cd %s && %s %s",
Dir.c_str(),
_config->Find("Dir::Bin::dpkg-buildpackage","dpkg-buildpackage").c_str(),
- _config->Find("DPkg::Build-Options","-b -uc").c_str());
+ buildopts.c_str());
if (system(S) != 0)
{
if (Fetcher.Setup(&Stat) == false)
return false;
+ bool StripMultiArch;
+ string hostArch = _config->Find("APT::Get::Host-Architecture");
+ if (hostArch.empty() == false)
+ {
+ std::vector<std::string> archs = APT::Configuration::getArchitectures();
+ if (std::find(archs.begin(), archs.end(), hostArch) == archs.end())
+ return _error->Error(_("No architecture information available for %s. See apt.conf(5) APT::Architectures for setup"), hostArch.c_str());
+ StripMultiArch = false;
+ }
+ else
+ StripMultiArch = true;
+
unsigned J = 0;
- bool const StripMultiArch = APT::Configuration::getArchitectures().size() <= 1;
for (const char **I = CmdL.FileList + 1; *I != 0; I++, J++)
{
string Src;
ioprintf(c1out,_("%s has no build depends.\n"),Src.c_str());
continue;
}
-
+
// Install the requested packages
vector <pkgSrcRecords::Parser::BuildDepRec>::iterator D;
pkgProblemResolver Fix(Cache);
if (_config->FindB("Debug::BuildDeps",false) == true)
cout << "Looking for " << (*D).Package << "...\n";
- pkgCache::PkgIterator Pkg = Cache->FindPkg((*D).Package);
+ pkgCache::PkgIterator Pkg;
+
+ // Cross-Building?
+ if (StripMultiArch == false)
+ {
+ size_t const colon = D->Package.find(":");
+ if (colon != string::npos &&
+ (strcmp(D->Package.c_str() + colon, ":any") == 0 || strcmp(D->Package.c_str() + colon, ":native") == 0))
+ Pkg = Cache->FindPkg(D->Package.substr(0,colon));
+ else
+ Pkg = Cache->FindPkg(D->Package);
+
+ // We need to decide if host or build arch, so find a version we can look at
+ pkgCache::VerIterator Ver;
+
+ // a bad version either is invalid or doesn't satify dependency
+ #define BADVER(Ver) Ver.end() == true || \
+ (Ver.end() == false && D->Version.empty() == false && \
+ Cache->VS().CheckDep(Ver.VerStr(),D->Op,D->Version.c_str()) == false)
+
+ if (Pkg.end() == false)
+ {
+ Ver = (*Cache)[Pkg].InstVerIter(*Cache);
+ if (BADVER(Ver))
+ Ver = (*Cache)[Pkg].CandidateVerIter(*Cache);
+ }
+ if (BADVER(Ver))
+ {
+ pkgCache::PkgIterator HostPkg = Cache->FindPkg(D->Package, hostArch);
+ if (HostPkg.end() == false)
+ {
+ Ver = (*Cache)[HostPkg].InstVerIter(*Cache);
+ if (BADVER(Ver))
+ Ver = (*Cache)[HostPkg].CandidateVerIter(*Cache);
+ }
+ }
+ if ((BADVER(Ver)) == false)
+ {
+ string forbidden;
+ if (Ver->MultiArch == pkgCache::Version::None || Ver->MultiArch == pkgCache::Version::All);
+ else if (Ver->MultiArch == pkgCache::Version::Same)
+ {
+ if (colon != string::npos)
+ Pkg = Ver.ParentPkg().Group().FindPkg(hostArch);
+ else if (strcmp(D->Package.c_str() + colon, ":any") == 0)
+ forbidden = "Multi-Arch: same";
+ // :native gets the buildArch
+ }
+ else if (Ver->MultiArch == pkgCache::Version::Foreign || Ver->MultiArch == pkgCache::Version::AllForeign)
+ {
+ if (colon != string::npos)
+ forbidden = "Multi-Arch: foreign";
+ }
+ else if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed)
+ {
+ if (colon == string::npos)
+ Pkg = Ver.ParentPkg().Group().FindPkg(hostArch);
+ else if (strcmp(D->Package.c_str() + colon, ":any") == 0)
+ {
+ // prefer any installed over preferred non-installed architectures
+ pkgCache::GrpIterator Grp = Ver.ParentPkg().Group();
+ // we don't check for version here as we are better of with upgrading than remove and install
+ for (Pkg = Grp.PackageList(); Pkg.end() == false; Pkg = Grp.NextPkg(Pkg))
+ if (Pkg.CurrentVer().end() == false)
+ break;
+ if (Pkg.end() == true)
+ Pkg = Grp.FindPreferredPkg(true);
+ }
+ // native gets buildArch
+ }
+ if (forbidden.empty() == false)
+ {
+ if (_config->FindB("Debug::BuildDeps",false) == true)
+ cout << " :any is not allowed from M-A: same package " << (*D).Package << endl;
+ if (hasAlternatives)
+ continue;
+ return _error->Error(_("%s dependency for %s can't be satisfied "
+ "because %s is not allowed on '%s' packages"),
+ Last->BuildDepType(D->Type), Src.c_str(),
+ D->Package.c_str(), "Multi-Arch: same");
+ }
+ }
+ else if (_config->FindB("Debug::BuildDeps",false) == true)
+ cout << " No multiarch info as we have no satisfying installed nor candidate for " << D->Package << " on build or host arch" << endl;
+ #undef BADVER
+ }
+ else
+ Pkg = Cache->FindPkg(D->Package);
+
if (Pkg.end() == true)
{
if (_config->FindB("Debug::BuildDeps",false) == true)
{'s',"dry-run","APT::Get::Simulate",0},
{'s',"no-act","APT::Get::Simulate",0},
{'y',"yes","APT::Get::Assume-Yes",0},
- {'y',"assume-yes","APT::Get::Assume-Yes",0},
+ {'y',"assume-yes","APT::Get::Assume-Yes",0},
+ {0,"assume-no","APT::Get::Assume-No",0},
{'f',"fix-broken","APT::Get::Fix-Broken",0},
{'u',"show-upgraded","APT::Get::Show-Upgraded",0},
{'m',"ignore-missing","APT::Get::Fix-Missing",0},
{'t',"target-release","APT::Default-Release",CommandLine::HasArg},
{'t',"default-release","APT::Default-Release",CommandLine::HasArg},
+ {'a',"host-architecture","APT::Get::Host-Architecture",CommandLine::HasArg},
{0,"download","APT::Get::Download",0},
{0,"fix-missing","APT::Get::Fix-Missing",0},
{0,"ignore-hold","APT::Ignore-Hold",0},
{0,"install-recommends","APT::Install-Recommends",CommandLine::Boolean},
{0,"install-suggests","APT::Install-Suggests",CommandLine::Boolean},
{0,"fix-policy","APT::Get::Fix-Policy-Broken",0},
+ {0,"solver","APT::Solver",CommandLine::HasArg},
{'c',"config-file",0,CommandLine::ConfigFile},
{'o',"option",0,CommandLine::ArbItem},
{0,0,0,0}};