]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-get.cc
apt-pkg/edsp.cc: do not use stderr in WriteSolution at all
[apt.git] / cmdline / apt-get.cc
index b433a7915e3ad041e3f05e584bb2f4ae24bc1e0c..e3c74a0994dd5a720eae1570bfc121699f418db8 100644 (file)
@@ -1255,7 +1255,9 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
    {
       if (_config->FindB("APT::Get::Trivial-Only",false) == true)
         return _error->Error(_("Trivial Only specified but this is not a trivial operation."));
-      
+
+      // TRANSLATOR: This string needs to be typed by the user as a confirmation, so be
+      //             careful with hard to type or special characters (like non-breaking spaces)
       const char *Prompt = _("Yes, do as I say!");
       ioprintf(c2out,
               _("You are about to do something potentially harmful.\n"
@@ -1434,7 +1436,7 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache,
    if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0)
    {
       CacheSetHelperAPTGet helper(c1out);
-      helper.showErrors(AllowFail == false);
+      helper.showErrors(false);
       pkgCache::VerIterator Ver = helper.canNotFindNewestVer(Cache, Pkg);
       if (Ver.end() == false)
         Pkg = Ver.ParentPkg();
@@ -1734,7 +1736,7 @@ bool DoAutomaticRemove(CacheFile &Cache)
         {
            if(Pkg.CurrentVer() != 0 && 
               Pkg->CurrentState != pkgCache::State::ConfigFiles)
-              Cache->MarkDelete(Pkg, purgePkgs);
+              Cache->MarkDelete(Pkg, purgePkgs, 0, false);
            else
               Cache->MarkKeep(Pkg, false, false);
         }
@@ -1748,7 +1750,7 @@ bool DoAutomaticRemove(CacheFile &Cache)
            {
               if (Pkg.CandVersion() != 0)
                  tooMuch.insert(Pkg);
-              Cache->MarkDelete(Pkg, false);
+              Cache->MarkDelete(Pkg, false, 0, false);
            }
            // only show stuff in the list that is not yet marked for removal
            else if(hideAutoRemove == false && Cache[Pkg].Delete() == false)
@@ -1785,7 +1787,7 @@ bool DoAutomaticRemove(CacheFile &Cache)
                    continue;
                 if (Debug == true)
                    std::clog << "Save " << Pkg << " as another installed garbage package depends on it" << std::endl;
-                Cache->MarkInstall(Pkg, false);
+                Cache->MarkInstall(Pkg, false, 0, false);
                 if (hideAutoRemove == false)
                    ++autoRemoveCount;
                 tooMuch.erase(Pkg);
@@ -2393,7 +2395,7 @@ bool DoDownload(CommandLine &CmdL)
       HashString hash;
       if (rec.SHA512Hash() != "")
          hash = HashString("sha512", rec.SHA512Hash());
-      if (rec.SHA256Hash() != "")
+      else if (rec.SHA256Hash() != "")
          hash = HashString("sha256", rec.SHA256Hash());
       else if (rec.SHA1Hash() != "")
          hash = HashString("sha1", rec.SHA1Hash());
@@ -2895,11 +2897,15 @@ bool DoBuildDep(CommandLine &CmdL)
            if (StripMultiArch == false && D->Type != pkgSrcRecords::Parser::BuildDependIndep)
            {
               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));
+              if (colon != string::npos)
+              {
+                 if (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);
+              }
               else
-                 Pkg = Cache->FindPkg(D->Package);
+                 Pkg = Cache->FindPkg(D->Package, hostArch);
 
               // a bad version either is invalid or doesn't satify dependency
               #define BADVER(Ver) (Ver.end() == true || \
@@ -2918,13 +2924,13 @@ bool DoBuildDep(CommandLine &CmdL)
               }
               if (verlist.empty() == true)
               {
-                 pkgCache::PkgIterator HostPkg = Cache->FindPkg(D->Package, hostArch);
-                 if (HostPkg.end() == false)
+                 pkgCache::PkgIterator BuildPkg = Cache->FindPkg(D->Package, "native");
+                 if (BuildPkg.end() == false && Pkg != BuildPkg)
                  {
-                    pkgCache::VerIterator Ver = (*Cache)[HostPkg].InstVerIter(*Cache);
+                    pkgCache::VerIterator Ver = (*Cache)[BuildPkg].InstVerIter(*Cache);
                     if (BADVER(Ver) == false)
                        verlist.insert(Ver);
-                    Ver = (*Cache)[HostPkg].CandidateVerIter(*Cache);
+                    Ver = (*Cache)[BuildPkg].CandidateVerIter(*Cache);
                     if (BADVER(Ver) == false)
                        verlist.insert(Ver);
                  }
@@ -2943,6 +2949,8 @@ bool DoBuildDep(CommandLine &CmdL)
                        Pkg = Ver.ParentPkg().Group().FindPkg(hostArch);
                     else if (strcmp(D->Package.c_str() + colon, ":any") == 0)
                        forbidden = "Multi-Arch: none";
+                    else if (strcmp(D->Package.c_str() + colon, ":native") == 0)
+                       Pkg = Ver.ParentPkg().Group().FindPkg("native");
                  }
                  else if (Ver->MultiArch == pkgCache::Version::Same)
                  {
@@ -2950,11 +2958,15 @@ bool DoBuildDep(CommandLine &CmdL)
                        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 (strcmp(D->Package.c_str() + colon, ":native") == 0)
+                       Pkg = Ver.ParentPkg().Group().FindPkg("native");
                  }
                  else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign)
                  {
-                    if (colon != string::npos)
+                    if (colon == string::npos)
+                       Pkg = Ver.ParentPkg().Group().FindPkg("native");
+                    else if (strcmp(D->Package.c_str() + colon, ":any") == 0 ||
+                             strcmp(D->Package.c_str() + colon, ":native") == 0)
                        forbidden = "Multi-Arch: foreign";
                  }
                  else if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed)
@@ -2972,7 +2984,8 @@ bool DoBuildDep(CommandLine &CmdL)
                        if (Pkg.end() == true)
                           Pkg = Grp.FindPreferredPkg(true);
                     }
-                    // native gets buildArch
+                    else if (strcmp(D->Package.c_str() + colon, ":native") == 0)
+                       Pkg = Ver.ParentPkg().Group().FindPkg("native");
                  }
 
                  if (forbidden.empty() == false)
@@ -3004,7 +3017,7 @@ bool DoBuildDep(CommandLine &CmdL)
            else
               Pkg = Cache->FindPkg(D->Package);
 
-           if (Pkg.end() == true || Pkg->VersionList == 0)
+           if (Pkg.end() == true || (Pkg->VersionList == 0 && Pkg->ProvidesList == 0))
             {
                if (_config->FindB("Debug::BuildDeps",false) == true)
                     cout << " (not found)" << (*D).Package << endl;