Преглед изворни кода

merged from david, many thanks

Michael Vogt пре 17 година
родитељ
комит
f7d6459db6

+ 1 - 0
.bzrignore

@@ -22,6 +22,7 @@ doc/*/apt.ent
 # older translation methods translate in this files
 # so we can not ignore it for all translations now
 doc/ja/*.xml
+doc/fr/*.xml
 
 # FIXME: files generated by deprecated sgml man pages
 doc/es/manpage.links

+ 34 - 22
apt-pkg/aptconfiguration.cc

@@ -14,6 +14,7 @@
 
 #include <vector>
 #include <string>
+#include <algorithm>
 									/*}}}*/
 namespace APT {
 // getCompressionTypes - Return Vector of usbale compressiontypes	/*{{{*/
@@ -29,41 +30,52 @@ const Configuration::getCompressionTypes(bool const &Cached) {
 			types.clear();
 	}
 
+	// setup the defaults for the compressiontypes => method mapping
+	_config->CndSet("Acquire::CompressionTypes::bz2","bzip2");
+	_config->CndSet("Acquire::CompressionTypes::lzma","lzma");
+	_config->CndSet("Acquire::CompressionTypes::gz","gzip");
+
 	// Set default application paths to check for optional compression types
 	_config->CndSet("Dir::Bin::lzma", "/usr/bin/lzma");
 	_config->CndSet("Dir::Bin::bzip2", "/bin/bzip2");
 
-	::Configuration::Item const *Opts = _config->Tree("Acquire::CompressionTypes");
-	if (Opts != 0)
-		Opts = Opts->Child;
+	// accept non-list order as override setting for config settings on commandline
+	std::string const overrideOrder = _config->Find("Acquire::CompressionTypes::Order","");
+	if (overrideOrder.empty() == false)
+		types.push_back(overrideOrder);
 
-	// at first, move over the options to setup at least the default options
-	bool foundLzma=false, foundBzip2=false, foundGzip=false;
-	for (; Opts != 0; Opts = Opts->Next) {
-		if (Opts->Value == "lzma")
-			foundLzma = true;
-		else if (Opts->Value == "bz2")
-			foundBzip2 = true;
-		else if (Opts->Value == "gz")
-			foundGzip = true;
+	// load the order setting into our vector
+	std::vector<std::string> const order = _config->FindVector("Acquire::CompressionTypes::Order");
+	for (std::vector<std::string>::const_iterator o = order.begin();
+	     o != order.end(); o++) {
+		if ((*o).empty() == true)
+			continue;
+		// ignore types we have no method ready to use
+		if (_config->Exists(string("Acquire::CompressionTypes::").append(*o)) == false)
+			continue;
+		// ignore types we have no app ready to use
+		string const appsetting = string("Dir::Bin::").append(*o);
+		if (_config->Exists(appsetting) == true) {
+			std::string const app = _config->FindFile(appsetting.c_str(), "");
+			if (app.empty() == false && FileExists(app) == false)
+				continue;
+		}
+		types.push_back(*o);
 	}
 
-	// setup the defaults now
-	if (!foundBzip2)
-		_config->Set("Acquire::CompressionTypes::bz2","bzip2");
-	if (!foundLzma)
-		_config->Set("Acquire::CompressionTypes::lzma","lzma");
-	if (!foundGzip)
-		_config->Set("Acquire::CompressionTypes::gz","gzip");
-
-	// move again over the option tree to finially calculate our result
+	// move again over the option tree to add all missing compression types
 	::Configuration::Item const *Types = _config->Tree("Acquire::CompressionTypes");
 	if (Types != 0)
 		Types = Types->Child;
 
 	for (; Types != 0; Types = Types->Next) {
+		if (Types->Tag == "Order" || Types->Tag.empty() == true)
+			continue;
+		// ignore types we already have in the vector
+		if (std::find(types.begin(),types.end(),Types->Tag) != types.end())
+			continue;
+		// ignore types we have no app ready to use
 		string const appsetting = string("Dir::Bin::").append(Types->Value);
-		// ignore compression types we have no app ready to use
 		if (appsetting.empty() == false && _config->Exists(appsetting) == true) {
 			std::string const app = _config->FindFile(appsetting.c_str(), "");
 			if (app.empty() == false && FileExists(app) == false)

+ 24 - 3
apt-pkg/contrib/configuration.cc

@@ -223,6 +223,25 @@ string Configuration::FindDir(const char *Name,const char *Default) const
    return Res;
 }
 									/*}}}*/
+// Configuration::FindVector - Find a vector of values			/*{{{*/
+// ---------------------------------------------------------------------
+/* Returns a vector of config values under the given item */
+vector<string> Configuration::FindVector(const char *Name) const
+{
+   vector<string> Vec;
+   const Item *Top = Lookup(Name);
+   if (Top == NULL)
+      return Vec;
+
+   Item *I = Top->Child;
+   while(I != NULL)
+   {
+      Vec.push_back(I->Value);
+      I = I->Next;
+   }
+   return Vec;
+}
+									/*}}}*/
 // Configuration::FindI - Find an integer value				/*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -582,9 +601,11 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool AsSectional,
 	    InQuote = !InQuote;
 	 if (InQuote == true)
 	    continue;
-	 
-	 if ((*I == '/' && I + 1 != End && I[1] == '/') || *I == '#')
-         {
+
+	 if ((*I == '/' && I + 1 != End && I[1] == '/') ||
+	     (*I == '#' && strcmp(string(I,I+6).c_str(),"#clear") != 0 &&
+	      strcmp(string(I,I+8).c_str(),"#include") != 0))
+	 {
 	    End = I;
 	    break;
 	 }

+ 3 - 0
apt-pkg/contrib/configuration.h

@@ -31,6 +31,7 @@
 
 
 #include <string>
+#include <vector>
 #include <iostream>
 
 using std::string;
@@ -70,6 +71,8 @@ class Configuration
    string Find(const string Name,const char *Default = 0) const {return Find(Name.c_str(),Default);};
    string FindFile(const char *Name,const char *Default = 0) const;
    string FindDir(const char *Name,const char *Default = 0) const;
+   std::vector<string> FindVector(const string &Name) const;
+   std::vector<string> FindVector(const char *Name) const;
    int FindI(const char *Name,int Default = 0) const;
    int FindI(const string Name,int Default = 0) const {return FindI(Name.c_str(),Default);};
    bool FindB(const char *Name,bool Default = false) const;

+ 13 - 2
apt-pkg/contrib/strutl.cc

@@ -67,9 +67,20 @@ bool UTF8ToCodeset(const char *codeset, const string &orig, string *dest)
   outbuf = new char[insize+1];
   outptr = outbuf;
 
-  iconv(cd, &inptr, &insize, &outptr, &outsize);
-  *outptr = '\0';
+  while (insize != 0)
+  {
+     size_t const err = iconv(cd, &inptr, &insize, &outptr, &outsize);
+     if (err == (size_t)(-1))
+     {
+	insize--;
+	outsize++;
+	inptr++;
+	*outptr = '?';
+	outptr++;
+     }
+  }
 
+  *outptr = '\0';
   *dest = outbuf;
   delete[] outbuf;
   

+ 81 - 40
apt-pkg/deb/dpkgpm.cc

@@ -134,8 +134,14 @@ bool pkgDPkgPM::Configure(PkgIterator Pkg)
 {
    if (Pkg.end() == true)
       return false;
-   
-   List.push_back(Item(Item::Configure,Pkg));
+
+   List.push_back(Item(Item::Configure, Pkg));
+
+   // Use triggers for config calls if we configure "smart"
+   // as otherwise Pre-Depends will not be satisfied, see #526774
+   if (_config->FindB("DPkg::TriggersPending", false) == true)
+      List.push_back(Item(Item::TriggersPending, PkgIterator()));
+
    return true;
 }
 									/*}}}*/
@@ -190,6 +196,9 @@ bool pkgDPkgPM::SendV2Pkgs(FILE *F)
    // Write out the package actions in order.
    for (vector<Item>::iterator I = List.begin(); I != List.end(); I++)
    {
+      if(I->Pkg.end() == true)
+	 continue;
+
       pkgDepCache::StateCache &S = Cache[I->Pkg];
       
       fprintf(F,"%s ",I->Pkg.Name());
@@ -378,10 +387,11 @@ void pkgDPkgPM::DoTerminalPty(int master)
  */
 void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
 {
+   bool const Debug = _config->FindB("Debug::pkgDPkgProgressReporting",false);
    // the status we output
    ostringstream status;
 
-   if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true)
+   if (Debug == true)
       std::clog << "got from dpkg '" << line << "'" << std::endl;
 
 
@@ -396,6 +406,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
       'processing: install: pkg'
       'processing: configure: pkg'
       'processing: remove: pkg'
+      'processing: purge: pkg' - but for apt is it a ignored "unknown" action
       'processing: trigproc: trigger'
 	    
    */
@@ -408,28 +419,28 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
    TokSplitString(':', line, list, sizeof(list)/sizeof(list[0]));
    if( list[0] == NULL || list[1] == NULL || list[2] == NULL) 
    {
-      if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true)
+      if (Debug == true)
 	 std::clog << "ignoring line: not enough ':'" << std::endl;
       return;
    }
-   char *pkg = list[1];
-   char *action = _strstrip(list[2]);
+   const char* const pkg = list[1];
+   const char* action = _strstrip(list[2]);
 
    // 'processing' from dpkg looks like
    // 'processing: action: pkg'
    if(strncmp(list[0], "processing", strlen("processing")) == 0)
    {
       char s[200];
-      char *pkg_or_trigger = _strstrip(list[2]);
-      action =_strstrip( list[1]);
+      const char* const pkg_or_trigger = _strstrip(list[2]);
+      action = _strstrip( list[1]);
       const std::pair<const char *, const char *> * const iter =
 	std::find_if(PackageProcessingOpsBegin,
 		     PackageProcessingOpsEnd,
 		     MatchProcessingOp(action));
       if(iter == PackageProcessingOpsEnd)
       {
-	 if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true)
-	    std::clog << "ignoring unknwon action: " << action << std::endl;
+	 if (Debug == true)
+	    std::clog << "ignoring unknown action: " << action << std::endl;
 	 return;
       }
       snprintf(s, sizeof(s), _(iter->second), pkg_or_trigger);
@@ -440,7 +451,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
 	     << endl;
       if(OutStatusFd > 0)
 	 write(OutStatusFd, status.str().c_str(), status.str().size());
-      if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true)
+      if (Debug == true)
 	 std::clog << "send: '" << status.str() << "'" << endl;
       return;
    }
@@ -453,11 +464,11 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
 	     << endl;
       if(OutStatusFd > 0)
 	 write(OutStatusFd, status.str().c_str(), status.str().size());
-      if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true)
+      if (Debug == true)
 	 std::clog << "send: '" << status.str() << "'" << endl;
       return;
    }
-   if(strncmp(action,"conffile",strlen("conffile")) == 0)
+   else if(strncmp(action,"conffile",strlen("conffile")) == 0)
    {
       status << "pmconffile:" << list[1]
 	     << ":"  << (PackagesDone/float(PackagesTotal)*100.0) 
@@ -465,12 +476,12 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
 	     << endl;
       if(OutStatusFd > 0)
 	 write(OutStatusFd, status.str().c_str(), status.str().size());
-      if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true)
+      if (Debug == true)
 	 std::clog << "send: '" << status.str() << "'" << endl;
       return;
    }
 
-   vector<struct DpkgState> &states = PackageOps[pkg];
+   vector<struct DpkgState> const &states = PackageOps[pkg];
    const char *next_action = NULL;
    if(PackageOpsDone[pkg] < states.size())
       next_action = states[PackageOpsDone[pkg]].state;
@@ -493,15 +504,15 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
 	     << endl;
       if(OutStatusFd > 0)
 	 write(OutStatusFd, status.str().c_str(), status.str().size());
-      if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true)
+      if (Debug == true)
 	 std::clog << "send: '" << status.str() << "'" << endl;
    }
-   if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true) 
+   if (Debug == true) 
       std::clog << "(parsed from dpkg) pkg: " << pkg 
 		<< " action: " << action << endl;
 }
-
-// DPkgPM::DoDpkgStatusFd                                           	/*{{{*/
+									/*}}}*/
+// DPkgPM::DoDpkgStatusFd						/*{{{*/
 // ---------------------------------------------------------------------
 /*
  */
@@ -538,7 +549,7 @@ void pkgDPkgPM::DoDpkgStatusFd(int statusfd, int OutStatusFd)
    dpkgbuf_pos = dpkgbuf+dpkgbuf_pos-p;
 }
 									/*}}}*/
-
+// DPkgPM::OpenLog							/*{{{*/
 bool pkgDPkgPM::OpenLog()
 {
    string logdir = _config->FindDir("Dir::Log");
@@ -561,7 +572,8 @@ bool pkgDPkgPM::OpenLog()
    }
    return true;
 }
-
+									/*}}}*/
+// DPkg::CloseLog							/*{{{*/
 bool pkgDPkgPM::CloseLog()
 {
    if(term_out)
@@ -578,7 +590,7 @@ bool pkgDPkgPM::CloseLog()
    term_out = NULL;
    return true;
 }
-
+									/*}}}*/
 /*{{{*/
 // This implements a racy version of pselect for those architectures
 // that don't have a working implementation.
@@ -600,7 +612,6 @@ static int racy_pselect(int nfds, fd_set *readfds, fd_set *writefds,
    return retval;
 }
 /*}}}*/
-
 // DPkgPM::Go - Run the sequence					/*{{{*/
 // ---------------------------------------------------------------------
 /* This globs the operations and calls dpkg 
@@ -617,9 +628,9 @@ bool pkgDPkgPM::Go(int OutStatusFd)
    sigset_t sigmask;
    sigset_t original_sigmask;
 
-   unsigned int MaxArgs = _config->FindI("Dpkg::MaxArgs",8*1024);   
-   unsigned int MaxArgBytes = _config->FindI("Dpkg::MaxArgBytes",32*1024);
-   bool NoTriggers = _config->FindB("DPkg::NoTriggers",false);
+   unsigned int const MaxArgs = _config->FindI("Dpkg::MaxArgs",8*1024);
+   unsigned int const MaxArgBytes = _config->FindI("Dpkg::MaxArgBytes",32*1024);
+   bool const NoTriggers = _config->FindB("DPkg::NoTriggers", false);
 
    if (RunScripts("DPkg::Pre-Invoke") == false)
       return false;
@@ -627,6 +638,12 @@ bool pkgDPkgPM::Go(int OutStatusFd)
    if (RunScriptsWithPkgs("DPkg::Pre-Install-Pkgs") == false)
       return false;
 
+   // support subpressing of triggers processing for special
+   // cases like d-i that runs the triggers handling manually
+   bool const SmartConf = (_config->Find("PackageManager::Configure", "all") != "all");
+   if (_config->FindB("DPkg::ConfigurePending", SmartConf) == true)
+      List.push_back(Item(Item::ConfigurePending, PkgIterator()));
+
    // map the dpkg states to the operations that are performed
    // (this is sorted in the same way as Item::Ops)
    static const struct DpkgState DpkgStatesOpMap[][7] = {
@@ -662,16 +679,19 @@ bool pkgDPkgPM::Go(int OutStatusFd)
    // that will be [installed|configured|removed|purged] and add
    // them to the PackageOps map (the dpkg states it goes through)
    // and the PackageOpsTranslations (human readable strings)
-   for (vector<Item>::iterator I = List.begin(); I != List.end();I++)
+   for (vector<Item>::const_iterator I = List.begin(); I != List.end();I++)
    {
-      string name = (*I).Pkg.Name();
+      if((*I).Pkg.end() == true)
+	 continue;
+
+      string const name = (*I).Pkg.Name();
       PackageOpsDone[name] = 0;
       for(int i=0; (DpkgStatesOpMap[(*I).Op][i]).state != NULL;  i++) 
       {
 	 PackageOps[name].push_back(DpkgStatesOpMap[(*I).Op][i]);
 	 PackagesTotal++;
       }
-   }   
+   }
 
    stdin_is_dev_null = false;
 
@@ -679,9 +699,9 @@ bool pkgDPkgPM::Go(int OutStatusFd)
    OpenLog();
 
    // this loop is runs once per operation
-   for (vector<Item>::iterator I = List.begin(); I != List.end();)
+   for (vector<Item>::const_iterator I = List.begin(); I != List.end();)
    {
-      vector<Item>::iterator J = I;
+      vector<Item>::const_iterator J = I;
       for (; J != List.end() && J->Op == I->Op; J++)
 	 /* nothing */;
 
@@ -700,7 +720,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
       
       unsigned int n = 0;
       unsigned long Size = 0;
-      string Tmp = _config->Find("Dir::Bin::dpkg","dpkg");
+      string const Tmp = _config->Find("Dir::Bin::dpkg","dpkg");
       Args[n++] = Tmp.c_str();
       Size += strlen(Args[n-1]);
       
@@ -750,11 +770,23 @@ bool pkgDPkgPM::Go(int OutStatusFd)
 	 
 	 case Item::Configure:
 	 Args[n++] = "--configure";
-	 if (NoTriggers)
-	    Args[n++] = "--no-triggers";
 	 Size += strlen(Args[n-1]);
 	 break;
-	 
+
+	 case Item::ConfigurePending:
+	 Args[n++] = "--configure";
+	 Size += strlen(Args[n-1]);
+	 Args[n++] = "--pending";
+	 Size += strlen(Args[n-1]);
+	 break;
+
+	 case Item::TriggersPending:
+	 Args[n++] = "--triggers-only";
+	 Size += strlen(Args[n-1]);
+	 Args[n++] = "--pending";
+	 Size += strlen(Args[n-1]);
+	 break;
+
 	 case Item::Install:
 	 Args[n++] = "--unpack";
 	 Size += strlen(Args[n-1]);
@@ -762,7 +794,14 @@ bool pkgDPkgPM::Go(int OutStatusFd)
 	 Size += strlen(Args[n-1]);
 	 break;
       }
-      
+
+      if (NoTriggers == true && I->Op != Item::TriggersPending &&
+	  I->Op != Item::ConfigurePending)
+      {
+	 Args[n++] = "--no-triggers";
+	 Size += strlen(Args[n-1]);
+      }
+
       // Write in the file or package names
       if (I->Op == Item::Install)
       {
@@ -778,6 +817,8 @@ bool pkgDPkgPM::Go(int OutStatusFd)
       {
 	 for (;I != J && Size < MaxArgBytes; I++)
 	 {
+	    if((*I).Pkg.end() == true)
+	       continue;
 	    Args[n++] = I->Pkg.Name();
 	    Size += strlen(Args[n-1]);
 	 }	 
@@ -913,11 +954,9 @@ bool pkgDPkgPM::Go(int OutStatusFd)
       int Status = 0;
 
       // we read from dpkg here
-      int _dpkgin = fd[0];
+      int const _dpkgin = fd[0];
       close(fd[1]);                        // close the write end of the pipe
 
-      // the result of the waitpid call
-      int res;
       if(slave > 0)
 	 close(slave);
 
@@ -925,6 +964,8 @@ bool pkgDPkgPM::Go(int OutStatusFd)
       sigemptyset(&sigmask);
       sigprocmask(SIG_BLOCK,&sigmask,&original_sigmask);
 
+      // the result of the waitpid call
+      int res;
       int select_ret;
       while ((res=waitpid(Child,&Status, WNOHANG)) != Child) {
 	 if(res < 0) {
@@ -991,7 +1032,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
 	 // if it was set to "keep-dpkg-runing" then we won't return
 	 // here but keep the loop going and just report it as a error
 	 // for later
-	 bool stopOnError = _config->FindB("Dpkg::StopOnError",true);
+	 bool const stopOnError = _config->FindB("Dpkg::StopOnError",true);
 	 
 	 if(stopOnError)
 	    RunScripts("DPkg::Post-Invoke");

+ 1 - 1
apt-pkg/deb/dpkgpm.h

@@ -53,7 +53,7 @@ class pkgDPkgPM : public pkgPackageManager
   
    struct Item
    {
-      enum Ops {Install, Configure, Remove, Purge} Op;
+      enum Ops {Install, Configure, Remove, Purge, ConfigurePending, TriggersPending} Op;
       string File;
       PkgIterator Pkg;
       Item(Ops Op,PkgIterator Pkg,string File = "") : Op(Op),

+ 42 - 21
apt-pkg/orderlist.cc

@@ -174,22 +174,35 @@ bool pkgOrderList::DoRun()
 bool pkgOrderList::OrderCritical()
 {
    FileList = 0;
-   
-   Primary = &pkgOrderList::DepUnPackPre;
+
+   Primary = &pkgOrderList::DepUnPackPreD;
    Secondary = 0;
    RevDepends = 0;
    Remove = 0;
    LoopCount = 0;
-   
+
    // Sort
    Me = this;
-   qsort(List,End - List,sizeof(*List),&OrderCompareB);   
-   
+   qsort(List,End - List,sizeof(*List),&OrderCompareB);
+
    if (DoRun() == false)
       return false;
-   
+
    if (LoopCount != 0)
       return _error->Error("Fatal, predepends looping detected");
+
+   if (Debug == true)
+   {
+      clog << "** Critical Unpack ordering done" << endl;
+
+      for (iterator I = List; I != End; I++)
+      {
+	 PkgIterator P(Cache,*I);
+	 if (IsNow(P) == true)
+	    clog << "  " << P.Name() << ' ' << IsMissing(P) << ',' << IsFlag(P,After) << endl;
+      }
+   }
+
    return true;
 }
 									/*}}}*/
@@ -205,7 +218,7 @@ bool pkgOrderList::OrderUnpack(string *FileList)
    if (FileList != 0)
    {
       WipeFlags(After);
-      
+
       // Set the inlist flag
       for (iterator I = List; I != End; I++)
       {
@@ -214,7 +227,7 @@ bool pkgOrderList::OrderUnpack(string *FileList)
 	     Flag(*I,After);
       }
    }
-   
+
    Primary = &pkgOrderList::DepUnPackCrit;
    Secondary = &pkgOrderList::DepConfigure;
    RevDepends = &pkgOrderList::DepUnPackDep;
@@ -229,7 +242,7 @@ bool pkgOrderList::OrderUnpack(string *FileList)
       clog << "** Pass A" << endl;
    if (DoRun() == false)
       return false;
-   
+
    if (Debug == true)
       clog << "** Pass B" << endl;
    Secondary = 0;
@@ -243,7 +256,7 @@ bool pkgOrderList::OrderUnpack(string *FileList)
    Remove = 0;             // Otherwise the libreadline remove problem occures
    if (DoRun() == false)
       return false;
-      
+
    if (Debug == true)
       clog << "** Pass D" << endl;
    LoopCount = 0;
@@ -259,9 +272,9 @@ bool pkgOrderList::OrderUnpack(string *FileList)
       {
 	 PkgIterator P(Cache,*I);
 	 if (IsNow(P) == true)
-	    clog << P.Name() << ' ' << IsMissing(P) << ',' << IsFlag(P,After) << endl;
+	    clog << "  " << P.Name() << ' ' << IsMissing(P) << ',' << IsFlag(P,After) << endl;
       }
-   }   
+   }
 
    return true;
 }
@@ -286,29 +299,35 @@ bool pkgOrderList::OrderConfigure()
 /* Higher scores order earlier */
 int pkgOrderList::Score(PkgIterator Pkg)
 {
+   static int const ScoreDelete = _config->FindI("OrderList::Score::Delete", 500);
+
    // Removal is always done first
    if (Cache[Pkg].Delete() == true)
-      return 200;
-   
+      return ScoreDelete;
+
    // This should never happen..
    if (Cache[Pkg].InstVerIter(Cache).end() == true)
       return -1;
-   
+
+   static int const ScoreEssential = _config->FindI("OrderList::Score::Essential", 200);
+   static int const ScoreImmediate = _config->FindI("OrderList::Score::Immediate", 10);
+   static int const ScorePreDepends = _config->FindI("OrderList::Score::PreDepends", 50);
+
    int Score = 0;
    if ((Pkg->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
-      Score += 100;
+      Score += ScoreEssential;
 
    if (IsFlag(Pkg,Immediate) == true)
-      Score += 10;
-   
-   for (DepIterator D = Cache[Pkg].InstVerIter(Cache).DependsList(); 
+      Score += ScoreImmediate;
+
+   for (DepIterator D = Cache[Pkg].InstVerIter(Cache).DependsList();
 	D.end() == false; D++)
       if (D->Type == pkgCache::Dep::PreDepends)
       {
-	 Score += 50;
+	 Score += ScorePreDepends;
 	 break;
       }
-      
+
    // Important Required Standard Optional Extra
    signed short PrioMap[] = {0,5,4,3,1,0};
    if (Cache[Pkg].InstVerIter(Cache)->Priority <= 5)
@@ -386,6 +405,7 @@ int pkgOrderList::OrderCompareA(const void *a, const void *b)
    
    int ScoreA = Me->Score(A);
    int ScoreB = Me->Score(B);
+
    if (ScoreA > ScoreB)
       return -1;
    
@@ -422,6 +442,7 @@ int pkgOrderList::OrderCompareB(const void *a, const void *b)
    
    int ScoreA = Me->Score(A);
    int ScoreB = Me->Score(B);
+
    if (ScoreA > ScoreB)
       return -1;
    

+ 25 - 12
apt-pkg/packagemanager.cc

@@ -57,7 +57,10 @@ bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
    if (CreateOrderList() == false)
       return false;
    
-   if (List->OrderUnpack() == false)
+   bool const ordering =
+	_config->FindB("PackageManager::UnpackAll",true) ?
+		List->OrderUnpack() : List->OrderCritical();
+   if (ordering == false)
       return _error->Error("Internal ordering error");
 
    for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
@@ -163,7 +166,7 @@ bool pkgPackageManager::CreateOrderList()
    delete List;
    List = new pkgOrderList(&Cache);
    
-   bool NoImmConfigure = !_config->FindB("APT::Immediate-Configure",true);
+   static bool const NoImmConfigure = !_config->FindB("APT::Immediate-Configure",true);
    
    // Generate the list of affected packages and sort it
    for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
@@ -266,13 +269,16 @@ bool pkgPackageManager::ConfigureAll()
    
    if (OList.OrderConfigure() == false)
       return false;
-   
+
+   std::string const conf = _config->Find("PackageManager::Configure","all");
+   bool const ConfigurePkgs = (conf == "all");
+
    // Perform the configuring
    for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); I++)
    {
       PkgIterator Pkg(Cache,*I);
       
-      if (Configure(Pkg) == false)
+      if (ConfigurePkgs == true && Configure(Pkg) == false)
 	 return false;
       
       List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States);
@@ -291,16 +297,20 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg)
 
    if (DepAdd(OList,Pkg) == false)
       return false;
-   
-   if (OList.OrderConfigure() == false)
-      return false;
-   
+
+   static std::string const conf = _config->Find("PackageManager::Configure","all");
+   static bool const ConfigurePkgs = (conf == "all" || conf == "smart");
+
+   if (ConfigurePkgs == true)
+      if (OList.OrderConfigure() == false)
+	 return false;
+
    // Perform the configuring
    for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); I++)
    {
       PkgIterator Pkg(Cache,*I);
       
-      if (Configure(Pkg) == false)
+      if (ConfigurePkgs == true && Configure(Pkg) == false)
 	 return false;
       
       List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States);
@@ -577,9 +587,12 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
    Reset();
    
    if (Debug == true)
-      clog << "Begining to order" << endl;
+      clog << "Beginning to order" << endl;
 
-   if (List->OrderUnpack(FileNames) == false)
+   bool const ordering =
+	_config->FindB("PackageManager::UnpackAll",true) ?
+		List->OrderUnpack(FileNames) : List->OrderCritical();
+   if (ordering == false)
    {
       _error->Error("Internal ordering error");
       return Failed;
@@ -632,7 +645,7 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
 	    return Failed;
       DoneSomething = true;
    }
-   
+
    // Final run through the configure phase
    if (ConfigureAll() == false)
       return Failed;

+ 1 - 1
buildlib/po4a_manpage.mak

@@ -16,7 +16,7 @@ INCLUDES = apt.ent
 # Do not use XMLTO, build the manpages directly with XSLTPROC
 ifdef XSLTPROC
 
-STYLESHEET=./style.$(LC).xsl
+STYLESHEET=../manpage-style.xsl
 
 LOCAL := po4a-manpage-$(firstword $(SOURCE))
 $(LOCAL)-LIST := $(SOURCE)

+ 2 - 1
buildlib/sizetable

@@ -11,6 +11,7 @@
 # The format is:-
 # CPU endian sizeof: char, int, short, long
 i386    little  1 4 2 4
+amd64   little  1 4 2 8
 armeb   big     1 4 2 4
 arm     little  1 4 2 4
 alpha   little  1 4 2 8
@@ -21,4 +22,4 @@ m68k    big     1 4 2 4
 powerpc big     1 4 2 4
 mips    big     1 4 2 4
 hppa    big     1 4 2 4
-m32r	big	1 4 2 4
+m32r	big	1 4 2 4

+ 24 - 0
debian/changelog

@@ -18,6 +18,30 @@ apt (0.7.24) UNRELEASED; urgency=low
     - activate DOT_MULTI_TARGETS, it is default on since doxygen 1.5.9
   * buildlib/po4a_manpage.mak, doc/makefile, configure:
     - simplify the makefiles needed for po4a manpages
+  * apt-pkg/contrib/configuration.cc:
+    - add a helper to easily get a vector of strings from the config
+  * apt-pkg/contrib/strutl.cc:
+    - replace unknown multibytes with ? in UTF8ToCharset (Closes: #545208)
+  * doc/apt-get.8.xml:
+    - fix two little typos in the --simulate description.
+  * apt-pkg/aptconfiguration.cc, doc/apt.conf.5.xml:
+    - add an order subgroup to the compression types to simplify reordering
+      a bit and improve the documentation for this option group.
+  * doc/apt.ent, all man pages:
+    - move the description of files to globally usable entities
+  * doc/apt_preferences.5.xml:
+    - document the new preferences.d folder (Closes: #544017)
+  * methods/rred.cc:
+    - add at the top without failing (by Bernhard R. Link, Closes: #545694)
+  * buildlib/sizetable:
+    - add amd64 for cross building (by Mikhail Gusarov, Closes: #513058)
+  * debian/prerm:
+    - remove file as nobody will upgrade from 0.4.10 anymore
+  * debian/control:
+    - remove gnome-apt suggestion as it was removed from debian
+  * apt-pkg/deb/dpkgpm.cc, apt-pkg/packagemanager.cc, apt-pkg/orderlist.cc:
+    - add and document _experimental_ options to make (aggressive)
+      use of dpkg's trigger and configuration handling (Closes: #473461)
 
   [ Christian Perrier ]
   * doc/fr/*, doc/po/fr.po:

+ 1 - 1
debian/control

@@ -15,7 +15,7 @@ Depends: ${shlibs:Depends}, debian-archive-keyring
 Priority: important
 Replaces: libapt-pkg-doc (<< 0.3.7), libapt-pkg-dev (<< 0.3.7)
 Provides: ${libapt-pkg:provides}
-Suggests: aptitude | synaptic | gnome-apt | wajig, dpkg-dev, apt-doc, bzip2, lzma, python-apt
+Suggests: aptitude | synaptic | wajig, dpkg-dev, apt-doc, bzip2, lzma, python-apt
 Section: admin
 Description: Advanced front-end for dpkg
  This is Debian's next generation front-end for the dpkg package manager.

+ 0 - 15
debian/prerm

@@ -1,15 +0,0 @@
-#! /bin/sh
-
-set -e
-
-#DEBHELPER#
-
-if [ "$1" = "upgrade" -o "$1" = "failed-upgrade" ] && 
-   dpkg --compare-versions "$2" "<<" 0.4.10
-then
-  if [ ! -d /var/state/apt/ ]; then
-    ln -s /var/lib/apt /var/state/apt
-    touch /var/lib/apt/lists/partial/.delete-me-later
-  fi
-fi
-  

+ 2 - 15
doc/apt-cache.8.xml

@@ -357,21 +357,8 @@ Reverse Provides:
 
  <refsect1><title>Files</title>
    <variablelist>
-     <varlistentry><term><filename>/etc/apt/sources.list</filename></term>
-     <listitem><para>Locations to fetch packages from.
-     Configuration Item: <literal>Dir::Etc::SourceList</literal>.</para></listitem>
-     </varlistentry>
-     
-     <varlistentry><term><filename>&statedir;/lists/</filename></term>
-     <listitem><para>Storage area for state information for each package resource specified in
-     &sources-list;
-     Configuration Item: <literal>Dir::State::Lists</literal>.</para></listitem>
-     </varlistentry>
-  
-     <varlistentry><term><filename>&statedir;/lists/partial/</filename></term>
-     <listitem><para>Storage area for state information in transit.
-     Configuration Item: <literal>Dir::State::Lists</literal> (implicit partial).</para></listitem>
-     </varlistentry>     
+     &file-sourceslist;
+     &file-statelists;
    </variablelist>
  </refsect1>
 

+ 8 - 47
doc/apt-get.8.xml

@@ -384,9 +384,9 @@
      Configuration Item: <literal>APT::Get::Simulate</literal>.</para>
 
      <para>Simulation run as user will deactivate locking (<literal>Debug::NoLocking</literal>)
-     automatical. Also a notice will be displayed indicating that this is only a simulation,
-     if the option <literal>APT::Get::Show-User-Simulation-Note</literal> is set (Default: true)
-     Neigther NoLocking nor the notice will be triggered if run as root (root should know what
+     automatic. Also a notice will be displayed indicating that this is only a simulation,
+     if the option <literal>APT::Get::Show-User-Simulation-Note</literal> is set (Default: true).
+     Neither NoLocking nor the notice will be triggered if run as root (root should know what
      he is doing without further warnings by <literal>apt-get</literal>).</para>
 
      <para>Simulate prints out
@@ -558,50 +558,11 @@
 
  <refsect1><title>Files</title>
    <variablelist>
-     <varlistentry><term><filename>/etc/apt/sources.list</filename></term>
-     <listitem><para>Locations to fetch packages from.
-     Configuration Item: <literal>Dir::Etc::SourceList</literal>.</para></listitem>
-     </varlistentry>
-     
-     <varlistentry><term><filename>/etc/apt/apt.conf</filename></term>
-     <listitem><para>APT configuration file.
-     Configuration Item: <literal>Dir::Etc::Main</literal>.</para></listitem>
-     </varlistentry>
-     
-     <varlistentry><term><filename>/etc/apt/apt.conf.d/</filename></term>
-     <listitem><para>APT configuration file fragments.
-     Configuration Item: <literal>Dir::Etc::Parts</literal>.</para></listitem>
-     </varlistentry>
-     
-     <varlistentry><term><filename>/etc/apt/preferences</filename></term>
-     <listitem><para>Version preferences file.
-     This is where you would specify "pinning",
-     i.e. a preference to get certain packages
-     from a separate source
-     or from a different version of a distribution.
-     Configuration Item: <literal>Dir::Etc::Preferences</literal>.</para></listitem>
-     </varlistentry>
-     
-     <varlistentry><term><filename>&cachedir;/archives/</filename></term>
-     <listitem><para>Storage area for retrieved package files.
-     Configuration Item: <literal>Dir::Cache::Archives</literal>.</para></listitem>
-     </varlistentry>
-     
-     <varlistentry><term><filename>&cachedir;/archives/partial/</filename></term>
-     <listitem><para>Storage area for package files in transit.
-     Configuration Item: <literal>Dir::Cache::Archives</literal> (implicit partial). </para></listitem>
-     </varlistentry>
-     
-     <varlistentry><term><filename>&statedir;/lists/</filename></term>
-     <listitem><para>Storage area for state information for each package resource specified in
-     &sources-list;
-     Configuration Item: <literal>Dir::State::Lists</literal>.</para></listitem>
-     </varlistentry>
-  
-     <varlistentry><term><filename>&statedir;/lists/partial/</filename></term>
-     <listitem><para> Storage area for state information in transit.
-     Configuration Item: <literal>Dir::State::Lists</literal> (implicit partial).</para></listitem>
-     </varlistentry>     
+     &file-sourceslist;
+     &file-aptconf;
+     &file-preferences;
+     &file-cachearchives;
+     &file-statelists;
    </variablelist>
  </refsect1>
 

+ 106 - 19
doc/apt.conf.5.xml

@@ -21,7 +21,7 @@
    &apt-email;
    &apt-product;
    <!-- The last update date -->
-   <date>10 December 2008</date>
+   <date>18 September 2009</date>
  </refentryinfo>
  
  <refmeta>
@@ -90,7 +90,7 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};
    <literal>#include</literal> will include the given file, unless the filename
    ends in a slash, then the whole directory is included.  
    <literal>#clear</literal> is used to erase a part of the configuration tree. The
-   specified element and all its descendents are erased.</para>
+   specified element and all its descendants are erased.</para>
 
    <para>All of the APT tools take a -o option which allows an arbitrary configuration 
    directive to be specified on the command line. The syntax is a full option
@@ -312,16 +312,30 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};
      <varlistentry><term>CompressionTypes</term>
      <listitem><para>List of compression types which are understood by the acquire methods.
      Files like <filename>Packages</filename> can be available in various compression formats.
-     This list defines in which order the acquire methods will try to download these files.
-     Per default <command>bzip2</command> compressed files will be prefered over
-     <command>lzma</command>, <command>gzip</command> and uncompressed files. The syntax for
-     the configuration fileentry is
+     Per default the acquire methods can decompress <command>bzip2</command>, <command>lzma</command>
+     and <command>gzip</command> compressed files, with this setting more formats can be added
+     on the fly or the used method can be changed. The syntax for this is:
      <synopsis>Acquire::CompressionTypes::<replaceable>FileExtension</replaceable> "<replaceable>Methodname</replaceable>";</synopsis>
-     e.g. <synopsis>Acquire::CompressionTypes::bz2 "bzip2";</synopsis>
-     Note that at runtime the <literal>Dir::Bin::<replaceable>Methodname</replaceable></literal> will
+     </para><para>Also the <literal>Order</literal> subgroup can be used to define in which order
+     the acquire system will try to download the compressed files. The acquire system will try the first
+     and proceed with the next compression type in this list on error, so to prefer one over the other type
+     simple add the preferred type at first - not already added default types will be added at run time
+     to the end of the list, so e.g. <synopsis>Acquire::CompressionTypes::Order:: "gz";</synopsis> can
+     be used to prefer <command>gzip</command> compressed files over <command>bzip2</command> and <command>lzma</command>.
+     If <command>lzma</command> should be preferred over <command>gzip</command> and <command>bzip2</command> the
+     configure setting should look like this <synopsis>Acquire::CompressionTypes::Order { "lzma"; "gz"; };</synopsis>
+     It is not needed to add <literal>bz2</literal> explicit to the list as it will be added automatic.</para>
+     <para>Note that at run time the <literal>Dir::Bin::<replaceable>Methodname</replaceable></literal> will
      be checked: If this setting exists the method will only be used if this file exists, e.g. for
-     the bzip2 method above (the inbuilt) setting is <literallayout>Dir::Bin::bzip2 "/bin/bzip2";</literallayout>
-     </para></listitem>
+     the bzip2 method (the inbuilt) setting is <literallayout>Dir::Bin::bzip2 "/bin/bzip2";</literallayout>
+     Note also that list entries specified on the commandline will be added at the end of the list
+     specified in the configuration files, but before the default entries. To prefer a type in this case
+     over the ones specified in in the configuration files you can set the option direct - not in list style.
+     This will not override the defined list, it will only prefix the list with this type.</para>
+     <para>While it is possible to add an empty compression type to the order list, but APT in its current
+     version doesn't understand it correctly and will display many warnings about not downloaded files -
+     these warnings are most of the time false negatives. Future versions will maybe include a way to
+     really prefer uncompressed files to support the usage of local mirrors.</para></listitem>
      </varlistentry>
    </variablelist>
   </para>
@@ -450,6 +464,87 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};
      the default is to disable signing and produce all binaries.</para></listitem>
      </varlistentry>
    </variablelist>
+
+   <refsect2><title>dpkg trigger usage (and related options)</title>
+     <para>APT can call dpkg in a way so it can make aggressive use of triggers over
+     multiply calls of dpkg. Without further options dpkg will use triggers only in between his
+     own run. Activating these options can therefore decrease the time needed to perform the
+     install / upgrade. Note that it is intended to activate these options per default in the
+     future, but as it changes the way APT calling dpkg drastical it needs a lot more testing.
+     <emphasis>These options are therefore currently experimental and should not be used in
+     productive environments.</emphasis> Also it breaks the progress reporting so all frontends will
+     currently stay around half (or more) of the time in the 100% state while it actually configures
+     all packages.</para>
+     <para>Note that it is not garanteed that APT will support these options or that these options will
+     not cause (big) trouble in the future. If you have understand the current risks and problems with
+     these options, but are brave enough to help testing them create a new configuration file and test a
+     combination of options. Please report any bugs, problems and improvements you encounter and make sure
+     to note which options you have used in your reports. Asking dpkg for help could also be useful for
+     debugging proposes, see e.g. <command>dpkg --audit</command>. A defensive option combination would be
+<literallayout>DPkg::NoTriggers "true";
+PackageManager::Configure "smart";
+DPkg::ConfigurePending "true";
+DPkg::TriggersPending "true";</literallayout></para>
+
+     <variablelist>
+       <varlistentry><term>DPkg::NoTriggers</term>
+       <listitem><para>Add the no triggers flag to all dpkg calls (expect the ConfigurePending call).
+       See &dpkg; if you are interested in what this actually means. In short: dpkg will not run the
+       triggers then this flag is present unless it is explicit called to do so in an extra call.
+       Note that this option exists (undocumented) also in older apt versions with a slightly different
+       meaning: Previously these option only append --no-triggers to the configure calls to dpkg -
+       now apt will add these flag also to the unpack and remove calls.</para></listitem>
+       </varlistentry>
+       <varlistentry><term>PackageManager::Configure</term>
+       <listitem><para>Valid values are "<literal>all</literal>", "<literal>smart</literal>" and "<literal>no</literal>".
+       "<literal>all</literal>" is the default value and causes APT to configure all packages explicit.
+       The "<literal>smart</literal>" way is it to configure only packages which need to be configured before
+       another package can be unpacked (Pre-Depends) and let the rest configure by dpkg with a call generated
+       by the next option. "<literal>no</literal>" on the other hand will not configure anything and totally
+       relay on dpkg for configuration (which will at the moment fail if a Pre-Depends is encountered).
+       Setting this option to another than the all value will implicit activate also the next option per
+       default as otherwise the system could end in an unconfigured status which could be unbootable!
+       </para></listitem>
+       </varlistentry>
+       <varlistentry><term>DPkg::ConfigurePending</term>
+       <listitem><para>If this option is set apt will call <command>dpkg --configure --pending</command>
+       to let dpkg handle all required configurations and triggers. This option is activated automatic
+       per default if the previous option is not set to <literal>all</literal>, but deactivating could be useful
+       if you want to run APT multiple times in a row - e.g. in an installer. In this sceneries you could
+       deactivate this option in all but the last run.</para></listitem>
+       </varlistentry>
+       <varlistentry><term>DPkg::TriggersPending</term>
+       <listitem><para>Useful for <literal>smart</literal> configuration as a package which has pending
+       triggers is not considered as <literal>installed</literal> and dpkg treats them as <literal>unpacked</literal>
+       currently which is a dealbreaker for Pre-Dependencies (see debbugs #526774). Note that this will
+       process all triggers, not only the triggers needed to configure this package.</para></listitem>
+       </varlistentry>
+       <varlistentry><term>PackageManager::UnpackAll</term>
+       <listitem><para>As the configuration can be deferred to be done at the end by dpkg it can be
+       tried to order the unpack series only by critical needs, e.g. by Pre-Depends. Default is true
+       and therefore the "old" method of ordering in verious steps by everything. While both method
+       were present in earlier APT versions the <literal>OrderCritical</literal> method was unused, so
+       this method is very experimental and needs further improvements before becoming really useful.
+       </para></listitem>
+       </varlistentry>
+       <varlistentry><term>OrderList::Score::Immediate</term>
+       <listitem><para>Essential packages (and there dependencies) should be configured immediately
+       after unpacking. It will be a good idea to do this quite early in the upgrade process as these
+       these configure calls require currently also <literal>DPkg::TriggersPending</literal> which
+       will run quite a few triggers (which maybe not needed). Essentials get per default a high score
+       but the immediate flag is relativly low (a package which has a Pre-Depends is higher rated).
+       These option and the others in the same group can be used to change the scoring. The following
+       example shows the settings with there default values.
+       <literallayout>OrderList::Score {
+	Delete 500;
+	Essential 200;
+	Immediate 10;
+	PreDepends 50;
+};</literallayout>
+       </para></listitem>
+       </varlistentry>
+     </variablelist>
+   </refsect2>
  </refsect1>
 
  <refsect1>
@@ -844,15 +939,7 @@ is commented.
  
  <refsect1><title>Files</title>
    <variablelist>
-      <varlistentry><term><filename>/etc/apt/apt.conf</filename></term>
-      <listitem><para>APT configuration file.
-      Configuration Item: <literal>Dir::Etc::Main</literal>.</para></listitem> 
-      </varlistentry>
-
-      <varlistentry><term><filename>/etc/apt/apt.conf.d/</filename></term>
-      <listitem><para>APT configuration file fragments.
-      Configuration Item: <literal>Dir::Etc::Parts</literal>.</para></listitem>
-      </varlistentry>
+      &file-aptconf;
    </variablelist>
  </refsect1>
  

+ 64 - 0
doc/apt.ent

@@ -289,3 +289,67 @@
    </para>
 ">
 
+<!ENTITY file-aptconf "
+     <varlistentry><term><filename>/etc/apt/apt.conf</filename></term>
+     <listitem><para>APT configuration file.
+     Configuration Item: <literal>Dir::Etc::Main</literal>.</para></listitem>
+     </varlistentry>
+
+     <varlistentry><term><filename>/etc/apt/apt.conf.d/</filename></term>
+     <listitem><para>APT configuration file fragments.
+     Configuration Item: <literal>Dir::Etc::Parts</literal>.</para></listitem>
+     </varlistentry>
+">
+
+<!ENTITY file-cachearchives "
+     <varlistentry><term><filename>&cachedir;/archives/</filename></term>
+     <listitem><para>Storage area for retrieved package files.
+     Configuration Item: <literal>Dir::Cache::Archives</literal>.</para></listitem>
+     </varlistentry>
+
+     <varlistentry><term><filename>&cachedir;/archives/partial/</filename></term>
+     <listitem><para>Storage area for package files in transit.
+     Configuration Item: <literal>Dir::Cache::Archives</literal> (implicit partial). </para></listitem>
+     </varlistentry>
+">
+
+<!ENTITY file-preferences "
+     <varlistentry><term><filename>/etc/apt/preferences</filename></term>
+     <listitem><para>Version preferences file.
+     This is where you would specify &quot;pinning&quot;,
+     i.e. a preference to get certain packages
+     from a separate source
+     or from a different version of a distribution.
+     Configuration Item: <literal>Dir::Etc::Preferences</literal>.</para></listitem>
+     </varlistentry>
+
+     <varlistentry><term><filename>/etc/apt/preferences.d/</filename></term>
+     <listitem><para>File fragments for the version preferences.
+     Configuration Item: <literal>Dir::Etc::PreferencesParts</literal>.</para></listitem>
+     </varlistentry>
+">
+
+<!ENTITY file-sourceslist "
+     <varlistentry><term><filename>/etc/apt/sources.list</filename></term>
+     <listitem><para>Locations to fetch packages from.
+     Configuration Item: <literal>Dir::Etc::SourceList</literal>.</para></listitem>
+     </varlistentry>
+
+     <varlistentry><term><filename>/etc/apt/sources.list.d/</filename></term>
+     <listitem><para>File fragments for locations to fetch packages from.
+     Configuration Item: <literal>Dir::Etc::SourceParts</literal>.</para></listitem>
+     </varlistentry>
+">
+
+<!ENTITY file-statelists "
+     <varlistentry><term><filename>&statedir;/lists/</filename></term>
+     <listitem><para>Storage area for state information for each package resource specified in
+     &sources-list;
+     Configuration Item: <literal>Dir::State::Lists</literal>.</para></listitem>
+     </varlistentry>
+
+     <varlistentry><term><filename>&statedir;/lists/partial/</filename></term>
+     <listitem><para>Storage area for state information in transit.
+     Configuration Item: <literal>Dir::State::Lists</literal> (implicit partial).</para></listitem>
+     </varlistentry>
+">

+ 9 - 1
doc/apt_preferences.5.xml

@@ -32,7 +32,8 @@
 <refsect1>
 <title>Description</title>
 <para>The APT preferences file <filename>/etc/apt/preferences</filename>
-can be used to control which versions of packages will be selected
+and the fragment files in the <filename>/etc/apt/preferences.d/</filename>
+folder can be used to control which versions of packages will be selected
 for installation.</para>
 
 <para>Several versions of a package may be available for installation when
@@ -610,6 +611,13 @@ apt-get install <replaceable>package</replaceable>/sid
 </refsect2>
 </refsect1>
 
+<refsect1>
+<title>Files</title>
+  <variablelist>
+    &file-preferences;
+  </variablelist>
+</refsect1>
+
 <refsect1>
 <title>See Also</title>
 <para>&apt-get; &apt-cache; &apt-conf; &sources-list;

+ 20 - 4
doc/examples/configure-index

@@ -246,6 +246,15 @@ Acquire
   {
    Options {"--ignore-time-conflict";}	// not very useful on a normal system
   };
+
+  CompressionTypes
+  {
+    bz2 "bzip2";
+    lzma "lzma";
+    gz "gzip";
+
+    Order { "gz"; "lzma"; "bz2"; };
+  };
 };
 
 // Directory layout
@@ -310,18 +319,25 @@ DSelect
    CheckDir "no";
 }
 
-DPkg 
+DPkg
 {
+   // let apt aggressivly use dpkg triggers
+   NoTriggers "true";
+   NoConfigure "true";
+   ConfigurePending "true";
+
    // Probably don't want to use force-downgrade..
    Options {"--force-overwrite";"--force-downgrade";}
-   
+
    // Auto re-mounting of a readonly /usr
    Pre-Invoke {"mount -o remount,rw /usr";};
    Post-Invoke {"mount -o remount,ro /usr";};
-   
+
+   Chroot-Directory "/";
+
    // Prevents daemons from getting cwd as something mountable (default)
    Run-Directory "/";
-   
+
    // Build options for apt-get source --compile
    Build-Options "-b -uc";
 

+ 0 - 9
doc/fr/style.fr.xsl

@@ -1,9 +0,0 @@
-<xsl:stylesheet
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0">
-
-<xsl:import href="/usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl" />
-
-<xsl:param name="man.output.encoding" select="'ISO-8859-15'" />
-
-</xsl:stylesheet>

+ 1 - 1
doc/ja/style.ja.xsl

@@ -4,6 +4,6 @@
 
 <xsl:import href="/usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl" />
 
-<xsl:param name="man.output.encoding" select="'EUC-JP'" />
+<xsl:param name="man.output.encoding" select="'UTF-8'" />
 
 </xsl:stylesheet>

Разлика између датотеке није приказан због своје велике величине
+ 1306 - 934
doc/po/apt-doc.pot


Разлика између датотеке није приказан због своје велике величине
+ 2291 - 1664
doc/po/fr.po


Разлика између датотеке није приказан због своје велике величине
+ 1560 - 994
doc/po/ja.po


+ 1 - 1
methods/rred.cc

@@ -174,7 +174,7 @@ int RredMethod::ed_file(FILE *ed_cmds, FILE *in_file, FILE *out_file,
          hash);
    
    /* read the rest from infile */
-   if (result > 0) {
+   if (result >= 0) {
       while (fgets(buffer, BUF_SIZE, in_file) != NULL) {
          written = fwrite(buffer, 1, strlen(buffer), out_file);
          hash->Add((unsigned char*)buffer, written);

+ 31 - 31
po/apt-all.pot

@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2009-08-21 11:35+0200\n"
+"POT-Creation-Date: 2009-09-15 22:58+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -1388,7 +1388,7 @@ msgstr ""
 
 #. Only warn if there are no sources.list.d.
 #. Only warn if there is no sources.list file.
-#: apt-inst/extract.cc:464 apt-pkg/contrib/configuration.cc:822
+#: apt-inst/extract.cc:464 apt-pkg/contrib/configuration.cc:843
 #: apt-pkg/contrib/cdromutl.cc:157 apt-pkg/sourcelist.cc:166
 #: apt-pkg/sourcelist.cc:172 apt-pkg/sourcelist.cc:327 apt-pkg/acquire.cc:419
 #: apt-pkg/init.cc:89 apt-pkg/init.cc:97 apt-pkg/clean.cc:33
@@ -1908,80 +1908,80 @@ msgid ""
 msgstr ""
 
 #. d means days, h means hours, min means minutes, s means seconds
-#: apt-pkg/contrib/strutl.cc:335
+#: apt-pkg/contrib/strutl.cc:346
 #, c-format
 msgid "%lid %lih %limin %lis"
 msgstr ""
 
 #. h means hours, min means minutes, s means seconds
-#: apt-pkg/contrib/strutl.cc:342
+#: apt-pkg/contrib/strutl.cc:353
 #, c-format
 msgid "%lih %limin %lis"
 msgstr ""
 
 #. min means minutes, s means seconds
-#: apt-pkg/contrib/strutl.cc:349
+#: apt-pkg/contrib/strutl.cc:360
 #, c-format
 msgid "%limin %lis"
 msgstr ""
 
 #. s means seconds
-#: apt-pkg/contrib/strutl.cc:354
+#: apt-pkg/contrib/strutl.cc:365
 #, c-format
 msgid "%lis"
 msgstr ""
 
-#: apt-pkg/contrib/strutl.cc:1029
+#: apt-pkg/contrib/strutl.cc:1040
 #, c-format
 msgid "Selection %s not found"
 msgstr ""
 
-#: apt-pkg/contrib/configuration.cc:439
+#: apt-pkg/contrib/configuration.cc:458
 #, c-format
 msgid "Unrecognized type abbreviation: '%c'"
 msgstr ""
 
-#: apt-pkg/contrib/configuration.cc:497
+#: apt-pkg/contrib/configuration.cc:516
 #, c-format
 msgid "Opening configuration file %s"
 msgstr ""
 
-#: apt-pkg/contrib/configuration.cc:663
+#: apt-pkg/contrib/configuration.cc:684
 #, c-format
 msgid "Syntax error %s:%u: Block starts with no name."
 msgstr ""
 
-#: apt-pkg/contrib/configuration.cc:682
+#: apt-pkg/contrib/configuration.cc:703
 #, c-format
 msgid "Syntax error %s:%u: Malformed tag"
 msgstr ""
 
-#: apt-pkg/contrib/configuration.cc:699
+#: apt-pkg/contrib/configuration.cc:720
 #, c-format
 msgid "Syntax error %s:%u: Extra junk after value"
 msgstr ""
 
-#: apt-pkg/contrib/configuration.cc:739
+#: apt-pkg/contrib/configuration.cc:760
 #, c-format
 msgid "Syntax error %s:%u: Directives can only be done at the top level"
 msgstr ""
 
-#: apt-pkg/contrib/configuration.cc:746
+#: apt-pkg/contrib/configuration.cc:767
 #, c-format
 msgid "Syntax error %s:%u: Too many nested includes"
 msgstr ""
 
-#: apt-pkg/contrib/configuration.cc:750 apt-pkg/contrib/configuration.cc:755
+#: apt-pkg/contrib/configuration.cc:771 apt-pkg/contrib/configuration.cc:776
 #, c-format
 msgid "Syntax error %s:%u: Included from here"
 msgstr ""
 
-#: apt-pkg/contrib/configuration.cc:759
+#: apt-pkg/contrib/configuration.cc:780
 #, c-format
 msgid "Syntax error %s:%u: Unsupported directive '%s'"
 msgstr ""
 
-#: apt-pkg/contrib/configuration.cc:810
+#: apt-pkg/contrib/configuration.cc:831
 #, c-format
 msgid "Syntax error %s:%u: Extra junk at end of file"
 msgstr ""
@@ -2292,7 +2292,7 @@ msgstr ""
 msgid "Malformed line %u in source list %s (vendor id)"
 msgstr ""
 
-#: apt-pkg/packagemanager.cc:426
+#: apt-pkg/packagemanager.cc:436
 #, c-format
 msgid ""
 "This installation run will require temporarily removing the essential "
@@ -2666,12 +2666,12 @@ msgstr ""
 msgid "Installing %s"
 msgstr ""
 
-#: apt-pkg/deb/dpkgpm.cc:50 apt-pkg/deb/dpkgpm.cc:642
+#: apt-pkg/deb/dpkgpm.cc:50 apt-pkg/deb/dpkgpm.cc:659
 #, c-format
 msgid "Configuring %s"
 msgstr ""
 
-#: apt-pkg/deb/dpkgpm.cc:51 apt-pkg/deb/dpkgpm.cc:649
+#: apt-pkg/deb/dpkgpm.cc:51 apt-pkg/deb/dpkgpm.cc:666
 #, c-format
 msgid "Removing %s"
 msgstr ""
@@ -2681,56 +2681,56 @@ msgstr ""
 msgid "Running post-installation trigger %s"
 msgstr ""
 
-#: apt-pkg/deb/dpkgpm.cc:546
+#: apt-pkg/deb/dpkgpm.cc:557
 #, c-format
 msgid "Directory '%s' missing"
 msgstr ""
 
-#: apt-pkg/deb/dpkgpm.cc:635
+#: apt-pkg/deb/dpkgpm.cc:652
 #, c-format
 msgid "Preparing %s"
 msgstr ""
 
-#: apt-pkg/deb/dpkgpm.cc:636
+#: apt-pkg/deb/dpkgpm.cc:653
 #, c-format
 msgid "Unpacking %s"
 msgstr ""
 
-#: apt-pkg/deb/dpkgpm.cc:641
+#: apt-pkg/deb/dpkgpm.cc:658
 #, c-format
 msgid "Preparing to configure %s"
 msgstr ""
 
-#: apt-pkg/deb/dpkgpm.cc:643
+#: apt-pkg/deb/dpkgpm.cc:660
 #, c-format
 msgid "Installed %s"
 msgstr ""
 
-#: apt-pkg/deb/dpkgpm.cc:648
+#: apt-pkg/deb/dpkgpm.cc:665
 #, c-format
 msgid "Preparing for removal of %s"
 msgstr ""
 
-#: apt-pkg/deb/dpkgpm.cc:650
+#: apt-pkg/deb/dpkgpm.cc:667
 #, c-format
 msgid "Removed %s"
 msgstr ""
 
-#: apt-pkg/deb/dpkgpm.cc:655
+#: apt-pkg/deb/dpkgpm.cc:672
 #, c-format
 msgid "Preparing to completely remove %s"
 msgstr ""
 
-#: apt-pkg/deb/dpkgpm.cc:656
+#: apt-pkg/deb/dpkgpm.cc:673
 #, c-format
 msgid "Completely removed %s"
 msgstr ""
 
-#: apt-pkg/deb/dpkgpm.cc:820
+#: apt-pkg/deb/dpkgpm.cc:861
 msgid "Can not write log, openpty() failed (/dev/pts not mounted?)\n"
 msgstr ""
 
-#: apt-pkg/deb/dpkgpm.cc:848
+#: apt-pkg/deb/dpkgpm.cc:889
 msgid "Running dpkg"
 msgstr ""