]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-get.cc
make "apt-get build-dep" installed packages marked automatic
[apt.git] / cmdline / apt-get.cc
index be194f2dbf263c73de91a0309d68ccf8baed2e67..43f8ec8b86d7ff5e0054c46b7a6ed1dcf7130ee2 100644 (file)
@@ -1374,8 +1374,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 +1496,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,false,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 +1721,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 +1730,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 +2515,8 @@ bool DoBuildDep(CommandLine &CmdL)
             {
                // We successfully installed something; skip remaining alternatives
                skipAlternatives = hasAlternatives;
+              if(_config->FindB("APT::Get::Build-Dep-Automatic", false) == true)
+                 Cache->MarkAuto(Pkg, true);
                continue;
             }
             else if (hasAlternatives)
@@ -2635,7 +2648,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 +2732,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},