X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/187b88d8d90ee10b2e2e14ba762be2fdd9fce744..12ea996c64f8085474f5fcbed909e4d2cb7ae798:/cmdline/apt-get.cc

diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 258133c19..27e16d3f3 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -1272,16 +1272,23 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
 	 }
       }   
    }
-   
-   // No source package name..
-   if (Src.empty() == true)
-      Src = TmpSrc;
-   
+
    // The best hit
    pkgSrcRecords::Parser *Last = 0;
    unsigned long Offset = 0;
    string Version;
    bool IsMatch = false;
+   bool MatchSrcOnly = false;
+
+   // No source package name..
+   if (Src.empty() == true)
+      Src = TmpSrc;
+   else 
+      // if we have a source pkg name, make sure to only search
+      // for srcpkg names, otherwise apt gets confused if there
+      // is a binary package "pkg1" and a source package "pkg1"
+      // with the same name but that comes from different packages
+      MatchSrcOnly = true;
    
    // If we are matching by version then we need exact matches to be happy
    if (VerTag.empty() == false)
@@ -1291,13 +1298,13 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
       binary packages in the search */
    pkgSrcRecords::Parser *Parse;
    SrcRecs.Restart();
-   while ((Parse = SrcRecs.Find(Src.c_str(),false)) != 0)
+   while ((Parse = SrcRecs.Find(Src.c_str(), MatchSrcOnly)) != 0)
    {
       string Ver = Parse->Version();
       
-      // Skip name mismatches
-      if (IsMatch == true && Parse->Package() != Src)
-	 continue;
+      // show name mismatches
+      if (IsMatch == true && Parse->Package() != Src) 
+	 ioprintf(c1out,  _("No source package '%s' picking '%s' instead\n"), Parse->Package().c_str(), Src.c_str());
       
       if (VerTag.empty() == false)
       {
@@ -1374,8 +1381,9 @@ bool DoUpdate(CommandLine &CmdL)
 
    // do the work
    CacheFile Cache;
-   bool res = ListUpdate(Stat, List);
-     
+   if (_config->FindB("APT::Get::Download",true) == true)
+       ListUpdate(Stat, List);
+
    // Rebuild the cache.   
    if (Cache.BuildCaches() == false)
       return false;
@@ -1495,21 +1503,29 @@ bool TryInstallTask(pkgDepCache &Cache, pkgProblemResolver &Fix,
    
    bool found = false;
    bool res = true;
-   for (Pkg = Cache.PkgBegin(); Pkg.end() == false; Pkg++)
+
+   // two runs, first ignore dependencies, second install any missing
+   for(int IgnoreBroken=1; IgnoreBroken >= 0; IgnoreBroken--)
    {
-      pkgCache::VerIterator ver = Cache[Pkg].CandidateVerIter(Cache);
-      if(ver.end())
-	 continue;
-      pkgRecords::Parser &parser = Recs.Lookup(ver.FileList());
-      parser.GetRec(start,end);
-      strncpy(buf, start, end-start);
-      buf[end-start] = 0x0;
-      if (regexec(&Pattern,buf,0,0,0) != 0)
-	 continue;
-      res &= TryToInstall(Pkg,Cache,Fix,Remove,true,ExpectedInst);
-      found = true;
+      for (Pkg = Cache.PkgBegin(); Pkg.end() == false; Pkg++)
+      {
+	 pkgCache::VerIterator ver = Cache[Pkg].CandidateVerIter(Cache);
+	 if(ver.end())
+	    continue;
+	 pkgRecords::Parser &parser = Recs.Lookup(ver.FileList());
+	 parser.GetRec(start,end);
+	 strncpy(buf, start, end-start);
+	 buf[end-start] = 0x0;
+	 if (regexec(&Pattern,buf,0,0,0) != 0)
+	    continue;
+	 res &= TryToInstall(Pkg,Cache,Fix,Remove,IgnoreBroken,ExpectedInst);
+	 found = true;
+      }
    }
    
+   // now let the problem resolver deal with any issues
+   Fix.Resolve(true);
+
    if(!found)
       _error->Error(_("Couldn't find task %s"),taskname);
 
@@ -1712,6 +1728,7 @@ bool DoInstall(CommandLine &CmdL)
 	      "requested an impossible situation or if you are using the unstable\n" 
 	      "distribution that some required packages have not yet been created\n"
 	      "or been moved out of Incoming.") << endl;
+	 /*
 	 if (Packages == 1)
 	 {
 	    c1out << endl;
@@ -1720,6 +1737,7 @@ bool DoInstall(CommandLine &CmdL)
 		 "the package is simply not installable and a bug report against\n" 
 		 "that package should be filed.") << endl;
 	 }
+	 */
 
 	 c1out << _("The following information may help to resolve the situation:") << endl;
 	 c1out << endl;
@@ -2504,6 +2522,8 @@ bool DoBuildDep(CommandLine &CmdL)
             {
                // We successfully installed something; skip remaining alternatives
                skipAlternatives = hasAlternatives;
+	       if(_config->FindB("APT::Get::Build-Dep-Automatic", true) == true)
+		  Cache->MarkAuto(Pkg, true);
                continue;
             }
             else if (hasAlternatives)
@@ -2618,8 +2638,8 @@ bool ShowHelp(CommandLine &CmdL)
       "   upgrade - Perform an upgrade\n"
       "   install - Install new packages (pkg is libc6 not libc6.deb)\n"
       "   remove - Remove packages\n"
-      "   autoremove - Remove all automatic unused packages\n"
-      "   purge - Remove and purge packages\n"
+      "   autoremove - Remove automatically all unused packages\n"
+      "   purge - Remove packages and config files\n"
       "   source - Download source archives\n"
       "   build-dep - Configure build-dependencies for source packages\n"
       "   dist-upgrade - Distribution upgrade, see apt-get(8)\n"
@@ -2635,7 +2655,7 @@ bool ShowHelp(CommandLine &CmdL)
       "  -d  Download only - do NOT install or unpack archives\n"
       "  -s  No-act. Perform ordering simulation\n"
       "  -y  Assume Yes to all queries and do not prompt\n"
-      "  -f  Attempt to continue if the integrity check fails\n"
+      "  -f  Attempt to correct a system with broken dependencies in place\n"
       "  -m  Attempt to continue if archives are unlocatable\n"
       "  -u  Show a list of upgraded packages as well\n"
       "  -b  Build the source package after fetching it\n"
@@ -2719,6 +2739,7 @@ int main(int argc,const char *argv[])
       {0,"only-source","APT::Get::Only-Source",0},
       {0,"arch-only","APT::Get::Arch-Only",0},
       {0,"auto-remove","APT::Get::AutomaticRemove",0},
+      {0,"build-dep-automatic","APT::Get::Build-Dep-Automatic",0},
       {0,"allow-unauthenticated","APT::Get::AllowUnauthenticated",0},
       {0,"install-recommends","APT::Install-Recommends",CommandLine::Boolean},
       {0,"fix-policy","APT::Get::Fix-Policy-Broken",0},