]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-get.cc
add a note about the uncomplete toolchain to sound a bit more scary
[apt.git] / cmdline / apt-get.cc
index 34ae2fed94c1ac85a8e1d8a80eef9e03a25f3b53..c8c733716774923a92cf8730f247b865f1f7dfe4 100644 (file)
@@ -227,6 +227,17 @@ bool ShowList(ostream &out,string Title,string List,string VersionsList)
    return false;
 }
                                                                        /*}}}*/
+// ShowPkg - display a package name                                    /*{{{*/
+// ---------------------------------------------------------------------
+/* Displays the package name and maybe also the architecture
+   if it is not the main architecture */
+string ShowPkg(pkgCache::PkgIterator const Pkg) {
+       string p = Pkg.Name();
+       if (strcmp(Pkg.Arch(),"all") != 0 && _config->Find("APT::Architecture") != Pkg.Arch())
+               p.append(":").append(Pkg.Arch());
+       return p;
+}
+                                                                       /*}}}*/
 // ShowBroken - Debugging aide                                         /*{{{*/
 // ---------------------------------------------------------------------
 /* This prints out the names of all the packages that are broken along
@@ -258,8 +269,8 @@ void ShowBroken(ostream &out,CacheFile &Cache,bool Now)
       }
       
       // Print out each package and the failed dependencies
-      out <<"  " <<  I.Name() << ":";
-      unsigned Indent = strlen(I.Name()) + 3;
+      out << " " << ShowPkg(I) << " :";
+      unsigned const Indent = ShowPkg(I).size() + 3;
       bool First = true;
       pkgCache::VerIterator Ver;
       
@@ -312,7 +323,7 @@ void ShowBroken(ostream &out,CacheFile &Cache,bool Now)
               out << ' ' << End.DepType() << ": ";
            FirstOr = false;
            
-           out << Start.TargetPkg().Name();
+           out << ShowPkg(Start.TargetPkg());
         
            // Show a quick summary of the version requirements
            if (Start.TargetVer() != 0)
@@ -374,7 +385,9 @@ void ShowNew(ostream &out,CacheFile &Cache)
    {
       pkgCache::PkgIterator I(Cache,Cache.List[J]);
       if (Cache[I].NewInstall() == true) {
-         List += string(I.Name()) + " ";
+        if (Cache[I].CandidateVerIter(Cache).Pseudo() == true)
+           continue;
+         List += ShowPkg(I) + " ";
          VersionsList += string(Cache[I].CandVersion) + "\n";
       }
    }
@@ -396,10 +409,12 @@ void ShowDel(ostream &out,CacheFile &Cache)
       pkgCache::PkgIterator I(Cache,Cache.List[J]);
       if (Cache[I].Delete() == true)
       {
+        if (Cache[I].CandidateVerIter(Cache).Pseudo() == true)
+           continue;
         if ((Cache[I].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge)
-           List += string(I.Name()) + "* ";
+           List += ShowPkg(I) + "* ";
         else
-           List += string(I.Name()) + " ";
+           List += ShowPkg(I) + " ";
      
      VersionsList += string(Cache[I].CandVersion)+ "\n";
       }
@@ -424,7 +439,7 @@ void ShowKept(ostream &out,CacheFile &Cache)
          I->CurrentVer == 0 || Cache[I].Delete() == true)
         continue;
       
-      List += string(I.Name()) + " ";
+      List += ShowPkg(I) + " ";
       VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n";
    }
    ShowList(out,_("The following packages have been kept back:"),List,VersionsList);
@@ -444,8 +459,10 @@ void ShowUpgraded(ostream &out,CacheFile &Cache)
       // Not interesting
       if (Cache[I].Upgrade() == false || Cache[I].NewInstall() == true)
         continue;
-      
-      List += string(I.Name()) + " ";
+      if (Cache[I].CandidateVerIter(Cache).Pseudo() == true)
+        continue;
+
+      List += ShowPkg(I) + " ";
       VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n";
    }
    ShowList(out,_("The following packages will be upgraded:"),List,VersionsList);
@@ -465,8 +482,10 @@ bool ShowDowngraded(ostream &out,CacheFile &Cache)
       // Not interesting
       if (Cache[I].Downgrade() == false || Cache[I].NewInstall() == true)
         continue;
-      
-      List += string(I.Name()) + " ";
+      if (Cache[I].CandidateVerIter(Cache).Pseudo() == true)
+        continue;
+
+      List += ShowPkg(I) + " ";
       VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n";
    }
    return ShowList(out,_("The following packages will be DOWNGRADED:"),List,VersionsList);
@@ -484,7 +503,7 @@ bool ShowHold(ostream &out,CacheFile &Cache)
       pkgCache::PkgIterator I(Cache,Cache.List[J]);
       if (Cache[I].InstallVer != (pkgCache::Version *)I.CurrentVer() &&
           I->SelectedState == pkgCache::State::Hold) {
-         List += string(I.Name()) + " ";
+         List += ShowPkg(I) + " ";
                 VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n";
       }
    }
@@ -518,7 +537,7 @@ bool ShowEssential(ostream &out,CacheFile &Cache)
         if (Added[I->ID] == false)
         {
            Added[I->ID] = true;
-           List += string(I.Name()) + " ";
+           List += ShowPkg(I) + " ";
         //VersionsList += string(Cache[I].CurVersion) + "\n"; ???
         }
       }
@@ -566,6 +585,9 @@ void Stats(ostream &out,pkgDepCache &Dep)
    unsigned long ReInstall = 0;
    for (pkgCache::PkgIterator I = Dep.PkgBegin(); I.end() == false; I++)
    {
+      if (pkgCache::VerIterator(Dep, Dep[I].CandidateVer).Pseudo() == true)
+        continue;
+
       if (Dep[I].NewInstall() == true)
         Install++;
       else
@@ -1504,10 +1526,9 @@ bool DoAutomaticRemove(CacheFile &Cache)
            // only show stuff in the list that is not yet marked for removal
            if(Cache[Pkg].Delete() == false) 
            {
+              ++autoRemoveCount;
               // we don't need to fill the strings if we don't need them
-              if (smallList == true)
-                 ++autoRemoveCount;
-              else
+              if (smallList == false)
               {
                 autoremovelist += string(Pkg.Name()) + " ";
                 autoremoveversions += string(Cache[Pkg].CandVersion) + "\n";
@@ -1520,9 +1541,12 @@ bool DoAutomaticRemove(CacheFile &Cache)
    if (doAutoRemove == false && (autoremovelist.empty() == false || autoRemoveCount != 0))
    {
       if (smallList == false)
-        ShowList(c1out, _("The following packages were automatically installed and are no longer required:"), autoremovelist, autoremoveversions);
+        ShowList(c1out, P_("The following package is automatically installed and is no longer required:",
+                 "The following packages were automatically installed and are no longer required:",
+                 autoRemoveCount), autoremovelist, autoremoveversions);
       else
-        ioprintf(c1out, _("%lu packages were automatically installed and are no longer required.\n"), autoRemoveCount);
+        ioprintf(c1out, P_("%lu package was automatically installed and is no longer required.\n",
+                 "%lu packages were automatically installed and are no longer required.\n", autoRemoveCount), autoRemoveCount);
       c1out << _("Use 'apt-get autoremove' to remove them.") << std::endl;
    }
    // Now see if we had destroyed anything (if we had done anything)
@@ -2436,7 +2460,7 @@ bool DoBuildDep(CommandLine &CmdL)
             
       // Process the build-dependencies
       vector<pkgSrcRecords::Parser::BuildDepRec> BuildDeps;
-      if (Last->BuildDepends(BuildDeps, _config->FindB("APT::Get::Arch-Only",false)) == false)
+      if (Last->BuildDepends(BuildDeps, _config->FindB("APT::Get::Arch-Only",true)) == false)
        return _error->Error(_("Unable to get build-dependency information for %s"),Src.c_str());
    
       // Also ensure that build-essential packages are present