]> git.saurik.com Git - apt.git/commitdiff
* fix error in AutocleanInterval, closes: #319339
authorMichael Vogt <egon@bottom>
Fri, 8 Jun 2007 20:33:05 +0000 (22:33 +0200)
committerMichael Vogt <egon@bottom>
Fri, 8 Jun 2007 20:33:05 +0000 (22:33 +0200)
  (thanks to Israel G. Lugo for the patch)
* add "purge" commandline argument, closes: #133421)
  (thanks to Julien Danjou for the patch)

1  2 
cmdline/apt-get.cc
debian/apt.cron.daily
debian/changelog
doc/apt-get.8.xml

diff --combined cmdline/apt-get.cc
index aa6a70ffe04edb08c53b2d4237a0a14966584927,c79c1559e14cf7770060555e4ebad4a6dadae475..74824b6b05e91e7f2cb10791db66a5f53d940de2
@@@ -60,7 -60,6 +60,7 @@@
  #include <errno.h>
  #include <regex.h>
  #include <sys/wait.h>
 +#include <sstream>
                                                                        /*}}}*/
  
  using namespace std;
@@@ -629,8 -628,6 +629,8 @@@ void CacheFile::Sort(
     and verifies that the system is OK. */
  bool CacheFile::CheckDeps(bool AllowBroken)
  {
 +   bool FixBroken = _config->FindB("APT::Get::Fix-Broken",false);
 +
     if (_error->PendingError() == true)
        return false;
  
     if (pkgApplyStatus(*DCache) == false)
        return false;
     
 +   if (_config->FindB("APT::Get::Fix-Policy-Broken",false) == true)
 +   {
 +      FixBroken = true;
 +      if ((DCache->PolicyBrokenCount() > 0))
 +      {
 +       // upgrade all policy-broken packages with ForceImportantDeps=True
 +       for (pkgCache::PkgIterator I = Cache->PkgBegin(); !I.end(); I++)
 +          if ((*DCache)[I].NowPolicyBroken() == true) 
 +             DCache->MarkInstall(I,true,0, false, true);
 +      }
 +   }
 +
     // Nothing is broken
     if (DCache->BrokenCount() == 0 || AllowBroken == true)
        return true;
  
     // Attempt to fix broken things
 -   if (_config->FindB("APT::Get::Fix-Broken",false) == true)
 +   if (FixBroken == true)
     {
        c1out << _("Correcting dependencies...") << flush;
        if (pkgFixBroken(*DCache) == false || DCache->BrokenCount() != 0)
@@@ -1010,7 -995,7 +1010,7 @@@ bool InstallPackages(CacheFile &Cache,b
         cerr << _("Unable to correct missing packages.") << endl;
         return _error->Error(_("Aborting install."));
        }
 -               
 +
        _system->UnLock();
        int status_fd = _config->FindI("APT::Status-Fd",-1);
        pkgPackageManager::OrderResult Res = PM->DoInstall(status_fd);
@@@ -1160,11 -1145,9 +1160,11 @@@ bool TryToInstall(pkgCache::PkgIterato
     else
        ExpectedInst++;
     
 -   // Install it with autoinstalling enabled.
 -   if (State.InstBroken() == true && BrokenFix == false)
 +   // Install it with autoinstalling enabled (if we not respect the minial
 +   // required deps or the policy)
 +   if ((State.InstBroken() == true || State.InstPolicyBroken() == true) && BrokenFix == false)
        Cache.MarkInstall(Pkg,true);
 +
     return true;
  }
                                                                        /*}}}*/
@@@ -1372,29 -1355,20 +1372,29 @@@ bool DoUpdate(CommandLine &CmdL
        return false;
  
     bool Failed = false;
 +   bool TransientNetworkFailure = false;
     for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++)
     {
        if ((*I)->Status == pkgAcquire::Item::StatDone)
         continue;
  
        (*I)->Finished();
 -      
 +
        fprintf(stderr,_("Failed to fetch %s  %s\n"),(*I)->DescURI().c_str(),
              (*I)->ErrorText.c_str());
 +
 +      if ((*I)->Status == pkgAcquire::Item::StatTransientNetworkError) 
 +      {
 +       TransientNetworkFailure = true;
 +       continue;
 +      }
 +
        Failed = true;
     }
     
     // Clean out any old list files
 -   if (!Failed && _config->FindB("APT::Get::List-Cleanup",true) == true)
 +   if (!TransientNetworkFailure &&
 +       _config->FindB("APT::Get::List-Cleanup",true) == true)
     {
        if (Fetcher.Clean(_config->FindDir("Dir::State::lists")) == false ||
          Fetcher.Clean(_config->FindDir("Dir::State::lists") + "partial/") == false)
     if (Cache.BuildCaches() == false)
        return false;
     
 -   if (Failed == true)
 +   if (TransientNetworkFailure == true)
 +      _error->Warning(_("Some index files failed to download, they have been ignored, or old ones used instead."));
 +   else if (Failed == true)
        return _error->Error(_("Some index files failed to download, they have been ignored, or old ones used instead."));
 -   
 +
     return true;
  }
                                                                        /*}}}*/
 +// DoAutomaticRemove - Remove all automatic unused packages           /*{{{*/
 +// ---------------------------------------------------------------------
 +/* Remove unused automatic packages */
 +bool DoAutomaticRemove(CacheFile &Cache)
 +{
 +   bool Debug = _config->FindI("Debug::pkgAutoRemove",false);
 +   bool doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false);
 +   bool hideAutoRemove = _config->FindB("APT::Get::HideAutoRemove");
 +   pkgDepCache::ActionGroup group(*Cache);
 +
 +   if(Debug)
 +      std::cout << "DoAutomaticRemove()" << std::endl;
 +
 +   if (_config->FindB("APT::Get::Remove",true) == false &&
 +       doAutoRemove == true)
 +   {
 +      c1out << _("We are not supposed to delete stuff, can't start "
 +               "AutoRemover") << std::endl;
 +      doAutoRemove = false;
 +   }
 +
 +   string autoremovelist, autoremoveversions;
 +   // look over the cache to see what can be removed
 +   for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg)
 +   {
 +      if (Cache[Pkg].Garbage)
 +      {
 +       if(Pkg.CurrentVer() != 0 || Cache[Pkg].Install())
 +          if(Debug)
 +             std::cout << "We could delete %s" <<  Pkg.Name() << std::endl;
 +        
 +       // only show stuff in the list that is not yet marked for removal
 +       if(Cache[Pkg].Delete() == false) 
 +       {
 +          autoremovelist += string(Pkg.Name()) + " ";
 +          autoremoveversions += string(Cache[Pkg].CandVersion) + "\n";
 +       }
 +       if (doAutoRemove)
 +       {
 +          if(Pkg.CurrentVer() != 0 && 
 +             Pkg->CurrentState != pkgCache::State::ConfigFiles)
 +             Cache->MarkDelete(Pkg, _config->FindB("APT::Get::Purge", false));
 +          else
 +             Cache->MarkKeep(Pkg, false, false);
 +       }
 +      }
 +   }
 +   if (!hideAutoRemove) 
 +      ShowList(c1out, _("The following packages were automatically installed and are no longer required:"), autoremovelist, autoremoveversions);
 +   if (!doAutoRemove && !hideAutoRemove && autoremovelist.size() > 0)
 +      c1out << _("Use 'apt-get autoremove' to remove them.") << std::endl;
 +
 +   // Now see if we destroyed anything
 +   if (Cache->BrokenCount() != 0)
 +   {
 +      c1out << _("Hmm, seems like the AutoRemover destroyed something which really\n"
 +               "shouldn't happen. Please file a bug report against apt.") << endl;
 +      c1out << endl;
 +      c1out << _("The following information may help to resolve the situation:") << endl;
 +      c1out << endl;
 +      ShowBroken(c1out,Cache,false);
 +
 +      return _error->Error(_("Internal Error, AutoRemover broke stuff"));
 +   }
 +   return true;
 +}
 +
  // DoUpgrade - Upgrade all packages                                   /*{{{*/
  // ---------------------------------------------------------------------
  /* Upgrade all packages without installing new packages or erasing old
@@@ -1501,51 -1406,6 +1501,51 @@@ bool DoUpgrade(CommandLine &CmdL
     return InstallPackages(Cache,true);
  }
                                                                        /*}}}*/
 +// DoInstallTask - Install task from the command line                 /*{{{*/
 +// ---------------------------------------------------------------------
 +/* Install named task */
 +bool TryInstallTask(pkgDepCache &Cache, pkgProblemResolver &Fix, 
 +                  bool BrokenFix,
 +                  unsigned int& ExpectedInst, 
 +                  const char *taskname)
 +{
 +   const char *start, *end;
 +   pkgCache::PkgIterator Pkg;
 +   char buf[64*1024];
 +   regex_t Pattern;
 +
 +   // get the records
 +   pkgRecords Recs(Cache);
 +
 +   // build regexp for the task
 +   char S[300];
 +   snprintf(S, sizeof(S), "^Task:.*[^a-z]%s[^a-z].*\n", taskname);
 +   regcomp(&Pattern,S, REG_EXTENDED | REG_NOSUB | REG_NEWLINE);
 +   
 +   bool found = false;
 +   bool res = 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,false,BrokenFix,ExpectedInst);
 +      found = true;
 +   }
 +   
 +   if(!found)
 +      _error->Error(_("Couldn't find task %s"),taskname);
 +
 +   regfree(&Pattern);
 +   return res;
 +}
 +
  // DoInstall - Install packages from the command line                 /*{{{*/
  // ---------------------------------------------------------------------
  /* Install named packages */
@@@ -1561,7 -1421,6 +1561,7 @@@ bool DoInstall(CommandLine &CmdL
     if (Cache->BrokenCount() != 0)
        BrokenFix = true;
     
 +   unsigned int AutoMarkChanged = 0;
     unsigned int ExpectedInst = 0;
     unsigned int Packages = 0;
     pkgProblemResolver Fix(Cache);
     bool DefRemove = false;
     if (strcasecmp(CmdL.FileList[0],"remove") == 0)
        DefRemove = true;
 -   for (const char **I = CmdL.FileList + 1; *I != 0; I++)
+    else if (strcasecmp(CmdL.FileList[0], "purge") == 0)
+    {
+       _config->Set("APT::Get::Purge", true);
+       DefRemove = true;
+    }
 +   else if (strcasecmp(CmdL.FileList[0], "autoremove") == 0)
     {
 -      // Duplicate the string
 -      unsigned int Length = strlen(*I);
 -      char S[300];
 -      if (Length >= sizeof(S))
 -       continue;
 -      strcpy(S,*I);
 -      
 -      // See if we are removing and special indicators..
 -      bool Remove = DefRemove;
 -      char *VerTag = 0;
 -      bool VerIsRel = false;
 -      while (Cache->FindPkg(S).end() == true)
 +      _config->Set("APT::Get::AutomaticRemove", "true");
 +      DefRemove = true;
 +   }
 +   // new scope for the ActionGroup
 +   {
 +      pkgDepCache::ActionGroup group(Cache);
 +      for (const char **I = CmdL.FileList + 1; *I != 0; I++)
        {
 -       // Handle an optional end tag indicating what to do
 -       if (Length >= 1 && S[Length - 1] == '-')
 -       {
 -          Remove = true;
 -          S[--Length] = 0;
 +       // Duplicate the string
 +       unsigned int Length = strlen(*I);
 +       char S[300];
 +       if (Length >= sizeof(S))
            continue;
 -       }
 -       
 -       if (Length >= 1 && S[Length - 1] == '+')
 +       strcpy(S,*I);
 +      
 +       // See if we are removing and special indicators..
 +       bool Remove = DefRemove;
 +       char *VerTag = 0;
 +       bool VerIsRel = false;
 +       while (Cache->FindPkg(S).end() == true)
         {
 -          Remove = false;
 -          S[--Length] = 0;
 -          continue;
 -       }
 +          // Handle an optional end tag indicating what to do
 +          if (Length >= 1 && S[Length - 1] == '-')
 +          {
 +             Remove = true;
 +             S[--Length] = 0;
 +             continue;
 +          }
         
 -       char *Slash = strchr(S,'=');
 -       if (Slash != 0)
 -       {
 -          VerIsRel = false;
 -          *Slash = 0;
 -          VerTag = Slash + 1;
 -       }
 +          if (Length >= 1 && S[Length - 1] == '+')
 +          {
 +             Remove = false;
 +             S[--Length] = 0;
 +             continue;
 +          }
         
 -       Slash = strchr(S,'/');
 -       if (Slash != 0)
 -       {
 -          VerIsRel = true;
 -          *Slash = 0;
 -          VerTag = Slash + 1;
 -       }
 +          char *Slash = strchr(S,'=');
 +          if (Slash != 0)
 +          {
 +             VerIsRel = false;
 +             *Slash = 0;
 +             VerTag = Slash + 1;
 +          }
         
 -       break;
 -      }
 +          Slash = strchr(S,'/');
 +          if (Slash != 0)
 +          {
 +             VerIsRel = true;
 +             *Slash = 0;
 +             VerTag = Slash + 1;
 +          }
 +       
 +          break;
 +       }
        
 -      // Locate the package
 -      pkgCache::PkgIterator Pkg = Cache->FindPkg(S);
 -      Packages++;
 -      if (Pkg.end() == true)
 -      {
 -       // Check if the name is a regex
 -       const char *I;
 -       for (I = S; *I != 0; I++)
 -          if (*I == '?' || *I == '*' || *I == '|' ||
 -              *I == '[' || *I == '^' || *I == '$')
 -             break;
 -       if (*I == 0)
 -          return _error->Error(_("Couldn't find package %s"),S);
 +       // Locate the package
 +       pkgCache::PkgIterator Pkg = Cache->FindPkg(S);
 +       Packages++;
 +       if (Pkg.end() == true)
 +       {
 +          // Check if the name is a regex
 +          const char *I;
 +          for (I = S; *I != 0; I++)
 +             if (*I == '?' || *I == '*' || *I == '|' ||
 +                 *I == '[' || *I == '^' || *I == '$')
 +                break;
 +          if (*I == 0)
 +             return _error->Error(_("Couldn't find package %s"),S);
  
 -       // Regexs must always be confirmed
 -       ExpectedInst += 1000;
 +          // Regexs must always be confirmed
 +          ExpectedInst += 1000;
         
 -       // Compile the regex pattern
 -       regex_t Pattern;
 -       int Res;
 -       if ((Res = regcomp(&Pattern,S,REG_EXTENDED | REG_ICASE |
 -                   REG_NOSUB)) != 0)
 -       {
 -          char Error[300];        
 -          regerror(Res,&Pattern,Error,sizeof(Error));
 -          return _error->Error(_("Regex compilation error - %s"),Error);
 -       }
 +          // Compile the regex pattern
 +          regex_t Pattern;
 +          int Res;
 +          if ((Res = regcomp(&Pattern,S,REG_EXTENDED | REG_ICASE |
 +                             REG_NOSUB)) != 0)
 +          {
 +             char Error[300];     
 +             regerror(Res,&Pattern,Error,sizeof(Error));
 +             return _error->Error(_("Regex compilation error - %s"),Error);
 +          }
         
 -       // Run over the matches
 -       bool Hit = false;
 -       for (Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
 -       {
 -          if (regexec(&Pattern,Pkg.Name(),0,0,0) != 0)
 -             continue;
 +          // Run over the matches
 +          bool Hit = false;
 +          for (Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
 +          {
 +             if (regexec(&Pattern,Pkg.Name(),0,0,0) != 0)
 +                continue;
            
 -          ioprintf(c1out,_("Note, selecting %s for regex '%s'\n"),
 -                   Pkg.Name(),S);
 +             ioprintf(c1out,_("Note, selecting %s for regex '%s'\n"),
 +                      Pkg.Name(),S);
            
 +             if (VerTag != 0)
 +                if (TryToChangeVer(Pkg,Cache,VerTag,VerIsRel) == false)
 +                   return false;
 +          
 +             Hit |= TryToInstall(Pkg,Cache,Fix,Remove,BrokenFix,
 +                                 ExpectedInst,false);
 +          }
 +          regfree(&Pattern);
 +       
 +          if (Hit == false)
 +             return _error->Error(_("Couldn't find package %s"),S);
 +       }
 +       else
 +       {
            if (VerTag != 0)
               if (TryToChangeVer(Pkg,Cache,VerTag,VerIsRel) == false)
                  return false;
 -          
 -          Hit |= TryToInstall(Pkg,Cache,Fix,Remove,BrokenFix,
 -                              ExpectedInst,false);
 -       }
 -       regfree(&Pattern);
 -       
 -       if (Hit == false)
 -          return _error->Error(_("Couldn't find package %s"),S);
 -      }
 -      else
 -      {
 -       if (VerTag != 0)
 -          if (TryToChangeVer(Pkg,Cache,VerTag,VerIsRel) == false)
 +          if (TryToInstall(Pkg,Cache,Fix,Remove,BrokenFix,ExpectedInst) == false)
               return false;
 -       if (TryToInstall(Pkg,Cache,Fix,Remove,BrokenFix,ExpectedInst) == false)
 -          return false;
 -      }      
 -   }
  
 -   /* If we are in the Broken fixing mode we do not attempt to fix the
 -      problems. This is if the user invoked install without -f and gave
 -      packages */
 -   if (BrokenFix == true && Cache->BrokenCount() != 0)
 -   {
 -      c1out << _("You might want to run `apt-get -f install' to correct these:") << endl;
 -      ShowBroken(c1out,Cache,false);
 +          // see if we need to fix the auto-mark flag 
 +          // e.g. apt-get install foo 
 +          // where foo is marked automatic
 +          if(!Remove && 
 +             Cache[Pkg].Install() == false && 
 +             (Cache[Pkg].Flags & pkgCache::Flag::Auto))
 +          {
 +             ioprintf(c1out,_("%s set to manual installed.\n"),
 +                      Pkg.Name());
 +             Cache->MarkAuto(Pkg,false);
 +             AutoMarkChanged++;
 +          }
 +       }      
 +      }
  
 -      return _error->Error(_("Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution)."));
 -   }
 +      /* If we are in the Broken fixing mode we do not attempt to fix the
 +       problems. This is if the user invoked install without -f and gave
 +       packages */
 +      if (BrokenFix == true && Cache->BrokenCount() != 0)
 +      {
 +       c1out << _("You might want to run `apt-get -f install' to correct these:") << endl;
 +       ShowBroken(c1out,Cache,false);
 +
 +       return _error->Error(_("Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution)."));
 +      }
     
 -   // Call the scored problem resolver
 -   Fix.InstallProtect();
 -   if (Fix.Resolve(true) == false)
 -      _error->Discard();
 +      // Call the scored problem resolver
 +      Fix.InstallProtect();
 +      if (Fix.Resolve(true) == false)
 +       _error->Discard();
  
 -   // Now we check the state of the packages,
 -   if (Cache->BrokenCount() != 0)
 -   {
 -      c1out << 
 -       _("Some packages could not be installed. This may mean that you have\n" 
 -       "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)
 +      // Now we check the state of the packages,
 +      if (Cache->BrokenCount() != 0)
        {
 -       c1out << endl;
         c1out << 
 -        _("Since you only requested a single operation it is extremely likely that\n"
 -          "the package is simply not installable and a bug report against\n" 
 -          "that package should be filed.") << endl;
 -      }
 +          _("Some packages could not be installed. This may mean that you have\n" 
 +            "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;
 +          c1out << 
 +             _("Since you only requested a single operation it is extremely likely that\n"
 +               "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;
 +       ShowBroken(c1out,Cache,false);
 +       return _error->Error(_("Broken packages"));
 +      }   
 +   }
 +   if (_config->FindB("APT::Get::AutomaticRemove")) {
 +      if (!DoAutomaticRemove(Cache)) 
 +       return false;
 +   }
  
 -      c1out << _("The following information may help to resolve the situation:") << endl;
 -      c1out << endl;
 -      ShowBroken(c1out,Cache,false);
 -      return _error->Error(_("Broken packages"));
 -   }   
 -   
     /* Print out a list of packages that are going to be installed extra
        to what the user asked */
     if (Cache->InstCount() != ExpectedInst)
         
         if (*J == 0) {
            List += string(I.Name()) + " ";
 -        VersionsList += string(Cache[I].CandVersion) + "\n";
 -     }
 +          VersionsList += string(Cache[I].CandVersion) + "\n";
 +       }
        }
        
        ShowList(c1out,_("The following extra packages will be installed:"),List,VersionsList);
  
     }
  
 +   // if nothing changed in the cache, but only the automark information
 +   // we write the StateFile here, otherwise it will be written in 
 +   // cache.commit()
 +   if (AutoMarkChanged > 0 &&
 +       Cache->DelCount() == 0 && Cache->InstCount() == 0 &&
 +       Cache->BadCount() == 0)
 +      Cache->writeStateFile(NULL);
 +
     // See if we need to prompt
     if (Cache->InstCount() == ExpectedInst && Cache->DelCount() == 0)
        return InstallPackages(Cache,false,false);
@@@ -1907,8 -1736,6 +1911,8 @@@ bool DoDSelectUpgrade(CommandLine &CmdL
     if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
        return false;
     
 +   pkgDepCache::ActionGroup group(Cache);
 +
     // Install everything with the install flag set
     pkgCache::PkgIterator I = Cache->PkgBegin();
     for (;I.end() != true; I++)
@@@ -2620,6 -2447,7 +2624,7 @@@ bool ShowHelp(CommandLine &CmdL
        "   upgrade - Perform an upgrade\n"
        "   install - Install new packages (pkg is libc6 not libc6.deb)\n"
        "   remove - Remove packages\n"
+       "   purge - Remove and purge packages\n"
        "   source - Download source archives\n"
        "   build-dep - Configure build-dependencies for source packages\n"
        "   dist-upgrade - Distribution upgrade, see apt-get(8)\n"
@@@ -2661,7 -2489,6 +2666,7 @@@ void GetInitialize(
     _config->Set("APT::Get::Fix-Broken",false);
     _config->Set("APT::Get::Force-Yes",false);
     _config->Set("APT::Get::List-Cleanup",true);
 +   _config->Set("APT::Get::AutomaticRemove",false);
  }
                                                                        /*}}}*/
  // SigWinch - Window size change signal handler                               /*{{{*/
@@@ -2717,10 -2544,7 +2722,10 @@@ int main(int argc,const char *argv[]
        {0,"remove","APT::Get::Remove",0},
        {0,"only-source","APT::Get::Only-Source",0},
        {0,"arch-only","APT::Get::Arch-Only",0},
 +      {0,"auto-remove","APT::Get::AutomaticRemove",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},
        {'c',"config-file",0,CommandLine::ConfigFile},
        {'o',"option",0,CommandLine::ArbItem},
        {0,0,0,0}};
                                     {"upgrade",&DoUpgrade},
                                     {"install",&DoInstall},
                                     {"remove",&DoInstall},
 +                                 {"autoremove",&DoInstall},
                                     {"dist-upgrade",&DoDistUpgrade},
                                     {"dselect-upgrade",&DoDSelectUpgrade},
                                   {"build-dep",&DoBuildDep},
diff --combined debian/apt.cron.daily
index b4cbf1c8a901010d5c51c9d2e0a7a6e0e7c6fe93,4d6bf5842f0394aab8747a069694b1a9b4a81b9c..778e3cefefb9da48091f95aae9d6db9e91b18b83
  #  "APT::Periodic::AutocleanInterval"
  #  - Do "apt-get autoclean" every n-days (0=disable)
  #
 +#  "APT::Periodic::Unattended-Upgrade"
 +#  - Run the "unattended-upgrade" security upgrade script 
 +#    every n-days (0=disabled)
 +#    Requires the package "unattended-upgrades" and will write
 +#    a log in /var/log/unattended-upgrades
 +# 
  #  "APT::Archives::MaxAge",
  #  - Set maximum allowed age of a cache package file. If a cache 
  #    package file is older it is deleted (0=disable)
@@@ -152,12 -146,8 +152,12 @@@ UpdateInterval=
  DownloadUpgradeableInterval=0
  eval $(apt-config shell UpdateInterval APT::Periodic::Update-Package-Lists DownloadUpgradeableInterval APT::Periodic::Download-Upgradeable-Packages)
  AutocleanInterval=$DownloadUpgradeableInterval
- eval $(apt-config shell AutocleanInterval APT::Periodic::Autoclean)
+ eval $(apt-config shell AutocleanInterval APT::Periodic::AutocleanInterval)
  
 +UnattendedUpgradeInterval=0
 +eval $(apt-config shell UnattendedUpgradeInterval APT::Periodic::Unattended-Upgrade)
 +
 +
  # laptop check, on_ac_power returns:
  #       0 (true)    System is on mains power
  #       1 (false)   System is not on mains power
@@@ -192,11 -182,5 +192,11 @@@ if check_stamp $AUTOCLEAN_STAMP $Autocl
      update_stamp $AUTOCLEAN_STAMP
  fi
  
 +UPGRADE_STAMP=/var/lib/apt/periodic/upgrade-stamp
 +if check_stamp $UPGRADE_STAMP $UnattendedUpgradeInterval; then
 +    unattended-upgrade
 +    update_stamp $UPGRADE_STAMP
 +fi
 +
  # check cache size 
  check_size_constraints
diff --combined debian/changelog
index a57cf4577cf2bad37bb821cac0f0698e9bf2cd25,2dc11190dbf3dc2593bb599d6caa99dbfddef8f8..2504df8ce204d35dfe5840e2d97ce13f75c436d2
@@@ -1,33 -1,5 +1,37 @@@
 -apt (0.6.47) UNRELEASED; urgency=low
 +apt (0.7.2) unstable; urgency=low
 +  
 +  * merged the debian/experimental changes back
 +    into the debian/sid branch
 +  * merged from Christian Perrier:
 +    * mr.po: New Marathi translation  Closes: #416806
 +    * zh_CN.po: Updated by Eric Pareja  Closes: #416822
 +    * tl.po: Updated by Eric Pareja   Closes: #416638
 +    * gl.po: Updated by Jacobo Tarrio
 +           Closes: #412828
 +    * da.po: Updated by Claus Hindsgaul
 +           Closes: #409483
 +    * fr.po: Remove a non-breakable space for usability
 +           issues. Closes: #408877
 +    * ru.po: Updated Russian translation. Closes: #405476
 +    * *.po: Unfuzzy after upstream typo corrections
 +  * buildlib/archtable:
 +    - added support for sh3/sh4 (closes: #424870)
 +    - added support for m32r (closes: #394096)
 +  * buildlib/systemtable:
 +    - added support for lpia
 +  * configure.in:
 +    - check systemtable for architecture mapping too
++  * fix error in AutocleanInterval, closes: #319339
++    (thanks to Israel G. Lugo for the patch)
++  * add "purge" commandline argument, closes: #133421)
++    (thanks to Julien Danjou for the patch)
 +  
 + -- Michael Vogt <mvo@debian.org>  Wed, 06 Jun 2007 23:19:50 +0200
 +
 +apt (0.7.1) experimental; urgency=low
  
 +  * ABI library name change because its build against
 +    new glibc
    * implement SourceVer() in pkgRecords 
       (thanks to Daniel Burrows for the patch!)
    * apt-pkg/algorithm.cc:
@@@ -48,7 -20,7 +52,7 @@@
      - fix error translation that causes trouble to lsb_release
    * apt-pkg/acquire-item.cc:
      - if decompression of a index fails, delete the index 
 -  * [ABI] apt-pkg/acquire.{cc,h}:
 +  * apt-pkg/acquire.{cc,h}:
      - deal better with duplicated sources.list entries (avoid
        double queuing of  URLs) - this fixes hangs in bzip/gzip
    * merged from Christian Perrier:
        complete translations
    * apt-pkg/policy.cc:
      - allow multiple packages (thanks to David Foerster)
 -  * buildlib/archtable:
 -    - added support for sh3/sh4 (closes: #424870)
 -    - added support for m32r (closes: #394096)
 -  * buildlib/systemtable:
 -    - added support for lpia
 -  * configure.in:
 -    - check systemtable for architecture mapping too
 -  * fix error in AutocleanInterval, closes: #319339
 -    (thanks to Israel G. Lugo for the patch)
 -  * add "purge" commandline argument, closes: #133421)
 -    (thanks to Julien Danjou for the patch)
 -  
 - -- Michael Vogt <michael.vogt@ubuntu.com>  Mon, 18 Dec 2006 19:39:05 +0100
 +
 + -- Michael Vogt <mvo@debian.org>  Wed,  2 May 2007 13:43:44 +0200
 +
 +apt (0.7.0) experimental; urgency=low
 +
 +  * Package that contains tall the new features
 +  * Removed all #pragma interface/implementation
 +  * Branch that contains tall the new features:
 +  * translated package descriptions
 +  * task install support
 +  * automatic dependency removal (thanks to Daniel Burrows)
 +  * merged support for the new dpkg "Breaks" field 
 +    (thanks to Ian Jackson)
 +  * handle network failures more gracefully on "update"
 +  * support for unattended-upgrades (via unattended-upgrades
 +    package)
 +  * added apt-transport-https method
 +
 + -- Michael Vogt <mvo@debian.org>  Fri, 12 Jan 2007 20:48:07 +0100
  
  apt (0.6.46.4-0.1) unstable; urgency=emergency
    
@@@ -144,53 -110,40 +148,53 @@@ apt (0.6.46.3) unstable; urgency=lo
        messages 
  
    * Merged from Christian Perrier bzr branch:
 -     - ca.po: Updated to 514t
 -     - be.po: Updated to 514t
 -     - it.po: Updated to 514t
 -     - hu.po: Updated to 514t
 -     - zh_TW.po: Updated to 514t
 -     - ar.po: Updated to 293t221u.
 -     - ru.po: Updated to 514t. Closes: #392466
 -     - nb.po: Updated to 514t. Closes: #392466
 -     - pt.po: Updated to 514t. Closes: #393199
 -     - fr.po: One spelling error corrected: s/accèder/accéder
 -     - km.po: Updated to 514t.
 -     - ko.po: Updated to 514t.
 -     - bg.po: Updated to 514t.
 -     - de.po: Updated to 514t.
 -     - en_GB.po: Updated to 514t.
 -
 - -- Michael Vogt <mvo@debian.org>  Thu, 2 Nov 2006 11:37:58 +0100 
 +    - ca.po: Updated to 514t
 +    - be.po: Updated to 514t
 +    - it.po: Updated to 514t
 +    - hu.po: Updated to 514t
 +    - zh_TW.po: Updated to 514t
 +    - ar.po: Updated to 293t221u.
 +    - ru.po: Updated to 514t. Closes: #392466
 +    - nb.po: Updated to 514t. Closes: #392466
 +    - pt.po: Updated to 514t. Closes: #393199
 +    - fr.po: One spelling error corrected: s/accèder/accéder
 +    - km.po: Updated to 514t.
 +    - ko.po: Updated to 514t.
 +    - bg.po: Updated to 514t.
 +    - de.po: Updated to 514t.
 +    - en_GB.po: Updated to 514t.
 +
 + -- Michael Vogt <mvo@debian.org>  Thu,  2 Nov 2006 11:37:58 +0100
  
  apt (0.6.46.2) unstable; urgency=low
  
 +  * debian/control:
 +    - depend on debian-archive-keyring to offer clean upgrade path 
 +      (closes: #386800)
    * Merged from Christian Perrier bzr branch:
      - es.po: Updated to 514t. Closes: #391661
      - da.po: Updated to 514t. Closes: #391424
      - cs.po: Updated. Closes: #391064
      - es.po: Updated to 514t. Closes: #391661
      - da.po: Updated to 514t. Closes: #391424
 -  
 +
   -- Michael Vogt <mvo@debian.org>  Wed, 11 Oct 2006 09:03:15 +0200
  
  apt (0.6.46.1) unstable; urgency=low
  
 +  * merged "install-recommends" branch (ABI break): 
 +    - new "--install-recommends"
 +    - install new recommends on "upgrade" if --install-recommends is 
 +      given
 +    - new "--fix-policy" option to install all packages with unmet
 +      important dependencies (usefull with --install-recommends to
 +      see what not-installed recommends are on the system)
 +    - fix of recommended packages display (only show CandidateVersion
 +      fix or-group handling)
 +  * merged "install-task" branch (use with "apt-get install taskname^")
    * methods/gzip.cc:
      - deal with empty files 
 -  * Applied patch from Daniel Schepler to make apt bin-NMU able.  
 +  * Applied patch from Daniel Schepler to make apt bin-NMU able.
      (closes: bug#359634)
    * rebuild against current g++ because of:
      http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29289
@@@ -278,42 -231,26 +282,42 @@@ apt (0.6.45) unstable; urgency=lo
      * dz.po: New Dzongkha translation: 512t
      * ro.po: Updated to 512t
      * eu.po: Updated
 +    * eu.po: Updated
 +  * fix apt-get dist-upgrade
 +  * fix warning if no /var/lib/apt/extended_states is present
 +  * don't download Translations for deb-src sources.list lines
 +  * apt-pkg/tagfile.cc:
 +    - support not-mmapable files again
  
 - -- Michael Vogt <mvo@debian.org>  Thu, 27 Jul 2006 00:52:05 +0200
 + -- Michael Vogt <michael.vogt@ubuntu.com>  Tue, 25 Jul 2006 11:55:22 +0200
  
 -apt  (0.6.44.2) unstable; urgency=low 
 -  
 -   * apt-pkg/depcache.cc:
 -     - added Debug::pkgDepCache::AutoInstall (thanks to infinity)
 -   * apt-pkg/acquire-item.cc:
 -     - fix missing chmod() in the new aquire code
 -       (thanks to Bastian Blank, Closes: #367425)
 -   * merged from
 -     http://www.perrier.eu.org/debian/packages/d-i/level4/apt-main:
 -     * sk.po: Completed to 512t
 -     * eu.po: Completed to 512t
 -     * fr.po: Completed to 512t
 -     * sv.po: Completed to 512t
 -     * Update all PO and the POT. Gives 506t6f for formerly
 -       complete translations
 -
 - -- Michael Vogt <mvo@debian.org>  Wed, 14 Jun 2006 12:00:57 +0200 
 +apt (0.6.44.2exp1) experimental; urgency=low
 +
 +  * added support for i18n of the package descriptions
 +  * added support for aptitude like auto-install tracking (a HUGE
 +    HUGE thanks to Daniel Burrows who made this possible) 
 +  * synced with the http://people.debian.org/~mvo/bzr/apt/debian-sid branch
 +  * build from http://people.debian.org/~mvo/bzr/apt/debian-experimental
 +
 + -- Michael Vogt <mvo@debian.org>  Mon,  3 Jul 2006 21:50:31 +0200
 +
 +apt (0.6.44.2) unstable; urgency=low
 +
 +  * apt-pkg/depcache.cc:
 +    - added Debug::pkgDepCache::AutoInstall (thanks to infinity)
 +  * apt-pkg/acquire-item.cc:
 +    - fix missing chmod() in the new aquire code 
 +      (thanks to Bastian Blank, Closes: #367425)
 +  * merged from 
 +    http://www.perrier.eu.org/debian/packages/d-i/level4/apt-main:
 +    * sk.po: Completed to 512t
 +    * eu.po: Completed to 512t
 +    * fr.po: Completed to 512t
 +    * sv.po: Completed to 512t
 +    * Update all PO and the POT. Gives 506t6f for formerly
 +      complete translations
 +
 + -- Michael Vogt <mvo@debian.org>  Wed, 14 Jun 2006 12:00:57 +0200
  
  apt (0.6.44.1-0.1) unstable; urgency=low
  
  
  apt (0.6.44.1) unstable; urgency=low
  
 +  * apt-pkg/acquire-item.cc:
 +    - fix reversed logic of the "Acquire::PDiffs" option
    * merged from 
      http://www.perrier.eu.org/debian/packages/d-i/level4/apt-main:
      - po/LINGUAS: added "bg" Closes: #360262
      - po/gl.po: Galician translation update. Closes: #366849
      - po/hu.po: Hungarian translation update. Closes: #365448
      - po/cs.po: Czech translation updated. Closes: #367244
 +  * apt-pkg/contrib/sha256.cc:
 +    - applied patch to fix unaligned access problem. Closes: #367417
 +      (thanks to David Mosberger)
  
   -- Michael Vogt <mvo@debian.org>  Tue, 16 May 2006 21:51:16 +0200
  
  apt (0.6.44) unstable; urgency=low
  
    * apt-pkg/acquire.cc: don't show ETA if it is 0 or absurdely large
 +  * apt-pkg/contrib/sha256.{cc,h},hashes.{cc,h}: support for sha256 
 +    (thanks to Anthony Towns)
 +  * ftparchive/cachedb.{cc,h},writer.{cc,h}: optimizations 
 +    (thanks to Anthony Towns)
 +  * apt pdiff support from experimental merged
 +  * apt-pkg/deb/dpkgpm.cc: wording fixes (thanks to Matt Zimmerman)
    * apt-pkg/deb/dpkgpm.cc: 
      - wording fixes (thanks to Matt Zimmerman)
 -    - fix error in dpkg interaction (closes: #364513, 
 -      thanks to Martin Dickopp)
 +    - fix error in dpkg interaction (closes: #364513, thanks to Martin Dickopp)
    * apt-pkg/tagfile.{cc,h}:
      - use MMap to read the entries (thanks to Zephaniah E. Hull for the
        patch) Closes: #350025
@@@ -545,7 -472,7 +549,7 @@@ apt (0.6.42) unstable; urgency=lo
    * cmdline/apt-cdrom.cc: 
      - fix some missing gettext() calls (closes: #334539)
    * doc/apt-cache.8.xml: fix typo (closes: #334714)
 -  
 +
   -- Michael Vogt <mvo@debian.org>  Wed, 19 Oct 2005 22:02:09 +0200
  
  apt (0.6.41) unstable; urgency=low
@@@ -645,7 -572,6 +649,7 @@@ apt (0.6.37) breezy; urgency=lo
    * Add Welsh translation from Dafydd Harries
      (daf@muse.19inch.net--2005/apt--main--0--patch-1)
    * Change debian/bugscript to use #!/bin/bash (Closes: #313402)
 +  * Fix a incorrect example in the man-page (closes: #282918)
  
   -- Matt Zimmerman <mdz@ubuntu.com>  Tue, 24 May 2005 14:38:25 -0700
  
diff --combined doc/apt-get.8.xml
index 3c245b83bc6092c92e8f0b018755f9fd3bc31fe9,0d080b8853b5600d969612fa7cabc57c70cdad0b..9d30a176c08eb6f0998860f91a64b432b05e557e
           <arg>dselect-upgrade</arg>
           <arg>install <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg>
           <arg>remove <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg>
+          <arg>purge <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg>
           <arg>source <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg>
           <arg>build-dep <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg>
           <arg>check</arg>
           <arg>clean</arg>
           <arg>autoclean</arg>
 +         <arg>autoremove</arg>
        </group>   
     </cmdsynopsis>
   </refsynopsisdiv>
       installed instead of removed.</para></listitem>
       </varlistentry>
  
+      <varlistentry><term>purge</term>
+      <listitem><para><literal>purge</literal> is identical to <literal>remove</literal> except that packages are 
+      removed and purged.</para></listitem>
+      </varlistentry>
       <varlistentry><term>source</term>
       <listitem><para><literal>source</literal> causes <command>apt-get</command> to fetch source packages. APT 
       will examine the available packages to decide which source package to 
       <literal>APT::Clean-Installed</literal> will prevent installed packages from being
       erased if it is set to off.</para></listitem>
       </varlistentry>
 +
 +     <varlistentry><term>autoremove</term>
 +     <listitem><para><literal>autoremove</literal> is used to remove packages that were automatically
 +     installed to satisfy dependencies for some package and that are no more needed.</para></listitem>
 +     </varlistentry>
     </variablelist>
   </refsect1>
   
       Configuration Item: <literal>APT::Get::Remove</literal>.</para></listitem>
       </varlistentry>
  
 +     <varlistentry><term><option>--auto-remove</option></term>
 +     <listitem><para>If the command is either <literal>install</literal> or <literal>remove</literal>,
 +     then this option acts like running <literal>autoremove</literal> command, removing the unused
 +     dependency packages. Configuration Item: <literal>APT::Get::AutomaticRemove</literal>.
 +     </para></listitem>
 +     </varlistentry>
 +
       <varlistentry><term><option>--only-source</option></term>
       <listitem><para>Only has meaning for the
       <literal>source</literal> and <literal>build-dep</literal>