Przeglądaj źródła

Merge branch 'debian/sid' into debian/experimental

Conflicts:
	debian/changelog
Michael Vogt 12 lat temu
rodzic
commit
aa0bd601ea
90 zmienionych plików z 9703 dodań i 7895 usunięć
  1. 1 1
      .travis.yml
  2. 4 2
      apt-pkg/contrib/fileutl.cc
  3. 2 1
      apt-pkg/deb/debsrcrecords.cc
  4. 2 1
      apt-pkg/deb/dpkgpm.cc
  5. 2 2
      apt-pkg/depcache.cc
  6. 59 10
      apt-pkg/edsp.cc
  7. 3 3
      apt-pkg/edsp.h
  8. 24 13
      apt-pkg/srcrecords.cc
  9. 7 2
      apt-pkg/srcrecords.h
  10. 5 0
      apt-private/private-download.cc
  11. 6 0
      apt-private/private-download.h
  12. 143 1
      apt-private/private-install.cc
  13. 7 149
      apt-private/private-install.h
  14. 1 1
      apt-private/private-output.cc
  15. 18 0
      apt-private/private-update.cc
  16. 1 1
      cmdline/apt-cache.cc
  17. 9 0
      cmdline/apt-get.cc
  18. 2 1
      cmdline/apt-helper.cc
  19. 18 18
      cmdline/apt-internal-solver.cc
  20. 1 0
      cmdline/apt.cc
  21. 12 5
      configure.ac
  22. 41 0
      debian/changelog
  23. 1 1
      debian/libapt-inst1.5.symbols
  24. 32 20
      debian/libapt-pkg4.13.symbols
  25. 1 1
      debian/tests/control
  26. 1 0
      debian/tests/run-tests
  27. 1 1
      doc/apt-verbatim.ent
  28. 24 7
      doc/external-dependency-solver-protocol.txt
  29. 2 2
      doc/po/apt-doc.pot
  30. 61 60
      doc/po/de.po
  31. 72 10
      ftparchive/cachedb.cc
  32. 22 4
      ftparchive/cachedb.h
  33. 12 1
      ftparchive/contents.cc
  34. 2 2
      ftparchive/contents.h
  35. 4 2
      ftparchive/writer.h
  36. 202 179
      po/ar.po
  37. 202 174
      po/ast.po
  38. 205 175
      po/bg.po
  39. 202 150
      po/bs.po
  40. 206 177
      po/ca.po
  41. 206 174
      po/cs.po
  42. 202 178
      po/cy.po
  43. 202 147
      po/da.po
  44. 210 179
      po/de.po
  45. 206 180
      po/dz.po
  46. 207 178
      po/el.po
  47. 204 177
      po/es.po
  48. 202 176
      po/eu.po
  49. 202 177
      po/fi.po
  50. 207 178
      po/fr.po
  51. 202 174
      po/gl.po
  52. 203 175
      po/hu.po
  53. 306 256
      po/it.po
  54. 201 147
      po/ja.po
  55. 202 176
      po/km.po
  56. 202 176
      po/ko.po
  57. 202 153
      po/ku.po
  58. 204 180
      po/lt.po
  59. 202 178
      po/mr.po
  60. 205 178
      po/nb.po
  61. 202 176
      po/ne.po
  62. 207 180
      po/nl.po
  63. 206 181
      po/nn.po
  64. 208 178
      po/pl.po
  65. 206 176
      po/pt.po
  66. 202 178
      po/pt_BR.po
  67. 203 176
      po/ro.po
  68. 206 174
      po/ru.po
  69. 206 175
      po/sk.po
  70. 205 172
      po/sl.po
  71. 205 178
      po/sv.po
  72. 201 171
      po/th.po
  73. 204 178
      po/tl.po
  74. 207 176
      po/tr.po
  75. 207 177
      po/uk.po
  76. 202 174
      po/vi.po
  77. 201 174
      po/zh_CN.po
  78. 202 176
      po/zh_TW.po
  79. BIN
      test/integration/cachedb-lp1274466-old-format.db
  80. BIN
      test/integration/deb-lp1274466-cachedb.deb
  81. 8 0
      test/integration/framework
  82. 1 1
      test/integration/run-tests
  83. 17 0
      test/integration/test-apt-cli-update
  84. 53 0
      test/integration/test-apt-ftparchive-cachedb-lp1274466
  85. 31 0
      test/integration/test-apt-get-source-authenticated
  86. 39 0
      test/integration/test-bug-745046-candidate-propagation-fails
  87. 2 0
      test/integration/test-compressed-indexes
  88. 9 9
      test/integration/test-essential-force-loopbreak
  89. 65 0
      test/integration/test-external-dependency-solver-protocol
  90. 1 1
      test/libapt/cdrom_test.cc

+ 1 - 1
.travis.yml

@@ -2,5 +2,5 @@ language: cpp
 before_install:
  - sudo apt-get update -q
  - sudo ./prepare-release travis-ci
- - sudo apt-get install -q --no-install-recommends stunnel4
+ - sudo apt-get install -q --no-install-recommends stunnel4 db-util
 script: make && make test && test/integration/run-tests

+ 4 - 2
apt-pkg/contrib/fileutl.cc

@@ -1278,7 +1278,8 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C
 	 if (d->lzma == NULL)
 	    d->lzma = new FileFdPrivate::LZMAFILE;
 	 d->lzma->file = (FILE*) compress_struct;
-	 d->lzma->stream = LZMA_STREAM_INIT;
+         lzma_stream tmp_stream = LZMA_STREAM_INIT;
+	 d->lzma->stream = tmp_stream;
 
 	 if ((Mode & ReadWrite) == ReadWrite)
 	    return FileFdError("ReadWrite mode is not supported for file %s", FileName.c_str());
@@ -1834,7 +1835,8 @@ static bool StatFileFd(char const * const msg, int const iFd, std::string const
 	 // higher-level code will generate more meaningful messages,
 	 // even translated this would be meaningless for users
 	 return _error->Errno("fstat", "Unable to determine %s for fd %i", msg, iFd);
-      ispipe = S_ISFIFO(Buf.st_mode);
+      if (FileName.empty() == false)
+	 ispipe = S_ISFIFO(Buf.st_mode);
    }
 
    // for compressor pipes st_size is undefined and at 'best' zero

+ 2 - 1
apt-pkg/deb/debsrcrecords.cc

@@ -239,7 +239,8 @@ bool debSrcRecordParser::Files(std::vector<pkgSrcRecords::File> &List)
 /* */
 debSrcRecordParser::~debSrcRecordParser()
 {
-   delete[] Buffer;
+   // was allocated via strndup()
+   free(Buffer);
 }
 									/*}}}*/
 

+ 2 - 1
apt-pkg/deb/dpkgpm.cc

@@ -1438,7 +1438,8 @@ bool pkgDPkgPM::GoNoABIBreak(APT::Progress::PackageManager *progress)
 
 	 if (_config->FindB("DPkg::FlushSTDIN",true) == true && isatty(STDIN_FILENO))
 	 {
-	    int Flags,dummy;
+	    int Flags;
+            int dummy = 0;
 	    if ((Flags = fcntl(STDIN_FILENO,F_GETFL,dummy)) < 0)
 	       _exit(100);
 	    

+ 2 - 2
apt-pkg/depcache.cc

@@ -1374,7 +1374,7 @@ bool pkgDepCache::IsInstallOkDependenciesSatisfiableByCandidates(PkgIterator con
 
 	 // the dependency is critical, but can't be installed, so discard the candidate
 	 // as the problemresolver will trip over it otherwise trying to install it (#735967)
-	 if (Pkg->CurrentVer != 0)
+	 if (Pkg->CurrentVer != 0 && (PkgState[Pkg->ID].iFlags & Protected) != Protected)
 	    SetCandidateVersion(Pkg.CurrentVer());
 	 return false;
       }
@@ -1678,7 +1678,7 @@ pkgCache::VerIterator pkgDepCache::Policy::GetCandidateVer(PkgIterator const &Pk
 {
    /* Not source/not automatic versions cannot be a candidate version 
       unless they are already installed */
-   VerIterator Last(*(pkgCache *)this,0);
+   VerIterator Last;
    
    for (VerIterator I = Pkg.VersionList(); I.end() == false; ++I)
    {

+ 59 - 10
apt-pkg/edsp.cc

@@ -18,6 +18,7 @@
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/cacheiterators.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/pkgrecords.h>
 
 #include <ctype.h>
 #include <stddef.h>
@@ -87,7 +88,12 @@ bool EDSP::WriteLimitedScenario(pkgDepCache &Cache, FILE* output,
 void EDSP::WriteScenarioVersion(pkgDepCache &Cache, FILE* output, pkgCache::PkgIterator const &Pkg,
 				pkgCache::VerIterator const &Ver)
 {
+   pkgRecords Recs(Cache);
+   pkgRecords::Parser &rec = Recs.Lookup(Ver.FileList());
+   string srcpkg = rec.SourcePkg().empty() ? Pkg.Name() : rec.SourcePkg();
+
    fprintf(output, "Package: %s\n", Pkg.Name());
+   fprintf(output, "Source: %s\n", srcpkg.c_str());
    fprintf(output, "Architecture: %s\n", Ver.Arch());
    fprintf(output, "Version: %s\n", Ver.VerStr());
    if (Pkg.CurrentVer() == Ver)
@@ -107,10 +113,22 @@ void EDSP::WriteScenarioVersion(pkgDepCache &Cache, FILE* output, pkgCache::PkgI
    else if ((Ver->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same)
       fprintf(output, "Multi-Arch: same\n");
    signed short Pin = std::numeric_limits<signed short>::min();
-   for (pkgCache::VerFileIterator File = Ver.FileList(); File.end() == false; ++File) {
-      signed short const p = Cache.GetPolicy().GetPriority(File.File());
+   std::set<string> Releases;
+   for (pkgCache::VerFileIterator I = Ver.FileList(); I.end() == false; ++I) {
+      pkgCache::PkgFileIterator File = I.File();
+      signed short const p = Cache.GetPolicy().GetPriority(File);
       if (Pin < p)
 	 Pin = p;
+      if ((File->Flags & pkgCache::Flag::NotSource) != pkgCache::Flag::NotSource) {
+	 string Release = File.RelStr();
+	 if (!Release.empty())
+	    Releases.insert(Release);
+      }
+   }
+   if (!Releases.empty()) {
+       fprintf(output, "APT-Release:\n");
+       for (std::set<string>::iterator R = Releases.begin(); R != Releases.end(); ++R)
+	   fprintf(output, " %s\n", R->c_str());
    }
    fprintf(output, "APT-Pin: %d\n", Pin);
    if (Cache.GetCandidateVer(Pkg) == Ver)
@@ -231,7 +249,16 @@ bool EDSP::WriteRequest(pkgDepCache &Cache, FILE* output, bool const Upgrade,
 	 continue;
       req->append(" ").append(Pkg.FullName());
    }
-   fprintf(output, "Request: EDSP 0.4\n");
+   fprintf(output, "Request: EDSP 0.5\n");
+
+   const char *arch = _config->Find("APT::Architecture").c_str();
+   std::vector<string> archs = APT::Configuration::getArchitectures();
+   fprintf(output, "Architecture: %s\n", arch);
+   fprintf(output, "Architectures:");
+   for (std::vector<string>::const_iterator a = archs.begin(); a != archs.end(); ++a)
+       fprintf(output, " %s", a->c_str());
+   fprintf(output, "\n");
+
    if (del.empty() == false)
       fprintf(output, "Remove: %s\n", del.c_str()+1);
    if (inst.empty() == false)
@@ -411,6 +438,13 @@ bool EDSP::ReadRequest(int const input, std::list<std::string> &install,
 	    distUpgrade = EDSP::StringToBool(line.c_str() + 14, false);
 	 else if (line.compare(0, 11, "Autoremove:") == 0)
 	    autoRemove = EDSP::StringToBool(line.c_str() + 12, false);
+	 else if (line.compare(0, 13, "Architecture:") == 0)
+	    _config->Set("APT::Architecture", line.c_str() + 14);
+	 else if (line.compare(0, 14, "Architectures:") == 0)
+	 {
+	    std::string const archs = line.c_str() + 15;
+	    _config->Set("APT::Architectures", SubstVar(archs, " ", ","));
+	 }
 	 else
 	    _error->Warning("Unknown line in EDSP Request stanza: %s", line.c_str());
 
@@ -508,7 +542,7 @@ bool EDSP::WriteError(char const * const uuid, std::string const &message, FILE*
 }
 									/*}}}*/
 // EDSP::ExecuteSolver - fork requested solver and setup ipc pipes	{{{*/
-bool EDSP::ExecuteSolver(const char* const solver, int *solver_in, int *solver_out) {
+pid_t EDSP::ExecuteSolver(const char* const solver, int * const solver_in, int * const solver_out, bool) {
 	std::vector<std::string> const solverDirs = _config->FindVector("Dir::Bin::Solvers");
 	std::string file;
 	for (std::vector<std::string>::const_iterator dir = solverDirs.begin();
@@ -520,10 +554,16 @@ bool EDSP::ExecuteSolver(const char* const solver, int *solver_in, int *solver_o
 	}
 
 	if (file.empty() == true)
-		return _error->Error("Can't call external solver '%s' as it is not in a configured directory!", solver);
+	{
+		_error->Error("Can't call external solver '%s' as it is not in a configured directory!", solver);
+		return 0;
+	}
 	int external[4] = {-1, -1, -1, -1};
 	if (pipe(external) != 0 || pipe(external + 2) != 0)
-		return _error->Errno("Resolve", "Can't create needed IPC pipes for EDSP");
+	{
+		_error->Errno("Resolve", "Can't create needed IPC pipes for EDSP");
+		return 0;
+	}
 	for (int i = 0; i < 4; ++i)
 		SetCloseExec(external[i], true);
 
@@ -540,11 +580,19 @@ bool EDSP::ExecuteSolver(const char* const solver, int *solver_in, int *solver_o
 	close(external[3]);
 
 	if (WaitFd(external[1], true, 5) == false)
-		return _error->Errno("Resolve", "Timed out while Waiting on availability of solver stdin");
+	{
+		_error->Errno("Resolve", "Timed out while Waiting on availability of solver stdin");
+		return 0;
+	}
 
 	*solver_in = external[1];
 	*solver_out = external[2];
-	return true;
+	return Solver;
+}
+bool EDSP::ExecuteSolver(const char* const solver, int *solver_in, int *solver_out) {
+   if (ExecuteSolver(solver, solver_in, solver_out, true) == 0)
+      return false;
+   return true;
 }
 									/*}}}*/
 // EDSP::ResolveExternal - resolve problems by asking external for help	{{{*/
@@ -552,7 +600,8 @@ bool EDSP::ResolveExternal(const char* const solver, pkgDepCache &Cache,
 			 bool const upgrade, bool const distUpgrade,
 			 bool const autoRemove, OpProgress *Progress) {
 	int solver_in, solver_out;
-	if (EDSP::ExecuteSolver(solver, &solver_in, &solver_out) == false)
+	pid_t const solver_pid = EDSP::ExecuteSolver(solver, &solver_in, &solver_out, true);
+	if (solver_pid == 0)
 		return false;
 
 	FILE* output = fdopen(solver_in, "w");
@@ -572,6 +621,6 @@ bool EDSP::ResolveExternal(const char* const solver, pkgDepCache &Cache,
 	if (EDSP::ReadResponse(solver_out, Cache, Progress) == false)
 		return false;
 
-	return true;
+	return ExecWait(solver_pid, solver);
 }
 									/*}}}*/

+ 3 - 3
apt-pkg/edsp.h

@@ -205,10 +205,10 @@ public:
 	 *  \param[out] solver_in will be the stdin of the solver
 	 *  \param[out] solver_out will be the stdout of the solver
 	 *
-	 *  \return true if the solver could be started and the pipes
-	 *  are set up correctly, otherwise false and the pipes are invalid
+	 *  \return PID of the started solver or 0 if failure occurred
 	 */
-	bool static ExecuteSolver(const char* const solver, int *solver_in, int *solver_out);
+	pid_t static ExecuteSolver(const char* const solver, int * const solver_in, int * const solver_out, bool /*overload*/);
+	APT_DEPRECATED bool static ExecuteSolver(const char* const solver, int *solver_in, int *solver_out);
 
 	/** \brief call an external resolver to handle the request
 	 *

+ 24 - 13
apt-pkg/srcrecords.cc

@@ -81,6 +81,27 @@ bool pkgSrcRecords::Restart()
    return true;
 }
 									/*}}}*/
+// SrcRecords::Step - Step to the next Source Record			/*{{{*/
+// ---------------------------------------------------------------------
+/* Step to the next source package record */
+const pkgSrcRecords::Parser* pkgSrcRecords::Step()
+{
+   if (Current == Files.end())
+      return 0;
+
+   // Step to the next record, possibly switching files
+   while ((*Current)->Step() == false)
+   {
+      if (_error->PendingError() == true)
+         return 0;
+      ++Current;
+      if (Current == Files.end())
+         return 0;
+   }
+
+   return *Current;
+}
+									/*}}}*/
 // SrcRecords::Find - Find the first source package with the given name	/*{{{*/
 // ---------------------------------------------------------------------
 /* This searches on both source package names and output binary names and
@@ -88,21 +109,11 @@ bool pkgSrcRecords::Restart()
    function to be called multiple times to get successive entries */
 pkgSrcRecords::Parser *pkgSrcRecords::Find(const char *Package,bool const &SrcOnly)
 {
-   if (Current == Files.end())
-      return 0;
-   
    while (true)
    {
-      // Step to the next record, possibly switching files
-      while ((*Current)->Step() == false)
-      {
-	 if (_error->PendingError() == true)
-	    return 0;
-	 ++Current;
-	 if (Current == Files.end())
-	    return 0;
-      }
-      
+      if(Step() == 0)
+         return 0;
+
       // IO error somehow
       if (_error->PendingError() == true)
 	 return 0;

+ 7 - 2
apt-pkg/srcrecords.h

@@ -105,8 +105,13 @@ class pkgSrcRecords
    // Reset the search
    bool Restart();
 
-   // Locate a package by name
-   Parser *Find(const char *Package,bool const &SrcOnly = false);
+   // Step to the next SourcePackage and return pointer to the 
+   // next SourceRecord. The pointer is owned by libapt.
+   const Parser* Step();
+
+   // Locate a package by name and return pointer to the Parser.
+   // The pointer is owned by libapt.
+   Parser* Find(const char *Package,bool const &SrcOnly = false);
    
    pkgSrcRecords(pkgSourceList &List);
    virtual ~pkgSrcRecords();

+ 5 - 0
apt-private/private-download.cc

@@ -28,6 +28,11 @@ bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser)
    if (UntrustedList == "")
       return true;
 
+   return AuthPrompt(UntrustedList, PromptUser);
+}
+
+bool AuthPrompt(std::string UntrustedList, bool const PromptUser)
+{
    ShowList(c2out,_("WARNING: The following packages cannot be authenticated!"),UntrustedList,"");
 
    if (_config->FindB("APT::Get::AllowUnauthenticated",false) == true)

+ 6 - 0
apt-private/private-download.h

@@ -5,7 +5,13 @@
 
 class pkgAcquire;
 
+// Check if all files in the fetcher are authenticated
 APT_PUBLIC bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser);
+
+// show a authentication warning prompt and return true if the system
+// should continue
+APT_PUBLIC bool AuthPrompt(std::string UntrustedList, bool const PromptUser);
+
 APT_PUBLIC bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure);
 
 #endif

+ 143 - 1
apt-private/private-install.cc

@@ -620,7 +620,8 @@ bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache,
       if (Fix != NULL)
       {
 	 // Call the scored problem resolver
-	 Fix->Resolve(true);
+	 if (Fix->Resolve(true) == false && Cache->BrokenCount() == 0)
+	    return false;
       }
 
       // Now we check the state of the packages,
@@ -828,3 +829,144 @@ bool DoInstall(CommandLine &CmdL)
    return InstallPackages(Cache,false);   
 }
 									/*}}}*/
+
+// TryToInstall - Mark a package for installation			/*{{{*/
+void TryToInstall::operator() (pkgCache::VerIterator const &Ver) {
+   pkgCache::PkgIterator Pkg = Ver.ParentPkg();
+
+   Cache->GetDepCache()->SetCandidateVersion(Ver);
+   pkgDepCache::StateCache &State = (*Cache)[Pkg];
+
+   // Handle the no-upgrade case
+   if (_config->FindB("APT::Get::upgrade",true) == false && Pkg->CurrentVer != 0)
+      ioprintf(c1out,_("Skipping %s, it is already installed and upgrade is not set.\n"),
+	    Pkg.FullName(true).c_str());
+   // Ignore request for install if package would be new
+   else if (_config->FindB("APT::Get::Only-Upgrade", false) == true && Pkg->CurrentVer == 0)
+      ioprintf(c1out,_("Skipping %s, it is not installed and only upgrades are requested.\n"),
+	    Pkg.FullName(true).c_str());
+   else {
+      if (Fix != NULL) {
+	 Fix->Clear(Pkg);
+	 Fix->Protect(Pkg);
+      }
+      Cache->GetDepCache()->MarkInstall(Pkg,false);
+
+      if (State.Install() == false) {
+	 if (_config->FindB("APT::Get::ReInstall",false) == true) {
+	    if (Pkg->CurrentVer == 0 || Pkg.CurrentVer().Downloadable() == false)
+	       ioprintf(c1out,_("Reinstallation of %s is not possible, it cannot be downloaded.\n"),
+		     Pkg.FullName(true).c_str());
+	    else
+	       Cache->GetDepCache()->SetReInstall(Pkg, true);
+	 } else
+	    ioprintf(c1out,_("%s is already the newest version.\n"),
+		  Pkg.FullName(true).c_str());
+      }
+
+      // Install it with autoinstalling enabled (if we not respect the minial
+      // required deps or the policy)
+      if (FixBroken == false)
+	 doAutoInstallLater.insert(Pkg);
+   }
+
+   // see if we need to fix the auto-mark flag
+   // e.g. apt-get install foo
+   // where foo is marked automatic
+   if (State.Install() == false &&
+	 (State.Flags & pkgCache::Flag::Auto) &&
+	 _config->FindB("APT::Get::ReInstall",false) == false &&
+	 _config->FindB("APT::Get::Only-Upgrade",false) == false &&
+	 _config->FindB("APT::Get::Download-Only",false) == false)
+   {
+      ioprintf(c1out,_("%s set to manually installed.\n"),
+	    Pkg.FullName(true).c_str());
+      Cache->GetDepCache()->MarkAuto(Pkg,false);
+      AutoMarkChanged++;
+   }
+}
+									/*}}}*/
+bool TryToInstall::propergateReleaseCandiateSwitching(std::list<std::pair<pkgCache::VerIterator, std::string> > const &start, std::ostream &out)/*{{{*/
+{
+   for (std::list<std::pair<pkgCache::VerIterator, std::string> >::const_iterator s = start.begin();
+	 s != start.end(); ++s)
+      Cache->GetDepCache()->SetCandidateVersion(s->first);
+
+   bool Success = true;
+   // the Changed list contains:
+   //   first: "new version"
+   //   second: "what-caused the change"
+   std::list<std::pair<pkgCache::VerIterator, pkgCache::VerIterator> > Changed;
+   for (std::list<std::pair<pkgCache::VerIterator, std::string> >::const_iterator s = start.begin();
+	 s != start.end(); ++s)
+   {
+      Changed.push_back(std::make_pair(s->first, pkgCache::VerIterator(*Cache)));
+      // We continue here even if it failed to enhance the ShowBroken output
+      Success &= Cache->GetDepCache()->SetCandidateRelease(s->first, s->second, Changed);
+   }
+   for (std::list<std::pair<pkgCache::VerIterator, pkgCache::VerIterator> >::const_iterator c = Changed.begin();
+	 c != Changed.end(); ++c)
+   {
+      if (c->second.end() == true)
+	 ioprintf(out, _("Selected version '%s' (%s) for '%s'\n"),
+	       c->first.VerStr(), c->first.RelStr().c_str(), c->first.ParentPkg().FullName(true).c_str());
+      else if (c->first.ParentPkg()->Group != c->second.ParentPkg()->Group)
+      {
+	 pkgCache::VerIterator V = (*Cache)[c->first.ParentPkg()].CandidateVerIter(*Cache);
+	 ioprintf(out, _("Selected version '%s' (%s) for '%s' because of '%s'\n"), V.VerStr(),
+	       V.RelStr().c_str(), V.ParentPkg().FullName(true).c_str(), c->second.ParentPkg().FullName(true).c_str());
+      }
+   }
+   return Success;
+}
+									/*}}}*/
+void TryToInstall::doAutoInstall() {					/*{{{*/
+   for (APT::PackageSet::const_iterator P = doAutoInstallLater.begin();
+	 P != doAutoInstallLater.end(); ++P) {
+      pkgDepCache::StateCache &State = (*Cache)[P];
+      if (State.InstBroken() == false && State.InstPolicyBroken() == false)
+	 continue;
+      Cache->GetDepCache()->MarkInstall(P, true);
+   }
+   doAutoInstallLater.clear();
+}
+									/*}}}*/
+// TryToRemove - Mark a package for removal				/*{{{*/
+void TryToRemove::operator() (pkgCache::VerIterator const &Ver)
+{
+   pkgCache::PkgIterator Pkg = Ver.ParentPkg();
+
+   if (Fix != NULL)
+   {
+      Fix->Clear(Pkg);
+      Fix->Protect(Pkg);
+      Fix->Remove(Pkg);
+   }
+
+   if ((Pkg->CurrentVer == 0 && PurgePkgs == false) ||
+	 (PurgePkgs == true && Pkg->CurrentState == pkgCache::State::NotInstalled))
+   {
+      pkgCache::GrpIterator Grp = Pkg.Group();
+      pkgCache::PkgIterator P = Grp.PackageList();
+      for (; P.end() != true; P = Grp.NextPkg(P))
+      {
+	 if (P == Pkg)
+	    continue;
+	 if (P->CurrentVer != 0 || (PurgePkgs == true && P->CurrentState != pkgCache::State::NotInstalled))
+	 {
+	    // TRANSLATORS: Note, this is not an interactive question
+	    ioprintf(c1out,_("Package '%s' is not installed, so not removed. Did you mean '%s'?\n"),
+		  Pkg.FullName(true).c_str(), P.FullName(true).c_str());
+	    break;
+	 }
+      }
+      if (P.end() == true)
+	 ioprintf(c1out,_("Package '%s' is not installed, so not removed\n"),Pkg.FullName(true).c_str());
+
+      // MarkInstall refuses to install packages on hold
+      Pkg->SelectedState = pkgCache::State::Hold;
+   }
+   else
+      Cache->GetDepCache()->MarkDelete(Pkg, PurgePkgs);
+}
+									/*}}}*/

+ 7 - 149
apt-private/private-install.h

@@ -3,28 +3,18 @@
 
 #include <apt-pkg/cachefile.h>
 #include <apt-pkg/configuration.h>
-#include <apt-pkg/depcache.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/cacheiterators.h>
 #include <apt-pkg/cacheset.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/algorithms.h>
 #include <apt-pkg/macros.h>
 
-#include <apt-private/private-output.h>
-
-#include <stddef.h>
-#include <iosfwd>
 #include <list>
-#include <map>
 #include <string>
 #include <utility>
 
-
-#include <apti18n.h>
-
 class CacheFile;
 class CommandLine;
+class pkgProblemResolver;
 
 #define RAMFS_MAGIC     0x858458f6
 
@@ -39,7 +29,7 @@ APT_PUBLIC bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
 
 
 // TryToInstall - Mark a package for installation			/*{{{*/
-struct TryToInstall {
+struct APT_PUBLIC TryToInstall {
    pkgCacheFile* Cache;
    pkgProblemResolver* Fix;
    bool FixBroken;
@@ -49,109 +39,13 @@ struct TryToInstall {
    TryToInstall(pkgCacheFile &Cache, pkgProblemResolver *PM, bool const FixBroken) : Cache(&Cache), Fix(PM),
 			FixBroken(FixBroken), AutoMarkChanged(0) {};
 
-   void operator() (pkgCache::VerIterator const &Ver) {
-      pkgCache::PkgIterator Pkg = Ver.ParentPkg();
-
-      Cache->GetDepCache()->SetCandidateVersion(Ver);
-      pkgDepCache::StateCache &State = (*Cache)[Pkg];
-
-      // Handle the no-upgrade case
-      if (_config->FindB("APT::Get::upgrade",true) == false && Pkg->CurrentVer != 0)
-	 ioprintf(c1out,_("Skipping %s, it is already installed and upgrade is not set.\n"),
-		  Pkg.FullName(true).c_str());
-      // Ignore request for install if package would be new
-      else if (_config->FindB("APT::Get::Only-Upgrade", false) == true && Pkg->CurrentVer == 0)
-	 ioprintf(c1out,_("Skipping %s, it is not installed and only upgrades are requested.\n"),
-		  Pkg.FullName(true).c_str());
-      else {
-	 if (Fix != NULL) {
-	    Fix->Clear(Pkg);
-	    Fix->Protect(Pkg);
-	 }
-	 Cache->GetDepCache()->MarkInstall(Pkg,false);
-
-	 if (State.Install() == false) {
-	    if (_config->FindB("APT::Get::ReInstall",false) == true) {
-	       if (Pkg->CurrentVer == 0 || Pkg.CurrentVer().Downloadable() == false)
-		  ioprintf(c1out,_("Reinstallation of %s is not possible, it cannot be downloaded.\n"),
-			   Pkg.FullName(true).c_str());
-	       else
-		  Cache->GetDepCache()->SetReInstall(Pkg, true);
-	    } else
-	       ioprintf(c1out,_("%s is already the newest version.\n"),
-			Pkg.FullName(true).c_str());
-	 }
-
-	 // Install it with autoinstalling enabled (if we not respect the minial
-	 // required deps or the policy)
-	 if (FixBroken == false)
-	    doAutoInstallLater.insert(Pkg);
-      }
-
-      // see if we need to fix the auto-mark flag
-      // e.g. apt-get install foo
-      // where foo is marked automatic
-      if (State.Install() == false &&
-	  (State.Flags & pkgCache::Flag::Auto) &&
-	  _config->FindB("APT::Get::ReInstall",false) == false &&
-	  _config->FindB("APT::Get::Only-Upgrade",false) == false &&
-	  _config->FindB("APT::Get::Download-Only",false) == false)
-      {
-	 ioprintf(c1out,_("%s set to manually installed.\n"),
-		  Pkg.FullName(true).c_str());
-	 Cache->GetDepCache()->MarkAuto(Pkg,false);
-	 AutoMarkChanged++;
-      }
-   }
-
-   bool propergateReleaseCandiateSwitching(std::list<std::pair<pkgCache::VerIterator, std::string> > start, std::ostream &out)
-   {
-      for (std::list<std::pair<pkgCache::VerIterator, std::string> >::const_iterator s = start.begin();
-		s != start.end(); ++s)
-	 Cache->GetDepCache()->SetCandidateVersion(s->first);
-
-      bool Success = true;
-      // the Changed list contains:
-      //   first: "new version" 
-      //   second: "what-caused the change" 
-      std::list<std::pair<pkgCache::VerIterator, pkgCache::VerIterator> > Changed;
-      for (std::list<std::pair<pkgCache::VerIterator, std::string> >::const_iterator s = start.begin();
-		s != start.end(); ++s)
-      {
-	 Changed.push_back(std::make_pair(s->first, pkgCache::VerIterator(*Cache)));
-	 // We continue here even if it failed to enhance the ShowBroken output
-	 Success &= Cache->GetDepCache()->SetCandidateRelease(s->first, s->second, Changed);
-      }
-      for (std::list<std::pair<pkgCache::VerIterator, pkgCache::VerIterator> >::const_iterator c = Changed.begin();
-	   c != Changed.end(); ++c)
-      {
-	 if (c->second.end() == true)
-	    ioprintf(out, _("Selected version '%s' (%s) for '%s'\n"),
-		     c->first.VerStr(), c->first.RelStr().c_str(), c->first.ParentPkg().FullName(true).c_str());
-	 else if (c->first.ParentPkg()->Group != c->second.ParentPkg()->Group)
-	 {
-	    pkgCache::VerIterator V = (*Cache)[c->first.ParentPkg()].CandidateVerIter(*Cache);
-	    ioprintf(out, _("Selected version '%s' (%s) for '%s' because of '%s'\n"), V.VerStr(),
-		     V.RelStr().c_str(), V.ParentPkg().FullName(true).c_str(), c->second.ParentPkg().FullName(true).c_str());
-	 }
-      }
-      return Success;
-   }
-
-   void doAutoInstall() {
-      for (APT::PackageSet::const_iterator P = doAutoInstallLater.begin();
-	   P != doAutoInstallLater.end(); ++P) {
-	 pkgDepCache::StateCache &State = (*Cache)[P];
-	 if (State.InstBroken() == false && State.InstPolicyBroken() == false)
-	    continue;
-	 Cache->GetDepCache()->MarkInstall(P, true);
-      }
-      doAutoInstallLater.clear();
-   }
+   void operator() (pkgCache::VerIterator const &Ver);
+   bool propergateReleaseCandiateSwitching(std::list<std::pair<pkgCache::VerIterator, std::string> > const &start, std::ostream &out);
+   void doAutoInstall();
 };
 									/*}}}*/
 // TryToRemove - Mark a package for removal				/*{{{*/
-struct TryToRemove {
+struct APT_PUBLIC TryToRemove {
    pkgCacheFile* Cache;
    pkgProblemResolver* Fix;
    bool PurgePkgs;
@@ -159,43 +53,7 @@ struct TryToRemove {
    TryToRemove(pkgCacheFile &Cache, pkgProblemResolver *PM) : Cache(&Cache), Fix(PM),
 				PurgePkgs(_config->FindB("APT::Get::Purge", false)) {};
 
-   void operator() (pkgCache::VerIterator const &Ver)
-   {
-      pkgCache::PkgIterator Pkg = Ver.ParentPkg();
-
-      if (Fix != NULL)
-      {
-	 Fix->Clear(Pkg);
-	 Fix->Protect(Pkg);
-	 Fix->Remove(Pkg);
-      }
-
-      if ((Pkg->CurrentVer == 0 && PurgePkgs == false) ||
-	  (PurgePkgs == true && Pkg->CurrentState == pkgCache::State::NotInstalled))
-      {
-	 pkgCache::GrpIterator Grp = Pkg.Group();
-	 pkgCache::PkgIterator P = Grp.PackageList();
-	 for (; P.end() != true; P = Grp.NextPkg(P))
-	 {
-	    if (P == Pkg)
-	       continue;
-	    if (P->CurrentVer != 0 || (PurgePkgs == true && P->CurrentState != pkgCache::State::NotInstalled))
-	    {
-	       // TRANSLATORS: Note, this is not an interactive question
-	       ioprintf(c1out,_("Package '%s' is not installed, so not removed. Did you mean '%s'?\n"),
-			Pkg.FullName(true).c_str(), P.FullName(true).c_str());
-	       break;
-	    }
-	 }
-	 if (P.end() == true)
-	    ioprintf(c1out,_("Package '%s' is not installed, so not removed\n"),Pkg.FullName(true).c_str());
-
-	 // MarkInstall refuses to install packages on hold
-	 Pkg->SelectedState = pkgCache::State::Hold;
-      }
-      else
-	 Cache->GetDepCache()->MarkDelete(Pkg, PurgePkgs);
-   }
+   void operator() (pkgCache::VerIterator const &Ver);
 };
 									/*}}}*/
 

+ 1 - 1
apt-private/private-output.cc

@@ -94,7 +94,7 @@ bool InitOutput()							/*{{{*/
 static std::string GetArchiveSuite(pkgCacheFile &/*CacheFile*/, pkgCache::VerIterator ver) /*{{{*/
 {
    std::string suite = "";
-   if (ver && ver.FileList() && ver.FileList())
+   if (ver && ver.FileList())
    {
       pkgCache::VerFileIterator VF = ver.FileList();
       for (; VF.end() == false ; ++VF)

+ 18 - 0
apt-private/private-update.cc

@@ -75,6 +75,24 @@ bool DoUpdate(CommandLine &CmdL)
 	 return false;
    }
 
+   // show basic stats (if the user whishes)
+   if (_config->FindB("APT::Cmd::Show-Update-Stats", false) == true)
+   {
+      int upgradable = 0;
+      Cache.Open();
+      for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() != true; ++I)
+      {
+         pkgDepCache::StateCache &state = Cache[I];
+         if (I->CurrentVer != 0 && state.Upgradable())
+            upgradable++;
+      }
+      const char *msg = ngettext(
+         "%i package can be upgraded. Run 'apt list --upgradable' to see it.\n",
+         "%i packages can be upgraded. Run 'apt list --upgradable' to see them.\n",
+         upgradable);
+      ioprintf(c1out, msg, upgradable);
+   }
+
    return true;
 }
 									/*}}}*/

+ 1 - 1
cmdline/apt-cache.cc

@@ -507,7 +507,7 @@ static bool DumpAvail(CommandLine &)
 	 break;
       }
 
-      FileFd PkgF(File.FileName(),FileFd::ReadOnly);
+      FileFd PkgF(File.FileName(),FileFd::ReadOnly, FileFd::Extension);
       if (_error->PendingError() == true)
 	 break;
       

+ 9 - 0
cmdline/apt-get.cc

@@ -76,6 +76,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <sys/statfs.h>
 #include <sys/statvfs.h>
@@ -755,6 +756,7 @@ static bool DoSource(CommandLine &CmdL)
 
    // Load the requestd sources into the fetcher
    unsigned J = 0;
+   std::string UntrustedList;
    for (const char **I = CmdL.FileList + 1; *I != 0; I++, J++)
    {
       string Src;
@@ -763,6 +765,9 @@ static bool DoSource(CommandLine &CmdL)
       if (Last == 0) {
 	 return _error->Error(_("Unable to find a source package for %s"),Src.c_str());
       }
+
+      if (Last->Index().IsTrusted() == false)
+         UntrustedList += Src + " ";
       
       string srec = Last->AsStr();
       string::size_type pos = srec.find("\nVcs-");
@@ -848,6 +853,10 @@ static bool DoSource(CommandLine &CmdL)
 			I->Hashes, I->Size, Last->Index().SourceInfo(*Last,*I), Src);
       }
    }
+
+   // check authentication status of the source as well
+   if (UntrustedList != "" && !AuthPrompt(UntrustedList, false))
+      return false;
    
    // Display statistics
    unsigned long long FetchBytes = Fetcher.FetchNeeded();

+ 2 - 1
cmdline/apt-helper.cc

@@ -43,7 +43,8 @@ static bool DoDownloadFile(CommandLine &CmdL)
    std::string hash;
    if (CmdL.FileSize() > 3)
       hash = CmdL.FileList[3];
-   new pkgAcqFile(&Fetcher, download_uri, hash, 0, "desc", "short-desc", 
+   // we use download_uri as descr and targetfile as short-descr
+   new pkgAcqFile(&Fetcher, download_uri, hash, 0, download_uri, targetfile, 
                   "dest-dir-ignored", targetfile);
    Fetcher.Run();
    bool Failed = false;

+ 18 - 18
cmdline/apt-internal-solver.cc

@@ -31,6 +31,7 @@
 #include <string>
 #include <unistd.h>
 #include <cstdio>
+#include <stdlib.h>
 
 #include <apti18n.h>
 									/*}}}*/
@@ -56,6 +57,12 @@ static bool ShowHelp(CommandLine &) {
 	return true;
 }
 									/*}}}*/
+APT_NORETURN static void DIE(std::string const &message) {		/*{{{*/
+	std::cerr << "ERROR: " << message << std::endl;
+	_error->DumpErrors(std::cerr);
+	exit(EXIT_FAILURE);
+}
+									/*}}}*/
 int main(int argc,const char *argv[])					/*{{{*/
 {
 	CommandLine::Args Args[] = {
@@ -115,34 +122,29 @@ int main(int argc,const char *argv[])					/*{{{*/
 
 	EDSP::WriteProgress(0, "Start up solver…", output);
 
-	if (pkgInitSystem(*_config,_system) == false) {
-		std::cerr << "System could not be initialized!" << std::endl;
-		return 1;
-	}
+	if (pkgInitSystem(*_config,_system) == false)
+		DIE("System could not be initialized!");
 
 	EDSP::WriteProgress(1, "Read request…", output);
 
 	if (WaitFd(input, false, 5) == false)
-		std::cerr << "WAIT timed out in the resolver" << std::endl;
+		DIE("WAIT timed out in the resolver");
 
 	std::list<std::string> install, remove;
 	bool upgrade, distUpgrade, autoRemove;
-	if (EDSP::ReadRequest(input, install, remove, upgrade, distUpgrade, autoRemove) == false) {
-		std::cerr << "Parsing the request failed!" << std::endl;
-		return 2;
-	}
+	if (EDSP::ReadRequest(input, install, remove, upgrade, distUpgrade, autoRemove) == false)
+		DIE("Parsing the request failed!");
 
 	EDSP::WriteProgress(5, "Read scenario…", output);
 
 	pkgCacheFile CacheFile;
-	CacheFile.Open(NULL, false);
+	if (CacheFile.Open(NULL, false) == false)
+		DIE("Failed to open CacheFile!");
 
 	EDSP::WriteProgress(50, "Apply request on scenario…", output);
 
-	if (EDSP::ApplyRequest(install, remove, CacheFile) == false) {
-		std::cerr << "Failed to apply request to depcache!" << std::endl;
-		return 3;
-	}
+	if (EDSP::ApplyRequest(install, remove, CacheFile) == false)
+		DIE("Failed to apply request to depcache!");
 
 	pkgProblemResolver Fix(CacheFile);
 	for (std::list<std::string>::const_iterator i = remove.begin();
@@ -183,10 +185,8 @@ int main(int argc,const char *argv[])					/*{{{*/
 
 	EDSP::WriteProgress(95, "Write solution…", output);
 
-	if (EDSP::WriteSolution(CacheFile, output) == false) {
-		std::cerr << "Failed to output the solution!" << std::endl;
-		return 4;
-	}
+	if (EDSP::WriteSolution(CacheFile, output) == false)
+		DIE("Failed to output the solution!");
 
 	EDSP::WriteProgress(100, "Done", output);
 

+ 1 - 0
cmdline/apt.cc

@@ -116,6 +116,7 @@ int main(int argc, const char *argv[])					/*{{{*/
    _config->CndSet("DPkg::Progress-Fancy", "1");
    _config->CndSet("Apt::Color", "1");
    _config->CndSet("APT::Get::Upgrade-Allow-New", true);
+   _config->CndSet("APT::Cmd::Show-Update-Stats", true);
 
    // Parse the command line and initialize the package library
    CommandLine CmdL(Args.data(), _config);

+ 12 - 5
configure.ac

@@ -6,10 +6,10 @@ dnl code more portable
 
 dnl You MUST have an environment that has all the POSIX functions and
 dnl some of the more popular bsd/sysv ones (like select). You'll also
-dnl need a C++ compiler that is semi-standard conformant, exceptions are 
+dnl need a C++ compiler that is semi-standard conformant, exceptions are
 dnl not used but STL is.
 
-dnl 'make -f Makefile startup' will generate the configure file from 
+dnl 'make -f Makefile startup' will generate the configure file from
 dnl configure.ac correctly and can be run at any time
 
 AC_PREREQ(2.50)
@@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib)
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
 
 PACKAGE="apt"
-PACKAGE_VERSION="1.0.3"
+PACKAGE_VERSION="1.0.4"
 PACKAGE_MAIL="APT Development Team <deity@lists.debian.org>"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"$PACKAGE_VERSION")
@@ -53,7 +53,7 @@ AC_SEARCH_LIBS(connect,socket)
 SOCKETLIBS="$LIBS"
 AC_SUBST(SOCKETLIBS)
 LIBS="$SAVE_LIBS"
- 
+
 dnl Checks for pthread -- disabled due to glibc bugs jgg
 dnl AC_CHECK_LIB(pthread, pthread_create,[AC_DEFINE(HAVE_PTHREAD) PTHREADLIB="-lpthread"])
 AC_SUBST(PTHREADLIB)
@@ -89,6 +89,13 @@ AC_CHECK_LIB(curl, curl_easy_init,
      AC_MSG_ERROR([failed: I need CURL due https support]),
 )
 
+AC_LANG_PUSH([C++])
+AC_CHECK_HEADER(gtest/gtest.h,,
+     AC_MSG_ERROR([failed: I need gtest to build tests]),
+)
+AC_LANG_POP([C++])
+
+
 AC_SUBST(BDBLIB)
 
 HAVE_ZLIB=no
@@ -160,7 +167,7 @@ dnl HP-UX needs -d_XOPEN_SOURCE_EXTENDED for h_errno
 AC_MSG_CHECKING(for h_errno)
 AC_EGREP_HEADER(h_errno, netdb.h, [AC_MSG_RESULT(normal)],
    [CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
-    AC_EGREP_HEADER(h_errno, netdb.h, 
+    AC_EGREP_HEADER(h_errno, netdb.h,
        [AC_MSG_RESULT(needs _XOPEN_SOURCE_EXTENDED)],
        [AC_MSG_ERROR("not found.")])
    ])

+ 41 - 0
debian/changelog

@@ -11,6 +11,47 @@ apt (1.1~exp1) UNRELEASED; urgency=low
 
  -- Michael Vogt <michael.vogt@ubuntu.com>  Wed, 07 May 2014 17:48:24 +0200
 
+apt (1.0.4) unstable; urgency=low
+
+  [ Michael Vogt ]
+  * Implement CacheDB for source packages in apt-ftparchive
+  * apt-private/acqprogress.cc: reset color in apt update
+  * Show progress in run-tests
+  * Never parse Version/Architecture tags in a Translation-$lang file
+  * Show upgradable packages after apt update (Closes: 748389)
+  * Fix various errors found by clang -fsanitize=address
+  * Fix various errors foudn by clang scan-build
+  * Show unauthenticated warning for source packages as well (Closes: #749795)
+  * Add compat mode for old (32bit FileSize) CacheDB (LP: #1274466)
+  * cmdline/apt-helper.cc: use less generic description/short-description 
+    in apt-helper download
+  * add pkgSrcRecords::Step() to step through all the pkgSrcRecords
+    (thanks to Helmut Grohne)
+
+  [ David Kalnischkies ]
+  * initialize Verify in second pkgAcqIndex constructor
+  * consistently fail if Smart* packagemanager actions fail
+  * fix tight loop detection and temporary removes
+  * if Resolver fails, do not continue even if not broken
+  * check exit status of external solvers
+  * do not revert candidate for protected packages (Closes: 745046)
+  * support Acquire::GzipIndexes in dumpavail (Closes: 742835)
+
+  [ Stefano Zacchiroli ]
+  * EDSP doc: fix typo in Request stanza description
+  * EDSP: bump protocol version to 0.5
+  * EDSP: add Architecture(s) multi-arch fields to the Request stanza
+  * EDSP: add Source field to Package stanzas
+  * EDSP: add APT-Release field to Package stanzas
+
+  [ Sebastian Schmidt ]
+  * fix screen width detection for apt/apt-get lists (Closes: 748430, 747942)
+
+  [ Milo Casagrande ]
+  * Italian program translation update (Closes: 750009)
+
+ -- Michael Vogt <mvo@debian.org>  Tue, 10 Jun 2014 14:55:05 +0200
+
 apt (1.0.3) unstable; urgency=medium
 
   [ Michael Vogt ]

+ 1 - 1
debian/libapt-inst1.5.symbols

@@ -88,4 +88,4 @@ libapt-inst.so.1.5 libapt-inst1.5 #MINVER#
  (c++|regex|optional=std)"^std::basic_string<.+ >\(.+\)@Base$" 0.8.0
  (c++|regex|optional=std)"^typeinfo name for std::iterator<.*>@Base$" 0.8.0
  (c++|regex|optional=std)"^typeinfo for std::iterator<.*>@Base$" 0.8.0
-###
+ (c++|optional=std)"std::ctype<char>::do_widen(char) const@Base" 1.0.3

Plik diff jest za duży
+ 32 - 20
debian/libapt-pkg4.13.symbols


+ 1 - 1
debian/tests/control

@@ -1,3 +1,3 @@
 Tests: run-tests
 Restrictions: allow-stderr 
-Depends: @, build-essential, fakeroot, wget, dpkg-dev, debhelper, libdb-dev, gettext, libcurl4-gnutls-dev, zlib1g-dev, libbz2-dev, xsltproc, docbook-xsl, docbook-xml, po4a, autotools-dev, autoconf, automake, doxygen, debiandoc-sgml, stunnel4, libdb-dev
+Depends: @, build-essential, fakeroot, wget, dpkg-dev, debhelper, libdb-dev, gettext, libcurl4-gnutls-dev, zlib1g-dev, libbz2-dev, xsltproc, docbook-xsl, docbook-xml, po4a, autotools-dev, autoconf, automake, doxygen, debiandoc-sgml, stunnel4, libdb-dev, db-util

+ 1 - 0
debian/tests/run-tests

@@ -12,6 +12,7 @@ make -C test/interactive-helper/
 APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR=$(pwd)/build/bin \
 APT_INTEGRATION_TESTS_METHODS_DIR=/usr/lib/apt/methods \
 APT_INTEGRATION_TESTS_LIBEXEC_DIR=/usr/lib/apt/ \
+APT_INTEGRATION_TESTS_INTERNAL_SOLVER=/usr/lib/apt/solvers/apt \
 APT_INTEGRATION_TESTS_BUILD_DIR=/usr/bin \
 APT_INTEGRATION_TESTS_LIBRARY_PATH=/dev/null/does/not/exist \
 ./test/integration/run-tests

+ 1 - 1
doc/apt-verbatim.ent

@@ -225,7 +225,7 @@
 ">
 
 <!-- this will be updated by 'prepare-release' -->
-<!ENTITY apt-product-version "1.0.3">
+<!ENTITY apt-product-version "1.0.4">
 
 <!-- (Code)names for various things used all over the place -->
 <!ENTITY oldstable-codename "squeeze">

+ 24 - 7
doc/external-dependency-solver-protocol.txt

@@ -1,4 +1,4 @@
-# APT External Dependency Solver Protocol (EDSP) - version 0.4
+# APT External Dependency Solver Protocol (EDSP) - version 0.5
 
 This document describes the communication protocol between APT and
 external dependency solvers. The protocol is called APT EDSP, for "APT
@@ -110,16 +110,24 @@ Within a dependency solving scenario, a request represents the action on
 installed packages requested by the user.
 
 A request is a single Deb 822 stanza opened by a mandatory Request field
-and followed by a mixture of action and preference fields.
+and followed by a mixture of action, preference, and global
+configuration fields.
 
 The value of the **Request:** field is a string describing the EDSP
 protocol which will be used to communicate. At present, the string must
-be `EDSP 0.4`.
+be `EDSP 0.5`. Request fields are mainly used to identify the beginning
+of a request stanza; their actual values are otherwise not used by the
+EDSP protocol.
 
-a unique request identifier, such as an
-UUID. Request fields are mainly used to identify the beginning of a
-request stanza; their actual values are otherwise not used by the EDSP
-protocol.
+The following **configuration fields** are supported in request stanzas:
+
+- **Architecture:** (mandatory) The name of the *native* architecture on
+  the user machine (see also: `dpkg --print-architecture`)
+
+- **Architectures:** (optional, defaults to the native architecture) A
+  space separated list of *all* architectures known to APT (this is
+  roughly equivalent to the union of `dpkg --print-architecture` and
+  `dpkg --print-foreign-architectures`)
 
 The following **action fields** are supported in request stanzas:
 
@@ -201,6 +209,15 @@ field. The following fields are supported in package stanzas:
   should be removed by the solver only when the Autoremove action is
   requested (see Request section).
 
+- **APT-Release:** (optional) The releases the package belongs to, according to
+  APT. The format of this field is multiline with one value per line and the
+  first line (the one containing the field name) empty. Each subsequent line
+  corresponds to one of the releases the package belongs to and looks like
+  this: `o=Debian,a=unstable,n=sid,l=Debian,c=main`. That is, each release line
+  is a comma-separated list of "key=value" pairs, each of which denotes a
+  Release file entry (Origin, Label, Codename, etc.) in the format of
+  APT_PREFERENCES(5).
+
 ### Answer
 
 An answer from the external solver to APT is either a *solution* or an

+ 2 - 2
doc/po/apt-doc.pot

@@ -6,9 +6,9 @@
 #, fuzzy
 msgid ""
 msgstr ""
-"Project-Id-Version: apt-doc 1.0.3\n"
+"Project-Id-Version: apt-doc 1.0.4~20140610\n"
 "Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n"
-"POT-Creation-Date: 2014-05-05 16:26+0200\n"
+"POT-Creation-Date: 2014-06-10 15:59+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"

+ 61 - 60
doc/po/de.po

@@ -1,14 +1,14 @@
-# Translation of apt-doc to German
+# Translation of apt/doc to German
 # Copyright (C) 1997, 1998, 1999 Jason Gunthorpe and others.
-# This file is distributed under the same license as the apt-doc package.
+# This file is distributed under the same license as the apt package.
 # Chris Leick <c.leick@vollbio.de>, 2009-2014.
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: apt-doc 0.9.16\n"
+"Project-Id-Version: apt-doc 1.0.4\n"
 "Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n"
 "POT-Creation-Date: 2014-05-05 16:26+0200\n"
-"PO-Revision-Date: 2014-04-01 14:00+0200\n"
+"PO-Revision-Date: 2014-06-12 20:31+0100\n"
 "Last-Translator: Chris Leick <c.leick@vollbio.de>\n"
 "Language-Team: German <debian-l10n-german@lists.debian.org>\n"
 "Language: de\n"
@@ -633,7 +633,7 @@ msgstr "APT"
 #. type: Content of: <refentry><refnamediv><refpurpose>
 #: apt.8.xml:32
 msgid "command-line interface"
-msgstr ""
+msgstr "Befehlszeilenschnittstelle"
 
 #. type: Content of: <refentry><refsect1><title>
 #: apt.8.xml:37 apt-get.8.xml:40 apt-cache.8.xml:40 apt-key.8.xml:39
@@ -652,6 +652,11 @@ msgid ""
 "management of the system.  See also &apt-get; and &apt-cache; for more low-"
 "level command options."
 msgstr ""
+"<command>apt</command> (Advanced Package Tool, auf Deutsch »fortschrittliches "
+"Paketwerkzeug«) ist das Befehlszeilenwerkzeug für den Umgang mit Paketen. Es "
+"stellt eine Befehlszeilenschnittstelle zur Verwaltung von Paketen auf dem "
+"System bereit. Weitere untergeordnete Befehlsoptionen finden sie unter "
+"&apt-get; und &apt-cache;."
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt.8.xml:47
@@ -661,6 +666,10 @@ msgid ""
 "<option>--installed</option>, <option>--upgradable</option>, <option>--all-"
 "versions</option> are supported."
 msgstr ""
+"<literal>list</literal> wird benutzt, um eine Paketliste anzuzeigen. Es "
+"unterstützt Shell-Muster zur Beschränkung auf passende Paketnamen. Die "
+"folgenden Optionen werden unterstützt: <option>--installed</option>, "
+"<option>--upgradable</option>, <option>--all-versions</option>."
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt.8.xml:58
@@ -668,19 +677,17 @@ msgid ""
 "<literal>search</literal> searches for the given term(s) and display "
 "matching packages."
 msgstr ""
+"<literal>search</literal> sucht nach angegebenen Begriffen und zeigt passende "
+"Pakete an."
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt.8.xml:64
-#, fuzzy
-#| msgid ""
-#| "<literal>rdepends</literal> shows a listing of each reverse dependency a "
-#| "package has."
 msgid ""
 "<literal>show</literal> shows the package information for the given "
 "package(s)."
 msgstr ""
-"<literal>rdepends</literal> zeigt eine Liste von jeder "
-"Rückwärtsabhängigkeit, die ein Paket hat."
+"<literal>show</literal> zeigt die Paketinformationen für die angegebenen "
+"Pakete."
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt.8.xml:71
@@ -688,6 +695,8 @@ msgid ""
 "<literal>install</literal> is followed by one or more package names desired "
 "for installation or upgrading."
 msgstr ""
+"<literal>install</literal> ist gefolgt von einem oder mehreren Paketnamen, "
+"von denen eine Installation oder ein Upgrade gewünscht wird."
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt.8.xml:75 apt-get.8.xml:118
@@ -728,19 +737,17 @@ msgid ""
 "<literal>edit-sources</literal> lets you edit your sources.list file and "
 "provides basic sanity checks."
 msgstr ""
+"<literal>edit-sources</literal> ermöglicht die Bearbeitung Ihrer "
+"»sources.list«-Datei und stellt grundlegende Plausibilitätsprüfungen bereit."
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt.8.xml:99
-#, fuzzy
-#| msgid ""
-#| "<literal>showhold</literal> is used to print a list of packages on hold "
-#| "in the same way as for the other show commands."
 msgid ""
 "<literal>update</literal> is used to resynchronize the package index files "
 "from their sources."
 msgstr ""
-"<literal>showhold</literal> wird benutzt, um eine Liste auf »hold« gesetzter "
-"Pakete auf die gleiche Art wie für andere Anzeigebefehle auszugeben."
+"<literal>update</literal> wird benutzt, um die Paketindexdateien wieder mit "
+"ihren Quellen in Einklang zu bringen."
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt.8.xml:105
@@ -750,6 +757,11 @@ msgid ""
 "<filename>/etc/apt/sources.list</filename>. New package will be installed, "
 "but existing package will never removed."
 msgstr ""
+"<literal>upgrade</literal> wird verwendet, um die neuesten Versionen aller "
+"derzeit auf Ihrem System installierten Pakete von den in "
+"<filename>/etc/apt/sources.list</filename> aufgezählten Quellen zu "
+"installieren. Dabei werden neue Pakete installiert, existierende jedoch nicht "
+"entfernt."
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt.8.xml:114
@@ -758,6 +770,9 @@ msgid ""
 "also remove installed packages if that is required in order to resolve a "
 "package conflict."
 msgstr ""
+"<literal>full-upgrade</literal> verrichtet die Funktion von »upgrade«, kann "
+"aber auch installierte Pakete entfernen, falls dies zum Auflösen eines "
+"Paketkonflikts nötig ist."
 
 #. type: Content of: <refentry><refsect1><title>
 #: apt.8.xml:124 apt-get.8.xml:257 apt-cache.8.xml:250 apt-mark.8.xml:110
@@ -769,7 +784,7 @@ msgstr "Optionen"
 #. type: Content of: <refentry><refsect1><title>
 #: apt.8.xml:134
 msgid "Script usage"
-msgstr ""
+msgstr "Skriptaufruf"
 
 #. type: Content of: <refentry><refsect1><para>
 #: apt.8.xml:136
@@ -780,11 +795,17 @@ msgid ""
 "&apt-cache; and &apt-get; via APT options. Please prefer using these "
 "commands in your scripts."
 msgstr ""
+"Die &apt;-Befehlszeile wurde als Endanwenderwerkzeug entworfen und kann die "
+"Ausgabe zwischen Versionen ändern. Obwohl es versucht, nicht die "
+"Abwärtskompatibilität zu unterbrechen, gibt es dafür keine Garantie. Alle "
+"Funktionalitäten von &apt; sind in &apt-cache; und &apt-get; über "
+"APT-Optionen verfügbar. Bitte benutzen Sie vorzugsweise diese Befehle in "
+"Ihren Skripten."
 
 #. type: Content of: <refentry><refsect1><title>
 #: apt.8.xml:144
 msgid "Differences to &apt-get;"
-msgstr ""
+msgstr "Unterschiede zu &apt-get;"
 
 #. type: Content of: <refentry><refsect1><para>
 #: apt.8.xml:145
@@ -793,20 +814,19 @@ msgid ""
 "does not need to be backward compatible like &apt-get;. Therefore some "
 "options are different:"
 msgstr ""
+"Der Befehl <command>apt</command> ist dazu gedacht, dem Endanwender die "
+"Arbeit zu erleichtern und benötigt keine Abwärtskompatibilität wie &apt-get;. "
+"Daher unterscheiden sich einige Optionen:"
 
 #. type: Content of: <refentry><refsect1><para><itemizedlist><listitem><para>
 #: apt.8.xml:151
-#, fuzzy
-#| msgid "the <literal>Package:</literal> line"
 msgid "The option <literal>DPkg::Progress-Fancy</literal> is enabled."
-msgstr "die <literal>Package:</literal>-Zeile"
+msgstr "Die Option <literal>DPkg::Progress-Fancy</literal> ist aktiviert."
 
 #. type: Content of: <refentry><refsect1><para><itemizedlist><listitem><para>
 #: apt.8.xml:155
-#, fuzzy
-#| msgid "the <literal>Component:</literal> line"
 msgid "The option <literal>APT::Color</literal> is enabled."
-msgstr "die <literal>Component:</literal>-Zeile"
+msgstr "Die Option <literal>APT::Color</literal> ist aktiviert."
 
 #. type: Content of: <refentry><refsect1><para><itemizedlist><listitem><para>
 #: apt.8.xml:159
@@ -814,15 +834,17 @@ msgid ""
 "A new <literal>list</literal> command is available similar to <literal>dpkg "
 "--list</literal>."
 msgstr ""
+"Ein neuer <literal>list</literal>-Befehl ist verfügbar. Er ist <literal>dpkg "
+"--list</literal> ähnlich."
 
 #. type: Content of: <refentry><refsect1><para><itemizedlist><listitem><para>
 #: apt.8.xml:164
-#, fuzzy
-#| msgid "the <literal>Archive:</literal> or <literal>Suite:</literal> line"
 msgid ""
 "The option <literal>upgrade</literal> has <literal>--with-new-pkgs</literal> "
 "enabled by default."
-msgstr "die <literal>Archive:</literal>- oder <literal>Suite:</literal>-Zeile"
+msgstr ""
+"Bei der Option <literal>upgrade</literal> ist standardmäßig "
+"<literal>--with-new-pkgs</literal> aktiviert."
 
 #. type: Content of: <refentry><refsect1><title>
 #: apt.8.xml:174 apt-get.8.xml:558 apt-cache.8.xml:352 apt-key.8.xml:197
@@ -835,18 +857,12 @@ msgstr "Siehe auch"
 
 #. type: Content of: <refentry><refsect1><para>
 #: apt.8.xml:175
-#, fuzzy
-#| msgid ""
-#| "&apt-cache;, &apt-cdrom;, &dpkg;, &sources-list;, &apt-conf;, &apt-"
-#| "config;, &apt-secure;, The APT User's guide in &guidesdir;, &apt-"
-#| "preferences;, the APT Howto."
 msgid ""
 "&apt-get;, &apt-cache;, &sources-list;, &apt-conf;, &apt-config;, The APT "
 "User's guide in &guidesdir;, &apt-preferences;, the APT Howto."
 msgstr ""
-"&apt-cache;, &apt-cdrom;, &dpkg;, &sources-list;, &apt-conf;, &apt-config;, "
-"&apt-secure;, die APT-Benutzeranleitung in &guidesdir;, &apt-preferences;, "
-"das APT-Howto."
+"&apt-get;, &apt-cache;, &sources-list;, &apt-conf;, &apt-config;, die "
+"APT-Benutzeranleitung in &guidesdir;, &apt-preferences;, das APT-Howto."
 
 #. type: Content of: <refentry><refsect1><title>
 #: apt.8.xml:180 apt-get.8.xml:564 apt-cache.8.xml:357 apt-mark.8.xml:137
@@ -857,15 +873,11 @@ msgstr "Diagnose"
 
 #. type: Content of: <refentry><refsect1><para>
 #: apt.8.xml:181
-#, fuzzy
-#| msgid ""
-#| "<command>apt-get</command> returns zero on normal operation, decimal 100 "
-#| "on error."
 msgid ""
 "<command>apt</command> returns zero on normal operation, decimal 100 on "
 "error."
 msgstr ""
-"<command>apt-get</command> gibt bei normalen Operationen 0 zurück, dezimal "
+"<command>apt</command> gibt bei normalen Operationen 0 zurück, dezimal "
 "100 bei Fehlern."
 
 #. type: Content of: <refentry><refnamediv><refpurpose>
@@ -1766,13 +1778,6 @@ msgstr ""
 # FIXME s/Item/Items/
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-get.8.xml:535
-#, fuzzy
-#| msgid ""
-#| "Show user friendly progress information in the terminal window when "
-#| "packages are installed, upgraded or removed. For a machine parsable "
-#| "version of this data see README.progress-reporting in the apt doc "
-#| "directory.  Configuration Item: <literal>DpkgPM::Progress</literal> and "
-#| "<literal>Dpkg::Progress-Fancy</literal>."
 msgid ""
 "Show user friendly progress information in the terminal window when packages "
 "are installed, upgraded or removed. For a machine parsable version of this "
@@ -1783,8 +1788,8 @@ msgstr ""
 "zeigt benutzerfreundliche Fortschrittsinformationen im Terminalfenster, wenn "
 "Pakete installiert beziehungsweise entfernt werden oder ein Upgrade "
 "durchgeführt wird. Informationen über eine maschinell auswertbare Version "
-"dieser Daten finden Sie in README.progress-reporting im Apt-doc-Verzeichnis. "
-"Konfigurationselemente: <literal>DpkgPM::Progress</literal> und "
+"dieser Daten finden Sie in README.progress-reporting im Verzeichnis apt/doc. "
+"Konfigurationselemente: <literal>Dpkg::Progress</literal> und "
 "<literal>Dpkg::Progress-Fancy</literal>."
 
 #. type: Content of: <refentry><refsect1><title>
@@ -5434,6 +5439,10 @@ msgid ""
 "g. the config options <literal>DPkg::{Pre,Post}-Invoke</literal> or "
 "<literal>APT::Update::{Pre,Post}-Invoke</literal>."
 msgstr ""
+"zeigt die externen Befehle, die durch APT-Hooks aufgerufen werden. Dies "
+"schließt z.B. die Konfigurationsoptionen "
+"<literal>DPkg::{Pre,Post}-Invoke</literal> oder "
+"<literal>APT::Update::{Pre,Post}-Invoke</literal> mit ein."
 
 #. type: Content of: <refentry><refsect1><title>
 #: apt.conf.5.xml:1215 apt_preferences.5.xml:547 sources.list.5.xml:239
@@ -8834,20 +8843,12 @@ msgstr ""
 "Es ist wichtig, genau zu schauen, was »Dist-upgrade« tun wird, seine "
 "Entscheidungen können manchmal ziemlich überraschend sein."
 
+# s/package/packages/
 #. type: <p></p>
 #: guide.sgml:163
-#, fuzzy
-#| msgid ""
-#| "<prgn>apt-get</prgn> has several command line options that are detailed "
-#| "in its man page, <manref name=\"apt-get\" section=\"8\">. The most useful "
-#| "option is <tt>-d</tt> which does not install the fetched files. If the "
-#| "system has to download a large number of package it would be undesired to "
-#| "start installing them in case something goes wrong. When <tt>-d</tt> is "
-#| "used the downloaded archives can be installed by simply running the "
-#| "command that caused them to be downloaded again without <tt>-d</tt>."
 msgid ""
 "<prgn>apt-get</prgn> has several command line options that are detailed in "
-"its man page, <manref section=\"8\" name=\"apt-get\">. The most useful "
+"its man page, <manref name=\"apt-get\" section=\"8\">. The most useful "
 "option is <tt>-d</tt> which does not install the fetched files. If the "
 "system has to download a large number of package it would be undesired to "
 "start installing them in case something goes wrong. When <tt>-d</tt> is used "

+ 72 - 10
ftparchive/cachedb.cc

@@ -34,6 +34,19 @@
 #include <apti18n.h>
 									/*}}}*/
 
+CacheDB::CacheDB(std::string const &DB) 
+   : Dbp(0), Fd(NULL), DebFile(0)
+{
+   TmpKey[0]='\0';
+   ReadyDB(DB);
+};
+
+CacheDB::~CacheDB()
+{
+   ReadyDB();
+   delete DebFile;
+};
+
 // CacheDB::ReadyDB - Ready the DB2					/*{{{*/
 // ---------------------------------------------------------------------
 /* This opens the DB2 file for caching package information */
@@ -88,7 +101,7 @@ bool CacheDB::ReadyDB(std::string const &DB)
           return _error->Error(_("Unable to open DB file %s: %s"),DB.c_str(), db_strerror(err));
       }
    }
-   
+
    DBFile = DB;
    DBLoaded = true;
    return true;
@@ -174,6 +187,45 @@ bool CacheDB::GetFileStat(bool const &doStat)
    CurStat.mtime = htonl(St.st_mtime);
    CurStat.Flags |= FlSize;
    
+   return true;
+}
+									/*}}}*/
+// CacheDB::GetCurStatCompatOldFormat           			/*{{{*/
+// ---------------------------------------------------------------------
+/* Read the old (32bit FileSize) StateStore format from disk */
+bool CacheDB::GetCurStatCompatOldFormat()
+{
+   InitQueryStats();
+   Data.data = &CurStatOldFormat;
+   Data.flags = DB_DBT_USERMEM;
+   Data.ulen = sizeof(CurStatOldFormat);
+   if (Get() == false)
+   {
+      CurStat.Flags = 0;
+   } else {
+      CurStat.Flags = CurStatOldFormat.Flags;
+      CurStat.mtime = CurStatOldFormat.mtime;
+      CurStat.FileSize = CurStatOldFormat.FileSize;
+      memcpy(CurStat.MD5, CurStatOldFormat.MD5, sizeof(CurStat.MD5));
+      memcpy(CurStat.SHA1, CurStatOldFormat.SHA1, sizeof(CurStat.SHA1));
+      memcpy(CurStat.SHA256, CurStatOldFormat.SHA256, sizeof(CurStat.SHA256));
+   }
+   return true;
+}
+									/*}}}*/
+// CacheDB::GetCurStatCompatOldFormat           			/*{{{*/
+// ---------------------------------------------------------------------
+/* Read the new (64bit FileSize) StateStore format from disk */
+bool CacheDB::GetCurStatCompatNewFormat()
+{
+   InitQueryStats();
+   Data.data = &CurStat;
+   Data.flags = DB_DBT_USERMEM;
+   Data.ulen = sizeof(CurStat);
+   if (Get() == false)
+   {
+      CurStat.Flags = 0;
+   }
    return true;
 }
 									/*}}}*/
@@ -187,19 +239,29 @@ bool CacheDB::GetCurStat()
    
    if (DBLoaded)
    {
-      /* First see if there is anything about it
-         in the database */
-      
-      /* Get the flags (and mtime) */
+      // do a first query to just get the size of the data on disk
       InitQueryStats();
-      // Ensure alignment of the returned structure
       Data.data = &CurStat;
-      Data.ulen = sizeof(CurStat);
       Data.flags = DB_DBT_USERMEM;
-      if (Get() == false)
+      Data.ulen = 0;
+      Get();
+
+      if (Data.size == 0)
+      {
+         // nothing needs to be done, we just have not data for this deb
+      }
+      // check if the record is written in the old format (32bit filesize)
+      else if(Data.size == sizeof(CurStatOldFormat))
       {
-	 CurStat.Flags = 0;
-      }      
+         GetCurStatCompatOldFormat();
+      }
+      else if(Data.size == sizeof(CurStat))
+      {
+         GetCurStatCompatNewFormat();
+      } else {
+         return _error->Error("Cache record size mismatch (%ul)", Data.size);
+      }
+
       CurStat.Flags = ntohl(CurStat.Flags);
       CurStat.FileSize = ntohl(CurStat.FileSize);
    }      

+ 22 - 4
ftparchive/cachedb.h

@@ -86,8 +86,12 @@ class CacheDB
    bool OpenDebFile();
    void CloseDebFile();
 
-   bool GetFileStat(bool const &doStat = false);
+   // GetCurStat needs some compat code, see lp #1274466)
+   bool GetCurStatCompatOldFormat();
+   bool GetCurStatCompatNewFormat();
    bool GetCurStat();
+
+   bool GetFileStat(bool const &doStat = false);
    bool LoadControl();
    bool LoadContents(bool const &GenOnly);
    bool LoadSource();
@@ -99,6 +103,20 @@ class CacheDB
                   FlSHA512=(1<<6), FlSource=(1<<7),
    };
 
+   // the on-disk format changed (FileSize increased to 64bit) in 
+   // commit 650faab0 which will lead to corruption with old caches
+   struct StatStoreOldFormat
+   {
+      uint32_t Flags;
+      uint32_t mtime;
+      uint32_t FileSize;
+      uint8_t  MD5[16];
+      uint8_t  SHA1[20];
+      uint8_t  SHA256[32];
+   } CurStatOldFormat;
+
+   // WARNING: this struct is read/written to the DB so do not change the
+   //          layout of the fields (see lp #1274466), only append to it
    struct StatStore
    {
       uint32_t Flags;
@@ -150,7 +168,7 @@ class CacheDB
 		SHA512Bytes(0),Packages(0), Misses(0), DeLinkBytes(0) {};
    } Stats;
    
-   bool ReadyDB(std::string const &DB);
+   bool ReadyDB(std::string const &DB = "");
    inline bool DBFailed() {return Dbp != 0 && DBLoaded == false;};
    inline bool Loaded() {return DBLoaded == true;};
    
@@ -171,8 +189,8 @@ class CacheDB
    
    bool Clean();
    
-   CacheDB(std::string const &DB) : Dbp(0), Fd(NULL), DebFile(0) {TmpKey[0]='\0'; ReadyDB(DB);};
-   ~CacheDB() {ReadyDB(std::string()); delete DebFile;};
+   CacheDB(std::string const &DB);
+   ~CacheDB();
 };
     
 #endif

+ 12 - 1
ftparchive/contents.cc

@@ -302,7 +302,18 @@ void GenContents::DoPrint(FILE *Out,GenContents::Node *Top, char *Buf)
    DoPrint(Out,Top->BTreeRight,Buf);  
 }
 									/*}}}*/
-
+// ContentsExtract Constructor           				/*{{{*/
+ContentsExtract::ContentsExtract()
+   : Data(0), MaxSize(0), CurSize(0) 
+{
+};
+									/*}}}*/
+// ContentsExtract Destructor           				/*{{{*/
+ContentsExtract::~ContentsExtract()
+{
+   free(Data);
+};
+									/*}}}*/
 // ContentsExtract::Read - Read the archive				/*{{{*/
 // ---------------------------------------------------------------------
 /* */

+ 2 - 2
ftparchive/contents.h

@@ -85,8 +85,8 @@ class ContentsExtract : public pkgDirStream
    bool TakeContents(const void *Data,unsigned long long Length);
    void Add(GenContents &Contents,std::string const &Package);
    
-   ContentsExtract() : Data(0), MaxSize(0), CurSize(0) {};
-   virtual ~ContentsExtract() {delete [] Data;};
+   ContentsExtract();
+   virtual ~ContentsExtract();
 };
 
 #endif

+ 4 - 2
ftparchive/writer.h

@@ -126,8 +126,10 @@ class PackagesWriter : public FTWScanner
       {return Over.ReadExtraOverride(File);};
    virtual bool DoPackage(string FileName);
 
-   PackagesWriter(string const &DB,string const &Overrides,string const &ExtOverrides=string(),
-		  string const &Arch=string());
+   PackagesWriter(string const &DB,
+                  string const &Overrides,
+                  string const &ExtOverrides = "",
+		  string const &Arch = "");
    virtual ~PackagesWriter() {};
 };
 

Plik diff jest za duży
+ 202 - 179
po/ar.po


Plik diff jest za duży
+ 202 - 174
po/ast.po


Plik diff jest za duży
+ 205 - 175
po/bg.po


Plik diff jest za duży
+ 202 - 150
po/bs.po


Plik diff jest za duży
+ 206 - 177
po/ca.po


Plik diff jest za duży
+ 206 - 174
po/cs.po


Plik diff jest za duży
+ 202 - 178
po/cy.po


Plik diff jest za duży
+ 202 - 147
po/da.po


Plik diff jest za duży
+ 210 - 179
po/de.po


Plik diff jest za duży
+ 206 - 180
po/dz.po


Plik diff jest za duży
+ 207 - 178
po/el.po


Plik diff jest za duży
+ 204 - 177
po/es.po


Plik diff jest za duży
+ 202 - 176
po/eu.po


Plik diff jest za duży
+ 202 - 177
po/fi.po


Plik diff jest za duży
+ 207 - 178
po/fr.po


Plik diff jest za duży
+ 202 - 174
po/gl.po


Plik diff jest za duży
+ 203 - 175
po/hu.po


Plik diff jest za duży
+ 306 - 256
po/it.po


Plik diff jest za duży
+ 201 - 147
po/ja.po


Plik diff jest za duży
+ 202 - 176
po/km.po


Plik diff jest za duży
+ 202 - 176
po/ko.po


Plik diff jest za duży
+ 202 - 153
po/ku.po


Plik diff jest za duży
+ 204 - 180
po/lt.po


Plik diff jest za duży
+ 202 - 178
po/mr.po


Plik diff jest za duży
+ 205 - 178
po/nb.po


Plik diff jest za duży
+ 202 - 176
po/ne.po


Plik diff jest za duży
+ 207 - 180
po/nl.po


Plik diff jest za duży
+ 206 - 181
po/nn.po


Plik diff jest za duży
+ 208 - 178
po/pl.po


Plik diff jest za duży
+ 206 - 176
po/pt.po


Plik diff jest za duży
+ 202 - 178
po/pt_BR.po


Plik diff jest za duży
+ 203 - 176
po/ro.po


Plik diff jest za duży
+ 206 - 174
po/ru.po


Plik diff jest za duży
+ 206 - 175
po/sk.po


Plik diff jest za duży
+ 205 - 172
po/sl.po


Plik diff jest za duży
+ 205 - 178
po/sv.po


Plik diff jest za duży
+ 201 - 171
po/th.po


Plik diff jest za duży
+ 204 - 178
po/tl.po


Plik diff jest za duży
+ 207 - 176
po/tr.po


Plik diff jest za duży
+ 207 - 177
po/uk.po


Plik diff jest za duży
+ 202 - 174
po/vi.po


Plik diff jest za duży
+ 201 - 174
po/zh_CN.po


Plik diff jest za duży
+ 202 - 176
po/zh_TW.po


BIN
test/integration/cachedb-lp1274466-old-format.db


BIN
test/integration/deb-lp1274466-cachedb.deb


+ 8 - 0
test/integration/framework

@@ -120,6 +120,7 @@ apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; }
 aptwebserver() { runapt "${APTWEBSERVERBINDIR}/aptwebserver" "$@"; }
 aptitude() { runapt aptitude "$@"; }
 aptextracttemplates() { runapt apt-extracttemplates "$@"; }
+aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; }
 
 dpkg() {
 	command dpkg --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log "$@"
@@ -179,6 +180,7 @@ setupenvironment() {
         METHODSDIR=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}
         APTHELPERBINDIR=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}
         APTWEBSERVERBINDIR=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}
+        APTINTERNALSOLVER=${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/apt-internal-solver"}
 	test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first"
         # -----
 
@@ -192,6 +194,12 @@ setupenvironment() {
 	touch var/lib/dpkg/available
 	mkdir -p usr/lib/apt
 	ln -s ${METHODSDIR} usr/lib/apt/methods
+	if [ "$BUILDDIRECTORY" = "$LIBRARYPATH" ]; then
+		mkdir -p usr/lib/apt/solvers
+		ln -s "${BUILDDIRECTORY}/apt-dump-solver" usr/lib/apt/solvers/dump
+		ln -s "${BUILDDIRECTORY}/apt-internal-solver" usr/lib/apt/solvers/apt
+		echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" > etc/apt/apt.conf.d/externalsolver.conf
+	fi
         # use the autoremove from the BUILDDIRECTORY if its there, otherwise
         # system
         if [ -e ${BUILDDIRECTORY}/../../debian/apt.conf.autoremove ]; then

+ 1 - 1
test/integration/run-tests

@@ -39,7 +39,7 @@ fi
 TOTAL="$(run-parts --list $DIR | grep '/test-' | wc -l)"
 for testcase in $(run-parts --list $DIR | grep '/test-'); do
 	if [ "$MSGLEVEL" -le 2 ]; then
-		echo -n "${CTEST}Testcase ${CHIGH}$(basename ${testcase})${CRESET}: "
+		echo -n "($(($ALL+1))/${TOTAL}) ${CTEST}Testcase ${CHIGH}$(basename ${testcase})${CRESET}: "
 	else
 		echo "${CTEST}Run Testcase ($(($ALL+1))/${TOTAL}) ${CHIGH}$(basename ${testcase})${CRESET}"
 	fi

+ 17 - 0
test/integration/test-apt-cli-update

@@ -0,0 +1,17 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+insertpackage 'unstable' 'foo' 'all' '2.0'
+insertinstalledpackage 'foo' 'all' '1.0'
+
+setupaptarchive
+
+APTARCHIVE=$(readlink -f ./aptarchive)
+
+testequal "1 package can be upgraded. Run 'apt list --upgradable' to see it." apt update -q

+ 53 - 0
test/integration/test-apt-ftparchive-cachedb-lp1274466

@@ -0,0 +1,53 @@
+#!/bin/sh
+set -e
+
+
+#
+# main()
+#
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture "i386"
+
+# gather the db and the deb, ensure mtime is not modfied as its saved in the DB
+cp -p $TESTDIR/deb-lp1274466-cachedb.deb  foo_1_i386.deb
+cp -p $TESTDIR/cachedb-lp1274466-old-format.db old-format.db
+
+# verify that the format is different
+testsuccess aptftparchive --db new-format.db packages .
+db_dump new-format.db > new-format.dump
+db_dump old-format.db > old-format.dump
+testfailure diff -u old-format.dump new-format.dump
+
+# ensure the new format as the sha512
+testsuccess grep 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc12a0e7cadb4b66764235c56e1009dbfe8a9a566fb1eedf47a992d1fff2cc3332c new-format.dump
+# but the old format does not
+testfailure grep 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc12a0e7cadb4b66764235c56e1009dbfe8a9a566fb1eedf47a992d1fff2cc3332c old-format.dump
+
+# regression test for corruption with previous generation of cachedb
+testequal "Package: foo
+Priority: optional
+Section: others
+Installed-Size: 29
+Maintainer: Joe Sixpack <joe@example.org>
+Architecture: i386
+Version: 1
+Filename: ./foo_1_i386.deb
+Size: 1270
+MD5sum: 85d0e908c1a897700e2c5dea72d7e3c0
+SHA1: 858b09169032b7925a0e463f46b6634243fc40ce
+SHA256: 3750a2c9c6b5beee7f307564be3d51d3ec7cbb78fa4f0b47f84a7c41477bff59
+SHA512: 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc12a0e7cadb4b66764235c56e1009dbfe8a9a566fb1eedf47a992d1fff2cc3332c
+Description: an autogenerated dummy foo=1/test
+ If you find such a package installed on your system,
+ something went horribly wrong! They are autogenerated
+ und used only by testcases and surf no other propose…
+" aptftparchive  --db old-format.db packages .
+
+# ensure that the db is updated and contains the new sha512
+db_dump old-format.db > old-format.dump
+
+testsuccess grep 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc12a0e7cadb4b66764235c56e1009dbfe8a9a566fb1eedf47a992d1fff2cc3332c old-format.dump
+
+

+ 31 - 0
test/integration/test-apt-get-source-authenticated

@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# Regression test for debian bug #749795. Ensure that we fail with
+# a error if apt-get source foo will download a source that comes
+# from a unauthenticated repository
+#
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+# a "normal" package with source and binary
+buildsimplenativepackage 'foo' 'all' '2.0'
+
+setupaptarchive --no-update
+
+APTARCHIVE=$(readlink -f ./aptarchive)
+rm -f $APTARCHIVE/dists/unstable/*Release*
+
+# update without authenticated InRelease file
+testsuccess aptget update
+
+# this all should fail
+testfailure aptget install -y foo
+testfailure aptget source foo
+
+# allow overriding the warning
+testsuccess aptget source --allow-unauthenticated foo

+ 39 - 0
test/integration/test-bug-745046-candidate-propagation-fails

@@ -0,0 +1,39 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64'
+
+insertinstalledpackage 'gedit' 'amd64' '1'
+
+insertpackage 'unstable' 'gedit' 'amd64' '1'
+insertpackage 'experimental' 'gedit' 'amd64' '2' 'Depends: common (>= 2)'
+
+setupaptarchive
+
+testequal "Reading package lists...
+Building dependency tree...
+Selected version '2' (experimental [amd64]) for 'gedit'
+Some packages could not be installed. This may mean that you have
+requested an impossible situation or if you are using the unstable
+distribution that some required packages have not yet been created
+or been moved out of Incoming.
+The following information may help to resolve the situation:
+
+The following packages have unmet dependencies:
+ gedit : Depends: common (>= 2) but it is not installable
+E: Unable to correct problems, you have held broken packages." aptget install gedit/experimental -sq=0
+
+insertinstalledpackage 'common' 'amd64' '2'
+
+testequal "Reading package lists...
+Building dependency tree...
+Selected version '2' (experimental [amd64]) for 'gedit'
+The following packages will be upgraded:
+  gedit
+1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst gedit [1] (2 experimental [amd64])
+Conf gedit (2 experimental [amd64])" aptget install gedit/experimental -sq=0

+ 2 - 0
test/integration/test-compressed-indexes

@@ -67,6 +67,8 @@ testrun() {
 	msgtest "\tdsc file is present"; testsuccess --nomsg test -f testpkg_1.0.dsc
 	msgtest "\tdirectory is present"; testsuccess --nomsg test -d testpkg-1.0
 	rm -rf testpkg-1.0
+	testequal "$(aptcache show testpkg -o Acquire::Languages=none)
+" aptcache dumpavail
 }
 
 echo 'Acquire::GzipIndexes "false";' > rootdir/etc/apt/apt.conf.d/02compressindex

+ 9 - 9
test/integration/test-essential-force-loopbreak

@@ -5,18 +5,18 @@ TESTDIR=$(readlink -f $(dirname $0))
 . $TESTDIR/framework
 
 setupenvironment
-configarchitecture 'amd64'
+configarchitecture 'native'
 
-insertinstalledpackage 'sysvinit' 'amd64' '1' 'Essential: yes'
+insertinstalledpackage 'sysvinit' 'native' '1' 'Essential: yes'
 
-buildsimplenativepackage 'sysvinit' 'amd64' '2' 'sid' 'Pre-Depends: sysvinit-core | systemd-sysv
+buildsimplenativepackage 'sysvinit' 'native' '2' 'sid' 'Pre-Depends: sysvinit-core | systemd-sysv
 Essential: yes'
-buildsimplenativepackage 'sysvinit-core' 'amd64' '2' 'sid'
+buildsimplenativepackage 'sysvinit-core' 'native' '2' 'sid'
 
-buildsimplenativepackage 'systemd-sysv' 'amd64' '2~conflict' 'sid-conflict' 'Conflicts: sysvinit (<< 2)
+buildsimplenativepackage 'systemd-sysv' 'native' '2~conflict' 'sid-conflict' 'Conflicts: sysvinit (<< 2)
 Breaks: sysvinit-core'
 
-buildsimplenativepackage 'systemd-sysv' 'amd64' '2~break' 'sid-break' 'Breaks: sysvinit (<< 2), sysvinit-core'
+buildsimplenativepackage 'systemd-sysv' 'native' '2~break' 'sid-break' 'Breaks: sysvinit (<< 2), sysvinit-core'
 
 setupaptarchive
 
@@ -25,7 +25,7 @@ cp -a rootdir/var/lib/dpkg/status dpkg.status.backup
 testforcebreak() {
 	cp -a dpkg.status.backup rootdir/var/lib/dpkg/status
 	rm -f rootdir/var/lib/apt/extended_states
-	testequal 'Reading package lists...
+	testequal "Reading package lists...
 Building dependency tree...
 The following extra packages will be installed:
   sysvinit
@@ -34,8 +34,8 @@ The following NEW packages will be installed:
 The following packages will be upgraded:
   sysvinit
 1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
-E: This installation run will require temporarily removing the essential package sysvinit:amd64 due to a Conflicts/Pre-Depends loop. This is often bad, but if you really want to do it, activate the APT::Force-LoopBreak option.
-E: Internal Error, Could not early remove sysvinit:amd64 (2)' aptget install systemd-sysv -t "$1" -s
+E: This installation run will require temporarily removing the essential package sysvinit:$(getarchitecture 'native') due to a Conflicts/Pre-Depends loop. This is often bad, but if you really want to do it, activate the APT::Force-LoopBreak option.
+E: Internal Error, Could not early remove sysvinit:$(dpkg --print-architecture) (2)" aptget install systemd-sysv -t "$1" -s
 	# ensure that really nothing happens
 	testfailure aptget install systemd-sysv -y -t "$1" -o Debug::pkgPackageManager=1
 	testdpkginstalled 'sysvinit'

+ 65 - 0
test/integration/test-external-dependency-solver-protocol

@@ -0,0 +1,65 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'i386'
+
+insertinstalledpackage 'cool' 'all' '1'
+insertinstalledpackage 'stuff' 'all' '1'
+
+insertpackage 'unstable' 'cool' 'all' '2' 'Multi-Arch: foreign'
+insertpackage 'unstable' 'stuff' 'all' '2' 'Multi-Arch: foreign'
+insertpackage 'unstable' 'coolstuff' 'i386,amd64' '2' 'Depends: cool, stuff'
+insertpackage 'unstable' 'awesome' 'all' '2' 'Multi-Arch: foreign'
+insertpackage 'unstable' 'awesomecoolstuff' 'i386' '2' 'Depends: coolstuff, awesome'
+
+insertpackage 'experimental' 'cool' 'all' '3' 'Multi-Arch: foreign'
+insertpackage 'experimental' 'stuff' 'all' '3' 'Multi-Arch: foreign'
+insertpackage 'experimental' 'coolstuff' 'i386,amd64' '3' 'Depends: cool, stuff'
+
+setupaptarchive
+
+rm -f /tmp/dump.edsp
+testequal 'Reading package lists...
+Building dependency tree...
+Execute external solver...
+The solver encountered an error of type: ERR_JUST_DUMPING
+The following information might help you to understand what is wrong:
+I am too dumb, i can just dump!
+Please use one of my friends instead!
+
+E: External solver failed with: I am too dumb, i can just dump!' aptget install --solver dump coolstuff -s
+testsuccess test -s /tmp/dump.edsp
+rm -f /tmp/dump.edsp
+
+#FIXME: this should be unstable, but we don't support pinning yet
+testequal 'Reading package lists...
+Building dependency tree...
+Execute external solver...
+The following NEW packages will be installed:
+  coolstuff
+0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
+Inst coolstuff (3 experimental [amd64])
+Conf coolstuff (3 experimental [amd64])' aptget install --solver apt coolstuff -s
+
+testsuccess aptget install awesomecoolstuff:i386 -s
+testsuccess aptget install --solver apt awesomecoolstuff:i386 -s
+
+rm -f /tmp/dump.edsp
+testfailure aptget install --solver dump awesomecoolstuff:i386 -s
+testsuccess test -s /tmp/dump.edsp
+
+configarchitecture 'armel'
+msgtest 'Test direct calling is okay for' 'apt-internal-solver'
+cat /tmp/dump.edsp | aptinternalsolver > solver.result 2>&1 || true
+if [ "$(tail -n2 solver.result | head -n1 )" = "Message: Done" ]; then
+	msgpass
+else
+	cat solver.result
+	msgfail
+fi
+rm -f /tmp/dump.edsp
+
+testfailure aptget install --solver apt awesomecoolstuff:i386 -s

+ 1 - 1
test/libapt/cdrom_test.cc

@@ -91,7 +91,7 @@ TEST(CDROMTest,ReduceSourcelist)
 }
 TEST(CDROMTest, FindMountPointForDevice)
 {
-   char * tempfile;
+   char * tempfile = NULL;
    FileFd fd;
    createTemporaryFile("mountpoints", fd, &tempfile,
 	 "rootfs / rootfs rw 0 0\n"