Prechádzať zdrojové kódy

Merge branch 'debian/sid' into feature/apt-manpage

Michael Vogt 12 rokov pred
rodič
commit
1b4560fec6
100 zmenil súbory, kde vykonal 40723 pridanie a 37526 odobranie
  1. 5 0
      .gitignore
  2. 2 1
      Makefile
  3. 38 8
      apt-pkg/contrib/fileutl.cc
  4. 3 0
      apt-pkg/contrib/fileutl.h
  5. 3 9
      apt-pkg/contrib/gpgv.cc
  6. 21 4
      apt-pkg/contrib/hashes.cc
  7. 8 1
      apt-pkg/contrib/hashes.h
  8. 8 0
      apt-pkg/contrib/strutl.cc
  9. 1 0
      apt-pkg/contrib/strutl.h
  10. 16 1
      apt-pkg/deb/debmetaindex.cc
  11. 7 0
      apt-pkg/deb/debmetaindex.h
  12. 66 10
      apt-pkg/deb/dpkgpm.cc
  13. 0 1
      apt-pkg/deb/dpkgpm.h
  14. 1 1
      apt-pkg/depcache.cc
  15. 2 2
      apt-pkg/indexfile.h
  16. 5 0
      apt-pkg/indexrecords.cc
  17. 1 0
      apt-pkg/indexrecords.h
  18. 1 9
      apt-pkg/init.cc
  19. 58 15
      apt-pkg/install-progress.cc
  20. 14 4
      apt-pkg/install-progress.h
  21. 17 7
      apt-pkg/metaindex.h
  22. 4 0
      apt-pkg/policy.cc
  23. 9 2
      apt-pkg/tagfile.cc
  24. 1 1
      apt-private/makefile
  25. 6 1
      apt-private/private-cmndline.cc
  26. 3 0
      apt-private/private-install.h
  27. 5 3
      apt-private/private-list.cc
  28. 8 4
      apt-private/private-output.cc
  29. 2 1
      apt-private/private-output.h
  30. 59 0
      apt-private/private-sources.cc
  31. 3 0
      apt-private/private-sources.h
  32. 50 0
      apt-private/private-utils.cc
  33. 11 0
      apt-private/private-utils.h
  34. 5 2
      buildlib/po4a_manpage.mak
  35. 3 8
      cmdline/apt-extracttemplates.cc
  36. 165 57
      cmdline/apt-get.cc
  37. 42 17
      cmdline/apt-key
  38. 9 0
      cmdline/apt.cc
  39. 8 0
      cmdline/makefile
  40. 1 1
      configure.ac
  41. 2 2
      debian/apt.cron.daily
  42. 92 0
      debian/changelog
  43. 2 1
      debian/control
  44. 0 1
      debian/gbp.conf
  45. 79 3
      debian/libapt-pkg4.12.symbols
  46. 0 32
      debian/preinst
  47. 4 1
      debian/rules
  48. 2 0
      debian/tests/control
  49. 18 0
      debian/tests/run-tests
  50. 2 0
      doc/apt-cache.8.xml
  51. 2 0
      doc/apt-cdrom.8.xml
  52. 2 0
      doc/apt-config.8.xml
  53. 2 0
      doc/apt-extracttemplates.1.xml
  54. 2 0
      doc/apt-ftparchive.1.xml
  55. 3 1
      doc/apt-get.8.xml
  56. 7 5
      doc/apt-key.8.xml
  57. 2 0
      doc/apt-mark.8.xml
  58. 5 3
      doc/apt-secure.8.xml
  59. 2 0
      doc/apt-sortpkgs.1.xml
  60. 4 4
      doc/apt-verbatim.ent
  61. 2 0
      doc/apt.conf.5.xml
  62. 2 0
      doc/apt_preferences.5.xml
  63. 5 2
      doc/en/makefile
  64. 12 5
      doc/makefile
  65. 717 643
      doc/po/apt-doc.pot
  66. 802 676
      doc/po/de.po
  67. 801 676
      doc/po/es.po
  68. 797 674
      doc/po/fr.po
  69. 800 675
      doc/po/it.po
  70. 787 676
      doc/po/ja.po
  71. 779 676
      doc/po/pl.po
  72. 799 675
      doc/po/pt.po
  73. 738 665
      doc/po/pt_BR.po
  74. 2 0
      doc/sources.list.5.xml
  75. 1196 1145
      po/ar.po
  76. 1341 1266
      po/ast.po
  77. 1362 1287
      po/bg.po
  78. 1012 1014
      po/bs.po
  79. 1351 1274
      po/ca.po
  80. 1353 1278
      po/cs.po
  81. 1335 1263
      po/cy.po
  82. 1334 1416
      po/da.po
  83. 1384 1308
      po/de.po
  84. 1319 1250
      po/dz.po
  85. 1333 1263
      po/el.po
  86. 1356 1280
      po/es.po
  87. 1334 1262
      po/eu.po
  88. 1331 1259
      po/fi.po
  89. 1395 1312
      po/fr.po
  90. 1359 1281
      po/gl.po
  91. 1358 1289
      po/hu.po
  92. 1381 1300
      po/it.po
  93. 1367 1293
      po/ja.po
  94. 1301 1232
      po/km.po
  95. 1334 1259
      po/ko.po
  96. 1069 1068
      po/ku.po
  97. 1211 1149
      po/lt.po
  98. 1321 1248
      po/mr.po
  99. 1340 1264
      po/nb.po
  100. 0 0
      po/ne.po

+ 5 - 0
.gitignore

@@ -31,7 +31,12 @@
 /debian/apt-transport-https/
 
 # generated from *.in files
+/cmdline/apt-key
+/doc/apt-vendor.ent
 /doc/examples/sources.list
 /debian/libapt-pkg*.install
 /debian/libapt-inst*.install
 /debian/libapt-pkg-dev.install
+/vendor/current
+/vendor/debian/sources.list
+/vendor/ubuntu/sources.list

+ 2 - 1
Makefile

@@ -11,6 +11,7 @@ default: startup all
 
 .PHONY: headers library clean veryclean all binary program doc test update-po
 all headers library clean veryclean binary program doc manpages debiandoc test update-po startup dirs:
+	$(MAKE) -C vendor $@
 	$(MAKE) -C apt-pkg $@
 	$(MAKE) -C apt-inst $@
 	$(MAKE) -C apt-private $@
@@ -20,7 +21,7 @@ all headers library clean veryclean binary program doc manpages debiandoc test u
 	$(MAKE) -C dselect $@
 	$(MAKE) -C doc $@
 	$(MAKE) -C po $@
-	$(MAKE) -C test $@ 
+	$(MAKE) -C test $@
 
 all headers library clean veryclean binary program doc manpages debiandoc test update-po: startup dirs
 

+ 38 - 8
apt-pkg/contrib/fileutl.cc

@@ -760,16 +760,13 @@ bool WaitFd(int Fd,bool write,unsigned long timeout)
    return true;
 }
 									/*}}}*/
-// ExecFork - Magical fork that sanitizes the context before execing	/*{{{*/
+// MergeKeepFdsFromConfiguration - Merge APT::Keep-Fds configuration	/*{{{*/
 // ---------------------------------------------------------------------
-/* This is used if you want to cleanse the environment for the forked 
-   child, it fixes up the important signals and nukes all of the fds,
-   otherwise acts like normal fork. */
-pid_t ExecFork()
+/* This is used to merge the APT::Keep-Fds with the provided KeepFDs
+ * set.
+ */
+void MergeKeepFdsFromConfiguration(std::set<int> &KeepFDs)
 {
-      set<int> KeepFDs;
-
-      // FIXME: remove looking at APT::Keep-Fds eventually, its a hack
       Configuration::Item const *Opts = _config->Tree("APT::Keep-Fds");
       if (Opts != 0 && Opts->Child != 0)
       {
@@ -782,6 +779,19 @@ pid_t ExecFork()
 	    KeepFDs.insert(fd);
 	 }
       }
+}
+									/*}}}*/
+// ExecFork - Magical fork that sanitizes the context before execing	/*{{{*/
+// ---------------------------------------------------------------------
+/* This is used if you want to cleanse the environment for the forked 
+   child, it fixes up the important signals and nukes all of the fds,
+   otherwise acts like normal fork. */
+pid_t ExecFork()
+{
+      set<int> KeepFDs;
+      // we need to merge the Keep-Fds as external tools like 
+      // debconf-apt-progress use it
+      MergeKeepFdsFromConfiguration(KeepFDs);
       return ExecFork(KeepFDs);
 }
 
@@ -1535,6 +1545,9 @@ bool FileFd::Skip(unsigned long long Over)
 /* */
 bool FileFd::Truncate(unsigned long long To)
 {
+   // truncating /dev/null is always successful - as we get an error otherwise
+   if (To == 0 && FileName == "/dev/null")
+      return true;
 #if defined HAVE_ZLIB || defined HAVE_BZ2
    if (d != NULL && (d->gz != NULL || d->bz2 != NULL))
       return FileFdError("Truncating compressed files is not implemented (%s)", FileName.c_str());
@@ -1814,3 +1827,20 @@ std::vector<std::string> Glob(std::string const &pattern, int flags)
    return result;
 }
 									/*}}}*/
+
+std::string GetTempDir()
+{
+   const char *tmpdir = getenv("TMPDIR");
+
+#ifdef P_tmpdir
+   if (!tmpdir)
+      tmpdir = P_tmpdir;
+#endif
+
+   // check that tmpdir is set and exists
+   struct stat st;
+   if (!tmpdir || strlen(tmpdir) == 0 || stat(tmpdir, &st) != 0)
+      tmpdir = "/tmp";
+
+   return string(tmpdir);
+}

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

@@ -165,6 +165,8 @@ bool DirectoryExists(std::string const &Path) __attrib_const;
 bool CreateDirectory(std::string const &Parent, std::string const &Path);
 time_t GetModificationTime(std::string const &Path);
 
+std::string GetTempDir();
+
 /** \brief Ensure the existence of the given Path
  *
  *  \param Parent directory of the Path directory - a trailing
@@ -184,6 +186,7 @@ void SetNonBlock(int Fd,bool Block);
 bool WaitFd(int Fd,bool write = false,unsigned long timeout = 0);
 pid_t ExecFork();
 pid_t ExecFork(std::set<int> keep_fds);
+void MergeKeepFdsFromConfiguration(std::set<int> &keep_fds);
 bool ExecWait(pid_t Pid,const char *Name,bool Reap = false);
 
 // File string manipulators

+ 3 - 9
apt-pkg/contrib/gpgv.cc

@@ -10,6 +10,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <unistd.h>
 
 #include<apt-pkg/configuration.h>
 #include<apt-pkg/error.h>
@@ -21,16 +22,9 @@
 									/*}}}*/
 static char * GenerateTemporaryFileTemplate(const char *basename)	/*{{{*/
 {
-   const char *tmpdir = getenv("TMPDIR");
-#ifdef P_tmpdir
-   if (!tmpdir)
-      tmpdir = P_tmpdir;
-#endif
-   if (!tmpdir)
-      tmpdir = "/tmp";
-
    std::string out;
-   strprintf(out,  "%s/%s.XXXXXX", tmpdir, basename);
+   std::string tmpdir = GetTempDir();
+   strprintf(out,  "%s/%s.XXXXXX", tmpdir.c_str(), basename);
    return strdup(out.c_str());
 }
 									/*}}}*/

+ 21 - 4
apt-pkg/contrib/hashes.cc

@@ -54,6 +54,26 @@ HashString::HashString(std::string StringedHash)			/*{{{*/
 }
 									/*}}}*/
 bool HashString::VerifyFile(std::string filename) const			/*{{{*/
+{
+   std::string fileHash = GetHashForFile(filename);
+
+   if(_config->FindB("Debug::Hashes",false) == true)
+      std::clog << "HashString::VerifyFile: got: " << fileHash << " expected: " << toStr() << std::endl;
+
+   return (fileHash == Hash);
+}
+									/*}}}*/
+bool HashString::FromFile(std::string filename)          		/*{{{*/
+{
+   // pick the strongest hash
+   if (Type == "")
+      Type = _SupportedHashes[0];
+
+   Hash = GetHashForFile(filename);
+   return true;
+}
+									/*}}}*/
+std::string HashString::GetHashForFile(std::string filename) const      /*{{{*/
 {
    std::string fileHash;
 
@@ -84,10 +104,7 @@ bool HashString::VerifyFile(std::string filename) const			/*{{{*/
    }
    Fd.Close();
 
-   if(_config->FindB("Debug::Hashes",false) == true)
-      std::clog << "HashString::VerifyFile: got: " << fileHash << " expected: " << toStr() << std::endl;
-
-   return (fileHash == Hash);
+   return fileHash;
 }
 									/*}}}*/
 const char** HashString::SupportedHashes()

+ 8 - 1
apt-pkg/contrib/hashes.h

@@ -36,7 +36,10 @@ class HashString
  protected:
    std::string Type;
    std::string Hash;
-   static const char * _SupportedHashes[10];
+   static const char* _SupportedHashes[10];
+
+   // internal helper
+   std::string GetHashForFile(std::string filename) const;
 
  public:
    HashString(std::string Type, std::string Hash);
@@ -49,6 +52,10 @@ class HashString
    // verify the given filename against the currently loaded hash
    bool VerifyFile(std::string filename) const;
 
+   // generate a hash string from the given filename
+   bool FromFile(std::string filename);
+
+
    // helper
    std::string toStr() const;                    // convert to str as "type:hash"
    bool empty() const;

+ 8 - 0
apt-pkg/contrib/strutl.cc

@@ -49,6 +49,14 @@ std::string Strip(const std::string &s)
    size_t end = s.find_last_not_of(" \t\n");
    return s.substr(start, end-start+1);
 }
+
+bool Endswith(const std::string &s, const std::string &end)
+{
+   if (end.size() > s.size())
+      return false;
+   return (s.substr(s.size() - end.size(), s.size()) == end);
+}
+
 }
 }
 									/*}}}*/

+ 1 - 0
apt-pkg/contrib/strutl.h

@@ -36,6 +36,7 @@ using std::ostream;
 namespace APT {
    namespace String {
       std::string Strip(const std::string &s);
+      bool Endswith(const std::string &s, const std::string &ending);
    };
 };
 

+ 16 - 1
apt-pkg/deb/debmetaindex.cc

@@ -1,4 +1,3 @@
-// ijones, walters
 #include <config.h>
 
 #include <apt-pkg/debmetaindex.h>
@@ -72,6 +71,22 @@ string debReleaseIndex::MetaIndexURI(const char *Type) const
    return Res;
 }
 
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
+std::string debReleaseIndex::LocalFileName() const
+{
+   // see if we have a InRelease file
+   std::string PathInRelease =  MetaIndexFile("InRelease");
+   if (FileExists(PathInRelease))
+      return PathInRelease;
+
+   // and if not return the normal one
+   if (FileExists(PathInRelease))
+      return MetaIndexFile("Release");
+
+   return "";
+}
+#endif
+
 string debReleaseIndex::IndexURISuffix(const char *Type, string const &Section, string const &Arch) const
 {
    string Res ="";

+ 7 - 0
apt-pkg/deb/debmetaindex.h

@@ -3,6 +3,7 @@
 #define PKGLIB_DEBMETAINDEX_H
 
 #include <apt-pkg/metaindex.h>
+#include <apt-pkg/init.h>
 
 #include <map>
 #include <string>
@@ -39,9 +40,15 @@ class debReleaseIndex : public metaIndex {
    virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const;
    std::vector <struct IndexTarget *>* ComputeIndexTargets() const;
    std::string Info(const char *Type, std::string const &Section, std::string const &Arch="") const;
+
    std::string MetaIndexInfo(const char *Type) const;
    std::string MetaIndexFile(const char *Types) const;
    std::string MetaIndexURI(const char *Type) const;
+
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
+   virtual std::string LocalFileName() const;
+#endif
+
    std::string IndexURI(const char *Type, std::string const &Section, std::string const &Arch="native") const;
    std::string IndexURISuffix(const char *Type, std::string const &Section, std::string const &Arch="native") const;
    std::string SourceIndexURI(const char *Type, const std::string &Section) const;

+ 66 - 10
apt-pkg/deb/dpkgpm.cc

@@ -44,6 +44,7 @@
 #include <unistd.h>
 #include <sys/ioctl.h>
 #include <pty.h>
+#include <stdio.h>
 
 #include <apti18n.h>
 									/*}}}*/
@@ -201,7 +202,7 @@ pkgCache::VerIterator FindNowVersion(const pkgCache::PkgIterator &Pkg)
 // ---------------------------------------------------------------------
 /* */
 pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache) 
-   : pkgPackageManager(Cache), PackagesDone(0), PackagesTotal(0)
+   : pkgPackageManager(Cache), pkgFailures(0), PackagesDone(0), PackagesTotal(0)
 {
    d = new pkgDPkgPMPrivate();
 }
@@ -417,6 +418,7 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf)
       
       // Create the pipes
       std::set<int> KeepFDs;
+      MergeKeepFdsFromConfiguration(KeepFDs);
       int Pipes[2];
       if (pipe(Pipes) != 0)
 	 return _error->Errno("pipe","Failed to create IPC pipe to subprocess");
@@ -595,7 +597,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(char *line)
       errors look like this:
       'status: /var/cache/apt/archives/krecipes_0.8.1-0ubuntu1_i386.deb : error : trying to overwrite `/usr/share/doc/kde/HTML/en/krecipes/krectip.png', which is also in package krecipes-data 
       and conffile-prompt like this
-      'status: conffile-prompt: conffile : 'current-conffile' 'new-conffile' useredited distedited
+      'status:/etc/compiz.conf/compiz.conf :  conffile-prompt: 'current-conffile' 'new-conffile' useredited distedited
    */
    if (prefix == "status")
    {
@@ -607,7 +609,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(char *line)
          WriteApportReport(list[1].c_str(), list[3].c_str());
          return;
       }
-      else if(action == "conffile")
+      else if(action == "conffile-prompt")
       {
          d->progress->ConffilePrompt(list[1], PackagesDone, PackagesTotal,
                                      list[3]);
@@ -1035,7 +1037,10 @@ void pkgDPkgPM::StartPtyMagic()
    if (tcgetattr(STDOUT_FILENO, &d->tt) == 0)
    {
        ioctl(1, TIOCGWINSZ, (char *)&win);
-       if (openpty(&d->master, &d->slave, NULL, &d->tt, &win) < 0)
+       if (_config->FindB("Dpkg::Use-Pty", true) == false)
+       {
+           d->master = d->slave = -1;
+       } else if (openpty(&d->master, &d->slave, NULL, &d->tt, &win) < 0)
        {
            _error->Errno("openpty", _("Can not write log (%s)"), _("Is /dev/pts mounted?"));
            d->master = d->slave = -1;
@@ -1181,7 +1186,7 @@ bool pkgDPkgPM::GoNoABIBreak(APT::Progress::PackageManager *progress)
    StartPtyMagic();
 
    // Tell the progress that its starting and fork dpkg 
-   d->progress->Start();
+   d->progress->Start(d->master);
 
    // this loop is runs once per dpkg operation
    vector<Item>::const_iterator I = List.begin();
@@ -1380,6 +1385,7 @@ bool pkgDPkgPM::GoNoABIBreak(APT::Progress::PackageManager *progress)
       d->progress->StartDpkg();
       std::set<int> KeepFDs;
       KeepFDs.insert(fd[1]);
+      MergeKeepFdsFromConfiguration(KeepFDs);
       pid_t Child = ExecFork(KeepFDs);
       if (Child == 0)
       {
@@ -1528,6 +1534,7 @@ bool pkgDPkgPM::GoNoABIBreak(APT::Progress::PackageManager *progress)
 	 if(stopOnError) 
 	 {
 	    CloseLog();
+            StopPtyMagic();
             d->progress->Stop();
 	    return false;
 	 }
@@ -1619,18 +1626,49 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
    }
 
    // do not report out-of-memory failures 
-   if(strstr(errormsg, strerror(ENOMEM)) != NULL) {
+   if(strstr(errormsg, strerror(ENOMEM)) != NULL ||
+      strstr(errormsg, "failed to allocate memory") != NULL) {
       std::clog << _("No apport report written because the error message indicates a out of memory error") << std::endl;
       return;
    }
 
-   // do not report dpkg I/O errors
-   // XXX - this message is localized, but this only matches the English version.  This is better than nothing.
-   if(strstr(errormsg, "short read in buffer_copy (")) {
-      std::clog << _("No apport report written because the error message indicates a dpkg I/O error") << std::endl;
+   // do not report bugs regarding inaccessible local files
+   if(strstr(errormsg, strerror(ENOENT)) != NULL ||
+      strstr(errormsg, "cannot access archive") != NULL) {
+      std::clog << _("No apport report written because the error message indicates an issue on the local system") << std::endl;
+      return;
+   }
+
+   // do not report errors encountered when decompressing packages
+   if(strstr(errormsg, "--fsys-tarfile returned error exit status 2") != NULL) {
+      std::clog << _("No apport report written because the error message indicates an issue on the local system") << std::endl;
       return;
    }
 
+   // do not report dpkg I/O errors, this is a format string, so we compare
+   // the prefix and the suffix of the error with the dpkg error message
+   vector<string> io_errors;
+   io_errors.push_back(string("failed to read on buffer copy for %s"));
+   io_errors.push_back(string("failed in write on buffer copy for %s"));
+   io_errors.push_back(string("short read on buffer copy for %s"));
+
+   for (vector<string>::iterator I = io_errors.begin(); I != io_errors.end(); I++)
+   {
+      vector<string> list = VectorizeString(dgettext("dpkg", (*I).c_str()), '%');
+      if (list.size() > 1) {
+         // we need to split %s, VectorizeString only allows char so we need
+         // to kill the "s" manually
+         if (list[1].size() > 1) {
+            list[1].erase(0, 1);
+            if(strstr(errormsg, list[0].c_str()) && 
+               strstr(errormsg, list[1].c_str())) {
+               std::clog << _("No apport report written because the error message indicates a dpkg I/O error") << std::endl;
+               return;
+            }
+         }
+      }
+   }
+
    // get the pkgname and reportfile
    pkgname = flNotDir(pkgpath);
    pos = pkgname.find('_');
@@ -1718,6 +1756,24 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
       if(log != NULL)
       {
 	 char buf[1024];
+	 while( fgets(buf, sizeof(buf), log) != NULL)
+	    fprintf(report, " %s", buf);
+         fprintf(report, " \n");
+	 fclose(log);
+      }
+   }
+
+   // attach history log it if we have it
+   string histfile_name = _config->FindFile("Dir::Log::History");
+   if (!histfile_name.empty())
+   {
+      FILE *log = NULL;
+      char buf[1024];
+
+      fprintf(report, "DpkgHistoryLog:\n");
+      log = fopen(histfile_name.c_str(),"r");
+      if(log != NULL)
+      {
 	 while( fgets(buf, sizeof(buf), log) != NULL)
 	    fprintf(report, " %s", buf);
 	 fclose(log);

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

@@ -89,7 +89,6 @@ class pkgDPkgPM : public pkgPackageManager
                                       const std::string &short_pkgname);
 
    // Terminal progress 
-   void SetupTerminalScrollArea(int nr_scrolled_rows);
    void SendTerminalProgress(float percentage);
 
    // apport integration

+ 1 - 1
apt-pkg/depcache.cc

@@ -1522,7 +1522,7 @@ bool pkgDepCache::SetCandidateRelease(pkgCache::VerIterator TargetVer,
 	 if (itsFine == false)
 	 {
 	    // change the candidate
-	    Changed.push_back(make_pair(oldCand, TargetVer));
+	    Changed.push_back(make_pair(V, TargetVer));
 	    if (SetCandidateRelease(V, TargetRel, Changed) == false)
 	    {
 	       if (stillOr == false)

+ 2 - 2
apt-pkg/indexfile.h

@@ -78,10 +78,10 @@ class pkgIndexFile
    virtual bool Exists() const = 0;
    virtual bool HasPackages() const = 0;
    virtual unsigned long Size() const = 0;
-   virtual bool Merge(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const { return false; };
+   virtual bool Merge(pkgCacheGenerator &Gen, OpProgress* Prog) const { return false; };
    __deprecated virtual bool Merge(pkgCacheGenerator &Gen, OpProgress &Prog) const
       { return Merge(Gen, &Prog); };
-   virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const {return true;};
+   virtual bool MergeFileProvides(pkgCacheGenerator &Gen,OpProgress* Prog) const {return true;};
    __deprecated virtual bool MergeFileProvides(pkgCacheGenerator &Gen, OpProgress &Prog) const
       {return MergeFileProvides(Gen, &Prog);};
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;

+ 5 - 0
apt-pkg/indexrecords.cc

@@ -27,6 +27,11 @@ string indexRecords::GetDist() const
    return this->Dist;
 }
 
+string indexRecords::GetSuite() const
+{
+   return this->Suite;
+}
+
 bool indexRecords::CheckDist(const string MaybeDist) const
 {
    return (this->Dist == MaybeDist

+ 1 - 0
apt-pkg/indexrecords.h

@@ -46,6 +46,7 @@ class indexRecords
 
    virtual bool Load(std::string Filename);
    std::string GetDist() const;
+   std::string GetSuite() const;
    time_t GetValidUntil() const;
    virtual bool CheckDist(const std::string MaybeDist) const;
    std::string GetExpectedDist() const;

+ 1 - 9
apt-pkg/init.cc

@@ -44,16 +44,8 @@ bool pkgInitConfig(Configuration &Cnf)
    Cnf.CndSet("APT::Install-Suggests", false);
    Cnf.CndSet("Dir","/");
    
-   // State   
+   // State
    Cnf.CndSet("Dir::State","var/lib/apt/");
-   
-   /* Just in case something goes horribly wrong, we can fall back to the
-      old /var/state paths.. */
-   struct stat St;   
-   if (stat("/var/lib/apt/.",&St) != 0 &&
-       stat("/var/state/apt/.",&St) == 0)
-      Cnf.CndSet("Dir::State","var/state/apt/");
-       
    Cnf.CndSet("Dir::State::lists","lists/");
    Cnf.CndSet("Dir::State::cdroms","cdroms.list");
    Cnf.CndSet("Dir::State::mirrors","mirrors/");

+ 58 - 15
apt-pkg/install-progress.cc

@@ -9,6 +9,8 @@
 #include <sys/ioctl.h>
 #include <sstream>
 #include <fcntl.h>
+#include <algorithm>
+#include <stdio.h>
 
 namespace APT {
 namespace Progress {
@@ -222,8 +224,46 @@ bool PackageManagerProgressDeb822Fd::StatusChanged(std::string PackageName,
 }
 
 
+PackageManagerFancy::PackageManagerFancy()
+   : child_pty(-1)
+{
+   // setup terminal size
+   old_SIGWINCH = signal(SIGWINCH, PackageManagerFancy::staticSIGWINCH);
+   instances.push_back(this);
+}
+std::vector<PackageManagerFancy*> PackageManagerFancy::instances;
+
+PackageManagerFancy::~PackageManagerFancy()
+{
+   instances.erase(find(instances.begin(), instances.end(), this));
+   signal(SIGWINCH, old_SIGWINCH);
+}
+
+void PackageManagerFancy::staticSIGWINCH(int signum)
+{
+   std::vector<PackageManagerFancy *>::const_iterator I;
+   for(I = instances.begin(); I != instances.end(); I++)
+      (*I)->HandleSIGWINCH(signum);
+}
+
+int PackageManagerFancy::GetNumberTerminalRows()
+{
+   struct winsize win;
+   // FIXME: get from "child_pty" instead?
+   if(ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&win) != 0)
+      return -1;
+
+   if(_config->FindB("Debug::InstallProgress::Fancy", false) == true)
+      std::cerr << "GetNumberTerminalRows: " << win.ws_row << std::endl;
+   
+   return win.ws_row;
+}
+
 void PackageManagerFancy::SetupTerminalScrollArea(int nr_rows)
 {
+     if(_config->FindB("Debug::InstallProgress::Fancy", false) == true)
+        std::cerr << "SetupTerminalScrollArea: " << nr_rows << std::endl;
+
      // scroll down a bit to avoid visual glitch when the screen
      // area shrinks by one row
      std::cout << "\n";
@@ -232,39 +272,41 @@ void PackageManagerFancy::SetupTerminalScrollArea(int nr_rows)
      std::cout << "\033[s";
          
      // set scroll region (this will place the cursor in the top left)
-     std::cout << "\033[1;" << nr_rows - 1 << "r";
+     std::cout << "\033[0;" << nr_rows - 1 << "r";
             
      // restore cursor but ensure its inside the scrolling area
      std::cout << "\033[u";
      static const char *move_cursor_up = "\033[1A";
      std::cout << move_cursor_up;
 
-     // setup env for (hopefully!) ncurses
-     string s;
-     strprintf(s, "%i", nr_rows);
-     setenv("LINES", s.c_str(), 1);
-
+     // ensure its flushed
      std::flush(std::cout);
+
+     // setup tty size to ensure xterm/linux console are working properly too
+     // see bug #731738
+     struct winsize win;
+     ioctl(child_pty, TIOCGWINSZ, (char *)&win);
+     win.ws_row = nr_rows - 1;
+     ioctl(child_pty, TIOCSWINSZ, (char *)&win);
 }
 
-PackageManagerFancy::PackageManagerFancy()
-   : nr_terminal_rows(-1)
+void PackageManagerFancy::HandleSIGWINCH(int)
 {
-   struct winsize win;
-   if(ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&win) == 0)
-   {
-      nr_terminal_rows = win.ws_row;
-   }
+   int nr_terminal_rows = GetNumberTerminalRows();
+   SetupTerminalScrollArea(nr_terminal_rows);
 }
 
-void PackageManagerFancy::Start()
+void PackageManagerFancy::Start(int a_child_pty)
 {
+   child_pty = a_child_pty;
+   int nr_terminal_rows = GetNumberTerminalRows();
    if (nr_terminal_rows > 0)
       SetupTerminalScrollArea(nr_terminal_rows);
 }
 
 void PackageManagerFancy::Stop()
 {
+   int nr_terminal_rows = GetNumberTerminalRows();
    if (nr_terminal_rows > 0)
    {
       SetupTerminalScrollArea(nr_terminal_rows + 1);
@@ -273,6 +315,7 @@ void PackageManagerFancy::Stop()
       static const char* clear_screen_below_cursor = "\033[J";
       std::cout << clear_screen_below_cursor;
    }
+   child_pty = -1;
 }
 
 bool PackageManagerFancy::StatusChanged(std::string PackageName, 
@@ -284,7 +327,7 @@ bool PackageManagerFancy::StatusChanged(std::string PackageName,
           HumanReadableAction))
       return false;
 
-   int row = nr_terminal_rows;
+   int row = GetNumberTerminalRows();
 
    static string save_cursor = "\033[s";
    static string restore_cursor = "\033[u";

+ 14 - 4
apt-pkg/install-progress.h

@@ -3,7 +3,8 @@
 
 #include <string>
 #include <unistd.h>
-
+#include <signal.h>
+#include <vector>
 
 namespace APT {
 namespace Progress {
@@ -28,7 +29,7 @@ namespace Progress {
     virtual ~PackageManager() {};
 
     /* Global Start/Stop */
-    virtual void Start() {};
+    virtual void Start(int child_pty=-1) {};
     virtual void Stop() {};
 
     /* When dpkg is invoked (may happen multiple times for each 
@@ -116,13 +117,22 @@ namespace Progress {
 
  class PackageManagerFancy : public PackageManager
  {
+ private:
+    static void staticSIGWINCH(int);
+    static std::vector<PackageManagerFancy*> instances;
+
  protected:
-    int nr_terminal_rows;
     void SetupTerminalScrollArea(int nr_rows);
+    void HandleSIGWINCH(int);
+
+    int GetNumberTerminalRows();
+    sighandler_t old_SIGWINCH;
+    int child_pty;
 
  public:
     PackageManagerFancy();
-    virtual void Start();
+    ~PackageManagerFancy();
+    virtual void Start(int child_pty=-1);
     virtual void Stop();
     virtual bool StatusChanged(std::string PackageName, 
                                unsigned int StepsDone,

+ 17 - 7
apt-pkg/metaindex.h

@@ -5,6 +5,7 @@
 #include <string>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/indexfile.h>
+#include <apt-pkg/init.h>
 
 #ifndef APT_8_CLEANER_HEADERS
 #include <apt-pkg/srcrecords.h>
@@ -28,27 +29,36 @@ class metaIndex
 
    public:
 
-   
    // Various accessors
    virtual std::string GetURI() const {return URI;}
    virtual std::string GetDist() const {return Dist;}
    virtual const char* GetType() const {return Type;}
 
+   // interface to to query it
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
+   // returns the path of the local file (or "" if its not available)
+   virtual std::string LocalFileName() const {return "";};
+#endif
+
    // Interface for acquire
-   virtual std::string ArchiveURI(std::string const& /*File*/) const = 0;
+   virtual std::string ArchiveURI(std::string const& File) const = 0;
    virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const = 0;
-   
    virtual std::vector<pkgIndexFile *> *GetIndexFiles() = 0; 
    virtual bool IsTrusted() const = 0;
 
-   metaIndex(std::string const &URI, std::string const &Dist, char const * const Type) :
-		Indexes(NULL), Type(Type), URI(URI), Dist(Dist) {
+   metaIndex(std::string const &URI, std::string const &Dist, 
+             char const * const Type) 
+      : Indexes(NULL), Type(Type), URI(URI), Dist(Dist)
+   {
+      /* nothing */
    }
 
-   virtual ~metaIndex() {
+   virtual ~metaIndex() 
+   {
       if (Indexes == 0)
 	 return;
-      for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin(); I != (*Indexes).end(); ++I)
+      for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin();
+           I != (*Indexes).end(); ++I)
 	 delete *I;
       delete Indexes;
    }

+ 4 - 0
apt-pkg/policy.cc

@@ -405,6 +405,10 @@ bool ReadPinFile(pkgPolicy &Plcy,string File)
    PreferenceSection Tags;
    while (TF.Step(Tags) == true)
    {
+      // can happen when there are only comments in a record
+      if (Tags.Count() == 0)
+         continue;
+
       string Name = Tags.FindS("Package");
       if (Name.empty() == true)
 	 return _error->Error(_("Invalid record in the preferences file %s, no Package header"), File.c_str());

+ 9 - 2
apt-pkg/tagfile.cc

@@ -259,7 +259,12 @@ bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength)
    TagCount = 0;
    while (TagCount+1 < sizeof(Indexes)/sizeof(Indexes[0]) && Stop < End)
    {
-       TrimRecord(true,End);
+      TrimRecord(true,End);
+
+      // this can happen when TrimRecord trims away the entire Record
+      // (e.g. because it just contains comments)
+      if(Stop == End)
+         return true;
 
       // Start a new index and add it to the hash
       if (isspace(Stop[0]) == 0)
@@ -273,7 +278,9 @@ bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength)
       if (Stop == 0)
 	 return false;
 
-      for (; Stop+1 < End && Stop[1] == '\r'; Stop++);
+      for (; Stop+1 < End && Stop[1] == '\r'; Stop++)
+         /* nothing */
+         ;
 
       // Double newline marks the end of the record
       if (Stop+1 < End && Stop[1] == '\n')

+ 1 - 1
apt-private/makefile

@@ -17,7 +17,7 @@ MAJOR=0.0
 MINOR=0
 SLIBS=$(PTHREADLIB) -lapt-pkg
 
-PRIVATES=list install download output cachefile cacheset update upgrade cmndline moo search show main
+PRIVATES=list install download output cachefile cacheset update upgrade cmndline moo search show main utils sources
 SOURCE += $(foreach private, $(PRIVATES), private-$(private).cc)
 HEADERS += $(foreach private, $(PRIVATES), private-$(private).h)
 

+ 6 - 1
apt-private/private-cmndline.cc

@@ -149,7 +149,11 @@ bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const * const
    else if (CmdMatches("build-dep"))
    {
       addArg('a', "host-architecture", "APT::Get::Host-Architecture", CommandLine::HasArg);
+      addArg(0, "purge", "APT::Get::Purge", 0);
       addArg(0, "solver", "APT::Solver", CommandLine::HasArg);
+      // this has no effect *but* sbuild is using it (see LP: #1255806)
+      // once sbuild is fixed, this option can be removed
+      addArg('f', "fix-broken", "APT::Get::Fix-Broken", 0);
    }
    else if (CmdMatches("clean", "autoclean", "check", "download", "changelog") ||
 	    CmdMatches("markauto", "unmarkauto")) // deprecated commands
@@ -222,7 +226,8 @@ bool addArgumentsAPT(std::vector<CommandLine::Args> &Args, char const * const Cm
    {
       addArg(0,"installed","APT::Cmd::Installed",0);
       addArg(0,"upgradable","APT::Cmd::Upgradable",0);
-      addArg('a', "all-versions", "APT::Cmd::AllVersions", 0);
+      addArg('v', "verbose", "APT::Cmd::List-Include-Summary", 0);
+      addArg('a', "all-versions", "APT::Cmd::All-Versions", 0);
    }
    else if (addArgumentsAPTGet(Args, Cmd) || addArgumentsAPTCache(Args, Cmd))
    {

+ 3 - 0
apt-private/private-install.h

@@ -95,6 +95,9 @@ struct TryToInstall {
 	 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)

+ 5 - 3
apt-private/private-list.cc

@@ -69,7 +69,7 @@ class PackageNameMatcher : public Matcher				/*{{{*/
             cachefilter = new APT::CacheFilter::PackageNameMatchesFnmatch(pattern);
 #else
          APT::CacheFilter::PackageMatcher *cachefilter = NULL;
-         if(_config->FindB("APT::Cmd::UseRegexp", false) == true)
+         if(_config->FindB("APT::Cmd::Use-Regexp", false) == true)
             cachefilter = new APT::CacheFilter::PackageNameMatchesRegEx(pattern);
          else
             cachefilter = new APT::CacheFilter::PackageNameMatchesFnmatch(pattern);
@@ -132,6 +132,8 @@ bool List(CommandLine &Cmd)
    std::map<std::string, std::string> output_map;
    std::map<std::string, std::string>::const_iterator K;
 
+   bool includeSummary = _config->FindB("APT::Cmd::List-Include-Summary");
+
    PackageNameMatcher matcher(patterns);
    LocalitySortedVersionSet bag;
    OpTextProgress progress;
@@ -143,13 +145,13 @@ bool List(CommandLine &Cmd)
    for (LocalitySortedVersionSet::iterator V = bag.begin(); V != bag.end(); V++)
    {
       std::stringstream outs;
-      if(_config->FindB("APT::Cmd::AllVersions", false) == true)
+      if(_config->FindB("APT::Cmd::All-Versions", false) == true)
       {
          ListAllVersions(CacheFile, records, V.ParentPkg(), outs);
          output_map.insert(std::make_pair<std::string, std::string>(
             V.ParentPkg().Name(), outs.str()));
       } else {
-         ListSingleVersion(CacheFile, records, V, outs);
+         ListSingleVersion(CacheFile, records, V, outs, includeSummary);
          output_map.insert(std::make_pair<std::string, std::string>(
                            V.ParentPkg().Name(), outs.str()));
       }

+ 8 - 4
apt-private/private-output.cc

@@ -158,7 +158,8 @@ std::string GetShortDescription(pkgCacheFile &CacheFile, pkgRecords &records, pk
 }
 									/*}}}*/
 void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records,	/*{{{*/
-                       pkgCache::VerIterator V, std::ostream &out)
+                       pkgCache::VerIterator V, std::ostream &out,
+                       bool include_summary)
 {
    pkgCache::PkgIterator P = V.ParentPkg();
 
@@ -224,9 +225,12 @@ void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records,	/*{{{*/
             out << GetVersion(CacheFile, V);
       }
       out << " " << GetArchitecture(CacheFile, P) << " ";
-      out << std::endl 
-                << "    " << GetShortDescription(CacheFile, records, P)
-                << std::endl;
+      if (include_summary)
+      {
+         out << std::endl 
+             << "    " << GetShortDescription(CacheFile, records, P)
+             << std::endl;
+      }
    }
 }
 									/*}}}*/

+ 2 - 1
apt-private/private-output.h

@@ -24,7 +24,8 @@ extern unsigned int ScreenWidth;
 
 bool InitOutput();
 void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records, 
-                       pkgCache::VerIterator V, std::ostream &out);
+                       pkgCache::VerIterator V, std::ostream &out,
+                       bool include_summary=true);
 
 
 

+ 59 - 0
apt-private/private-sources.cc

@@ -0,0 +1,59 @@
+
+#include <apt-pkg/hashes.h>
+#include <apti18n.h>
+
+#include "private-output.h"
+#include "private-sources.h"
+#include "private-utils.h"
+
+/* Interface discussion with donkult (for the future):
+  apt [add-{archive,release,component}|edit|change-release|disable]-sources 
+ and be clever and work out stuff from the Release file
+*/
+
+// EditSource - EditSourcesList         			        /*{{{*/
+// ---------------------------------------------------------------------
+bool EditSources(CommandLine &CmdL)
+{
+   bool res;
+   pkgSourceList sl;
+   std::string outs;
+
+   std::string sourceslist;
+   if (CmdL.FileList[1] != NULL)
+   {
+      sourceslist = _config->FindDir("Dir::Etc::sourceparts") + CmdL.FileList[1];
+      if (!APT::String::Endswith(sourceslist, ".list"))
+         sourceslist += ".list";
+   } else {
+      sourceslist = _config->FindFile("Dir::Etc::sourcelist");
+   }
+   HashString before;
+   if (FileExists(sourceslist))
+       before.FromFile(sourceslist);
+
+   do {
+      EditFileInSensibleEditor(sourceslist);
+      _error->PushToStack();
+      res = sl.Read(sourceslist);
+      if (!res) {
+         _error->DumpErrors();
+         strprintf(outs, _("Failed to parse %s. Edit again? "),
+                   sourceslist.c_str());
+         std::cout << outs;
+         // FIXME: should we add a "restore previous" option here?
+         res = !YnPrompt(true);
+      }
+      _error->RevertToStack();
+   } while (res == false);
+
+   if (FileExists(sourceslist) && !before.VerifyFile(sourceslist)) {
+      strprintf(
+         outs, _("Your '%s' file changed, please run 'apt-get update'."),
+         sourceslist.c_str());
+      std::cout << outs << std::endl;
+   }
+
+   return true;
+}
+									/*}}}*/

+ 3 - 0
apt-private/private-sources.h

@@ -0,0 +1,3 @@
+#include <apt-pkg/cmndline.h>
+
+bool EditSources(CommandLine &CmdL);

+ 50 - 0
apt-private/private-utils.cc

@@ -0,0 +1,50 @@
+#include <cstdlib>
+
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/fileutl.h>
+#include "private-utils.h"
+
+
+// DisplayFileInPager - Display File with pager        			/*{{{*/
+void DisplayFileInPager(std::string filename)
+{
+   std::string pager = _config->Find("Dir::Bin::Pager", 
+                                        "/usr/bin/sensible-pager");
+
+   pid_t Process = ExecFork();
+   if (Process == 0)
+   {
+      const char *Args[3];
+      Args[0] = pager.c_str();
+      Args[1] = filename.c_str();
+      Args[2] = 0;
+      execvp(Args[0],(char **)Args);
+      exit(100);
+   }
+         
+   // Wait for the subprocess
+   ExecWait(Process, "sensible-pager", false);
+}
+									/*}}}*/
+
+// EditFileInSensibleEditor - Edit File with editor    			/*{{{*/
+void EditFileInSensibleEditor(std::string filename)
+{
+   std::string editor = _config->Find("Dir::Bin::Editor", 
+                                        "/usr/bin/sensible-editor");
+
+   pid_t Process = ExecFork();
+   if (Process == 0)
+   {
+      const char *Args[3];
+      Args[0] = editor.c_str();
+      Args[1] = filename.c_str();
+      Args[2] = 0;
+      execvp(Args[0],(char **)Args);
+      exit(100);
+   }
+         
+   // Wait for the subprocess
+   ExecWait(Process, "sensible-editor", false);
+}
+									/*}}}*/

+ 11 - 0
apt-private/private-utils.h

@@ -0,0 +1,11 @@
+#ifndef APT_PRIVATE_UTILS_H
+#define APT_PRIVATE_UTILS_H
+
+#include<string>
+
+void DisplayFileInPager(std::string filename);
+void EditFileInSensibleEditor(std::string filename);
+
+
+
+#endif

+ 5 - 2
buildlib/po4a_manpage.mak

@@ -11,7 +11,7 @@
 
 # generate a list of accepted man page translations
 SOURCE = $(patsubst %.xml,%,$(wildcard *.$(LC).?.xml))
-INCLUDES = apt.ent apt-verbatim.ent
+INCLUDES = apt.ent apt-verbatim.ent apt-vendor.ent
 
 manpages:
 
@@ -29,7 +29,10 @@ clean: clean/$(LOCAL)
 veryclean: veryclean/$(LOCAL)
 
 apt-verbatim.ent: ../apt-verbatim.ent
-	cp ../apt-verbatim.ent .
+	cp -a ../apt-verbatim.ent .
+
+apt-vendor.ent: ../apt-vendor.ent
+	cp -a ../apt-vendor.ent .
 
 manpage-style.xsl: ../manpage-style.xsl
 	sed "/<!-- LANGUAGE -->/ i\

+ 3 - 8
cmdline/apt-extracttemplates.cc

@@ -47,8 +47,6 @@
 
 using namespace std;
 
-#define TMPDIR		"/tmp"
-
 pkgCache *DebFile::Cache = 0;
 
 // DebFile::DebFile - Construct the DebFile object			/*{{{*/
@@ -253,14 +251,11 @@ string WriteFile(const char *package, const char *prefix, const char *data)
 {
 	char fn[512];
 	static int i;
-	const char *tempdir = NULL;
-
-        tempdir = getenv("TMPDIR");
-        if (tempdir == NULL)
-             tempdir = TMPDIR;
 
+        std::string tempdir = GetTempDir();
 	snprintf(fn, sizeof(fn), "%s/%s.%s.%u%d",
-                 _config->Find("APT::ExtractTemplates::TempDir", tempdir).c_str(),
+                 _config->Find("APT::ExtractTemplates::TempDir", 
+                               tempdir.c_str()).c_str(),
                  package, prefix, getpid(), i++);
 	FileFd f;
 	if (data == NULL)

+ 165 - 57
cmdline/apt-get.cc

@@ -50,6 +50,8 @@
 #include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/indexfile.h>
 #include <apt-pkg/upgrade.h>
+#include <apt-pkg/metaindex.h>
+#include <apt-pkg/indexrecords.h>
 
 #include <apt-private/private-download.h>
 #include <apt-private/private-install.h>
@@ -59,6 +61,9 @@
 #include <apt-private/private-update.h>
 #include <apt-private/private-cmndline.h>
 #include <apt-private/private-moo.h>
+#include <apt-private/private-utils.h>
+
+#include <apt-pkg/debmetaindex.h>
 
 #include <apt-private/acqprogress.h>
 
@@ -129,24 +134,95 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache,
    return true;
 }
 									/*}}}*/
+
+
+// helper that can go wit hthe next ABI break
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13)
+std::string MetaIndexFileNameOnDisk(metaIndex *metaindex)
+{
+   // FIXME: this cast is the horror, the horror
+   debReleaseIndex *r = (debReleaseIndex*)metaindex;
+
+   // see if we have a InRelease file
+   std::string PathInRelease =  r->MetaIndexFile("InRelease");
+   if (FileExists(PathInRelease))
+      return PathInRelease;
+
+   // and if not return the normal one
+   if (FileExists(PathInRelease))
+      return r->MetaIndexFile("Release");
+
+   return "";
+}
+#endif
+
+// GetReleaseForSourceRecord - Return Suite for the given srcrecord	/*{{{*/
+// ---------------------------------------------------------------------
+/* */
+std::string GetReleaseForSourceRecord(pkgSourceList *SrcList,
+                                      pkgSrcRecords::Parser *Parse)
+{
+   // try to find release
+   const pkgIndexFile& CurrentIndexFile = Parse->Index();
+
+   for (pkgSourceList::const_iterator S = SrcList->begin(); 
+        S != SrcList->end(); ++S)
+   {
+      vector<pkgIndexFile *> *Indexes = (*S)->GetIndexFiles();
+      for (vector<pkgIndexFile *>::const_iterator IF = Indexes->begin();
+           IF != Indexes->end(); ++IF)
+      {
+         if (&CurrentIndexFile == (*IF))
+         {
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13)
+            std::string path = MetaIndexFileNameOnDisk(*S);
+#else
+            std::string path = (*S)->LocalFileName();
+#endif
+            if (path != "") 
+            {
+               indexRecords records;
+               records.Load(path);
+               return records.GetSuite();
+            }
+         }
+      }
+   }
+   return "";
+}
+									/*}}}*/
 // FindSrc - Find a source record					/*{{{*/
 // ---------------------------------------------------------------------
 /* */
 pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
 			       pkgSrcRecords &SrcRecs,string &Src,
-			       pkgDepCache &Cache)
+			       CacheFile &CacheFile)
 {
-   string VerTag;
-   string DefRel = _config->Find("APT::Default-Release");
+   string VerTag, UserRequestedVerTag;
+   string ArchTag = "";
+   string RelTag = _config->Find("APT::Default-Release");
    string TmpSrc = Name;
+   pkgDepCache *Cache = CacheFile.GetDepCache();
 
-   // extract the version/release from the pkgname
-   const size_t found = TmpSrc.find_last_of("/=");
-   if (found != string::npos) {
-      if (TmpSrc[found] == '/')
-	 DefRel = TmpSrc.substr(found+1);
-      else
-	 VerTag = TmpSrc.substr(found+1);
+   // extract release
+   size_t found = TmpSrc.find_last_of("/");
+   if (found != string::npos) 
+   {
+      RelTag = TmpSrc.substr(found+1);
+      TmpSrc = TmpSrc.substr(0,found);
+   }
+   // extract the version
+   found = TmpSrc.find_last_of("=");
+   if (found != string::npos) 
+   {
+      VerTag = UserRequestedVerTag = TmpSrc.substr(found+1);
+      TmpSrc = TmpSrc.substr(0,found);
+   }
+   // extract arch 
+   found = TmpSrc.find_last_of(":");
+   if (found != string::npos) 
+   {
+      ArchTag = TmpSrc.substr(found+1);
       TmpSrc = TmpSrc.substr(0,found);
    }
 
@@ -154,10 +230,25 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
       install a version and determine the source package name, then look
       in the archive for a source package of the same name. */
    bool MatchSrcOnly = _config->FindB("APT::Get::Only-Source");
-   const pkgCache::PkgIterator Pkg = Cache.FindPkg(TmpSrc);
+   pkgCache::PkgIterator Pkg;
+   if (ArchTag != "")
+      Pkg = Cache->FindPkg(TmpSrc, ArchTag);
+   else
+      Pkg = Cache->FindPkg(TmpSrc);
+
+   // if we can't find a package but the user qualified with a arch,
+   // error out here
+   if (Pkg.end() && ArchTag != "")
+   {
+      Src = Name;
+      _error->Error(_("Can not find a package for architecture '%s'"),
+                    ArchTag.c_str());
+      return 0;
+   }
+
    if (MatchSrcOnly == false && Pkg.end() == false) 
    {
-      if(VerTag.empty() == false || DefRel.empty() == false) 
+      if(VerTag != "" || RelTag != "" || ArchTag != "")
       {
 	 bool fuzzy = false;
 	 // we have a default release, try to locate the pkg. we do it like
@@ -177,9 +268,20 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
 	       if (Ver.end() == true)
 		  break;
 	    }
+
+            // ignore arches that are not for us
+            if (ArchTag != "" && Ver.Arch() != ArchTag)
+               continue;
+
+            // pick highest version for the arch unless the user wants
+            // something else
+            if (ArchTag != "" && VerTag == "" && RelTag == "")
+               if(Cache->VS().CmpVersion(VerTag, Ver.VerStr()) < 0)
+                  VerTag = Ver.VerStr();
+
 	    // We match against a concrete version (or a part of this version)
 	    if (VerTag.empty() == false &&
-		(fuzzy == true || Cache.VS().CmpVersion(VerTag, Ver.VerStr()) != 0) && // exact match
+		(fuzzy == true || Cache->VS().CmpVersion(VerTag, Ver.VerStr()) != 0) && // exact match
 		(fuzzy == false || strncmp(VerTag.c_str(), Ver.VerStr(), VerTag.size()) != 0)) // fuzzy match
 	       continue;
 
@@ -197,8 +299,8 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
 
 	       // or we match against a release
 	       if(VerTag.empty() == false ||
-		  (VF.File().Archive() != 0 && VF.File().Archive() == DefRel) ||
-		  (VF.File().Codename() != 0 && VF.File().Codename() == DefRel)) 
+		  (VF.File().Archive() != 0 && VF.File().Archive() == RelTag) ||
+		  (VF.File().Codename() != 0 && VF.File().Codename() == RelTag)) 
 	       {
 		  pkgRecords::Parser &Parse = Recs.Lookup(VF);
 		  Src = Parse.SourcePkg();
@@ -216,22 +318,28 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
 	    if (Src.empty() == false)
 	       break;
 	 }
-	 if (Src.empty() == true) 
-	 {
-	    // Sources files have no codename information
-	    if (VerTag.empty() == true && DefRel.empty() == false) 
-	    {
-	       _error->Error(_("Ignore unavailable target release '%s' of package '%s'"), DefRel.c_str(), TmpSrc.c_str());
-	       return 0;
-	    }
-	 }
       }
+
+      if (Src == "" && ArchTag != "")
+      {
+         if (VerTag != "")
+            _error->Error(_("Can not find a package '%s' with version '%s'"),
+                          Pkg.FullName().c_str(), VerTag.c_str());
+         if (RelTag != "")
+            _error->Error(_("Can not find a package '%s' with release '%s'"),
+                          Pkg.FullName().c_str(), RelTag.c_str());
+         Src = Name;
+         return 0;
+      }
+
+
       if (Src.empty() == true)
       {
 	 // if we don't have found a fitting package yet so we will
 	 // choose a good candidate and proceed with that.
 	 // Maybe we will find a source later on with the right VerTag
-	 pkgCache::VerIterator Ver = Cache.GetCandidateVer(Pkg);
+         // or RelTag
+	 pkgCache::VerIterator Ver = Cache->GetCandidateVer(Pkg);
 	 if (Ver.end() == false) 
 	 {
 	    pkgRecords::Parser &Parse = Recs.Lookup(Ver.FileList());
@@ -243,7 +351,9 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
    }
 
    if (Src.empty() == true)
+   {
       Src = TmpSrc;
+   }
    else 
    {
       /* if we have a source pkg name, make sure to only search
@@ -261,6 +371,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
    pkgSrcRecords::Parser *Last = 0;
    unsigned long Offset = 0;
    string Version;
+   pkgSourceList *SrcList = CacheFile.GetSourceList();
 
    /* Iterate over all of the hits, which includes the resulting
       binary packages in the search */
@@ -272,26 +383,43 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
       {
 	 const string Ver = Parse->Version();
 
+         // See if we need to look for a specific release tag
+         if (RelTag != "" && UserRequestedVerTag == "")
+         {
+            const string Rel = GetReleaseForSourceRecord(SrcList, Parse);
+
+            if (Rel == RelTag)
+            {
+               Last = Parse;
+               Offset = Parse->Offset();
+               Version = Ver;
+            }
+         }
+
 	 // Ignore all versions which doesn't fit
 	 if (VerTag.empty() == false &&
-	     Cache.VS().CmpVersion(VerTag, Ver) != 0) // exact match
+	     Cache->VS().CmpVersion(VerTag, Ver) != 0) // exact match
 	    continue;
 
 	 // Newer version or an exact match? Save the hit
-	 if (Last == 0 || Cache.VS().CmpVersion(Version,Ver) < 0) {
+	 if (Last == 0 || Cache->VS().CmpVersion(Version,Ver) < 0) {
 	    Last = Parse;
 	    Offset = Parse->Offset();
 	    Version = Ver;
 	 }
 
-	 // was the version check above an exact match? If so, we don't need to look further
-	 if (VerTag.empty() == false && VerTag.size() == Ver.size())
+	 // was the version check above an exact match?
+         // If so, we don't need to look further
+         if (VerTag.empty() == false && (VerTag == Ver))
 	    break;
       }
+      if (UserRequestedVerTag == "" && Version != "" && RelTag != "")
+         ioprintf(c1out, "Selected version '%s' (%s) for %s\n", 
+                  Version.c_str(), RelTag.c_str(), Src.c_str());
+
       if (Last != 0 || VerTag.empty() == true)
 	 break;
-      //if (VerTag.empty() == false && Last == 0)
-      _error->Error(_("Ignore unavailable version '%s' of package '%s'"), VerTag.c_str(), TmpSrc.c_str());
+      _error->Error(_("Can not find version '%s' of package '%s'"), VerTag.c_str(), TmpSrc.c_str());
       return 0;
    }
 
@@ -627,7 +755,7 @@ bool DoSource(CommandLine &CmdL)
    for (const char **I = CmdL.FileList + 1; *I != 0; I++, J++)
    {
       string Src;
-      pkgSrcRecords::Parser *Last = FindSrc(*I,Recs,SrcRecs,Src,*Cache);
+      pkgSrcRecords::Parser *Last = FindSrc(*I,Recs,SrcRecs,Src,Cache);
       
       if (Last == 0) {
 	 delete[] Dsc;
@@ -924,7 +1052,7 @@ bool DoBuildDep(CommandLine &CmdL)
    for (const char **I = CmdL.FileList + 1; *I != 0; I++, J++)
    {
       string Src;
-      pkgSrcRecords::Parser *Last = FindSrc(*I,Recs,SrcRecs,Src,*Cache);
+      pkgSrcRecords::Parser *Last = FindSrc(*I,Recs,SrcRecs,Src,Cache);
       if (Last == 0)
 	 return _error->Error(_("Unable to find a source package for %s"),Src.c_str());
             
@@ -1378,24 +1506,6 @@ bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher,
    return _error->Error("changelog download failed");
 }
 									/*}}}*/
-// DisplayFileInPager - Display File with pager        			/*{{{*/
-void DisplayFileInPager(string filename)
-{
-   pid_t Process = ExecFork();
-   if (Process == 0)
-   {
-      const char *Args[3];
-      Args[0] = "/usr/bin/sensible-pager";
-      Args[1] = filename.c_str();
-      Args[2] = 0;
-      execvp(Args[0],(char **)Args);
-      exit(100);
-   }
-         
-   // Wait for the subprocess
-   ExecWait(Process, "sensible-pager", false);
-}
-									/*}}}*/
 // DoChangelog - Get changelog from the command line			/*{{{*/
 // ---------------------------------------------------------------------
 bool DoChangelog(CommandLine &CmdL)
@@ -1426,14 +1536,12 @@ bool DoChangelog(CommandLine &CmdL)
    bool const downOnly = _config->FindB("APT::Get::Download-Only", false);
 
    char tmpname[100];
-   char* tmpdir = NULL;
+   const char* tmpdir = NULL;
    if (downOnly == false)
    {
-      const char* const tmpDir = getenv("TMPDIR");
-      if (tmpDir != NULL && *tmpDir != '\0')
-	 snprintf(tmpname, sizeof(tmpname), "%s/apt-changelog-XXXXXX", tmpDir);
-      else
-	 strncpy(tmpname, "/tmp/apt-changelog-XXXXXX", sizeof(tmpname));
+      std::string systemTemp = GetTempDir();
+      snprintf(tmpname, sizeof(tmpname), "%s/apt-changelog-XXXXXX", 
+               systemTemp.c_str());
       tmpdir = mkdtemp(tmpname);
       if (tmpdir == NULL)
 	 return _error->Errno("mkdtemp", "mkdtemp failed");

+ 42 - 17
cmdline/apt-key

@@ -25,17 +25,18 @@ GPG_CMD="$GPG_CMD --no-auto-check-trustdb --trust-model always"
 
 GPG="$GPG_CMD"
 
-MASTER_KEYRING=""
-#MASTER_KEYRING=/usr/share/keyrings/debian-master-keyring.gpg
-eval $(apt-config shell MASTER_KEYRING APT::Key::MasterKeyring)
-ARCHIVE_KEYRING_URI=""
-#ARCHIVE_KEYRING_URI=http://ftp.debian.org/debian/debian-archive-keyring.gpg
-eval $(apt-config shell ARCHIVE_KEYRING_URI APT::Key::ArchiveKeyringURI)
+APT_DIR="/"
+eval $(apt-config shell APT_DIR Dir)
 
-ARCHIVE_KEYRING=/usr/share/keyrings/debian-archive-keyring.gpg
+MASTER_KEYRING='&keyring-master-filename;'
+eval $(apt-config shell MASTER_KEYRING APT::Key::MasterKeyring)
+ARCHIVE_KEYRING='&keyring-filename;'
 eval $(apt-config shell ARCHIVE_KEYRING APT::Key::ArchiveKeyring)
-REMOVED_KEYS=/usr/share/keyrings/debian-archive-removed-keys.gpg
+REMOVED_KEYS='&keyring-removed-filename;'
 eval $(apt-config shell REMOVED_KEYS APT::Key::RemovedKeys)
+ARCHIVE_KEYRING_URI='&keyring-uri;'
+eval $(apt-config shell ARCHIVE_KEYRING_URI APT::Key::ArchiveKeyringURI)
+TMP_KEYRING=${APT_DIR}/var/lib/apt/keyrings/maybe-import-keyring.gpg
 
 requires_root() {
 	if [ "$(id -u)" -ne 0 ]; then
@@ -57,7 +58,7 @@ init_keyring() {
 add_keys_with_verify_against_master_keyring() {
     ADD_KEYRING=$1
     MASTER=$2
-    
+
     if [ ! -f "$ADD_KEYRING" ]; then
 	echo "ERROR: '$ADD_KEYRING' not found"
 	return
@@ -72,12 +73,28 @@ add_keys_with_verify_against_master_keyring() {
     #   all keys that are exported must have a valid signature
     #   from a key in the $distro-master-keyring
     add_keys=`$GPG_CMD --keyring $ADD_KEYRING --with-colons --list-keys | grep ^pub | cut -d: -f5`
+    all_add_keys=`$GPG_CMD --keyring $ADD_KEYRING --with-colons --list-keys | grep ^[ps]ub | cut -d: -f5`
     master_keys=`$GPG_CMD --keyring $MASTER --with-colons --list-keys | grep ^pub | cut -d: -f5`
+
+    # ensure there are no colisions LP: #857472
+    for all_add_key in $all_add_keys; do
+	for master_key in $master_keys; do
+            if [ "$all_add_key" = "$master_key" ]; then
+                echo >&2 "Keyid collision for '$all_add_key' detected, operation aborted"
+                return 1
+            fi
+        done
+    done
+    
     for add_key in $add_keys; do
-	ADDED=0
+        # export the add keyring one-by-one
+        rm -f $TMP_KEYRING
+        $GPG_CMD --keyring $ADD_KEYRING --output $TMP_KEYRING --export $add_key 
+        # check if signed with the master key and only add in this case
+        ADDED=0
 	for master_key in $master_keys; do
-	    if $GPG_CMD --keyring $ADD_KEYRING --list-sigs --with-colons $add_key | grep ^sig | cut -d: -f5 | grep -q $master_key; then
-		$GPG_CMD --quiet --batch --keyring $ADD_KEYRING --export $add_key | $GPG --import
+	    if $GPG_CMD --keyring $MASTER --keyring $TMP_KEYRING --check-sigs --with-colons $add_key | grep '^sig:!:' | cut -d: -f5 | grep -q $master_key; then
+		$GPG --import $TMP_KEYRING
 		ADDED=1
 	    fi
 	done
@@ -85,12 +102,20 @@ add_keys_with_verify_against_master_keyring() {
 	    echo >&2 "Key '$add_key' not added. It is not signed with a master key"
 	fi
     done
+    rm -f $TMP_KEYRING
 }
 
 # update the current archive signing keyring from a network URI
 # the archive-keyring keys needs to be signed with the master key
 # (otherwise it does not make sense from a security POV)
 net_update() {
+    # Disabled for now as code is insecure (LP: #1013639 (and 857472, 1013128))
+    APT_KEY_NET_UPDATE_ENABLED=""
+    eval $(apt-config shell APT_KEY_NET_UPDATE_ENABLED APT::Key::Net-Update-Enabled)
+    if [ -z "$APT_KEY_NET_UPDATE_ENABLED" ]; then
+        exit 1
+    fi
+
     if [ -z "$ARCHIVE_KEYRING_URI" ]; then
 	echo >&2 "ERROR: Your distribution is not supported in net-update as no uri for the archive-keyring is set"
 	exit 1
@@ -102,15 +127,15 @@ net_update() {
 	echo >&2 "ERROR: an installed wget is required for a network-based update"
 	exit 1
     fi
-    if [ ! -d /var/lib/apt/keyrings ]; then
-	mkdir -p /var/lib/apt/keyrings
+    if [ ! -d ${APT_DIR}/var/lib/apt/keyrings ]; then
+	mkdir -p ${APT_DIR}/var/lib/apt/keyrings
     fi
-    keyring=/var/lib/apt/keyrings/$(basename $ARCHIVE_KEYRING)
+    keyring=${APT_DIR}/var/lib/apt/keyrings/$(basename $ARCHIVE_KEYRING_URI)
     old_mtime=0
     if [ -e $keyring ]; then
 	old_mtime=$(stat -c %Y $keyring)
     fi
-    (cd  /var/lib/apt/keyrings; wget -q -N $ARCHIVE_KEYRING_URI)
+    (cd  ${APT_DIR}/var/lib/apt/keyrings; wget --timeout=90 -q -N $ARCHIVE_KEYRING_URI)
     if [ ! -e $keyring ]; then
 	return
     fi
@@ -124,7 +149,7 @@ net_update() {
 update() {
     if [ ! -f $ARCHIVE_KEYRING ]; then
 	echo >&2 "ERROR: Can't find the archive-keyring"
-	echo >&2 "Is the debian-archive-keyring package installed?"
+	echo >&2 "Is the &keyring-package; package installed?"
 	exit 1
     fi
     requires_root

+ 9 - 0
cmdline/apt.cc

@@ -41,6 +41,7 @@
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/indexfile.h>
 #include <apt-pkg/metaindex.h>
+#include <apt-pkg/hashes.h>
 
 #include <apti18n.h>
 
@@ -54,8 +55,12 @@
 #include <apt-private/private-upgrade.h>
 #include <apt-private/private-show.h>
 #include <apt-private/private-main.h>
+#include <apt-private/private-utils.h>
+#include <apt-private/private-sources.h>
 									/*}}}*/
 
+
+
 bool ShowHelp(CommandLine &CmdL)
 {
    ioprintf(c1out,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
@@ -74,6 +79,8 @@ bool ShowHelp(CommandLine &CmdL)
       " update - update list of available packages\n"
       " install - install packages\n"
       " upgrade - upgrade the systems packages\n"
+      "\n"
+      " edit-sources - edit the source information file\n"
        );
    
    return true;
@@ -89,6 +96,8 @@ int main(int argc, const char *argv[])					/*{{{*/
                                    {"remove", &DoInstall},
                                    {"update",&DoUpdate},
                                    {"upgrade",&DoUpgradeWithAllowNewPackages},
+                                   // misc
+                                   {"edit-sources",&EditSources},
                                    // helper
                                    {"moo",&DoMoo},
                                    {"help",&ShowHelp},

+ 8 - 0
cmdline/makefile

@@ -41,6 +41,14 @@ SOURCE = apt-cdrom.cc
 include $(PROGRAM_H)
 
 # The apt-key program
+apt-key: apt-key.in
+	sed -e "s#&keyring-filename;#$(shell ../vendor/getinfo keyring-filename)#" \
+		-e "s#&keyring-removed-filename;#$(shell ../vendor/getinfo keyring-removed-filename)#" \
+		-e "s#&keyring-master-filename;#$(shell ../vendor/getinfo keyring-master-filename)#" \
+		-e "s#&keyring-uri;#$(shell ../vendor/getinfo keyring-uri)#" \
+		-e "s#&keyring-package;#$(shell ../vendor/getinfo keyring-package)#" $< > $@
+	chmod 755 $@
+
 SOURCE=apt-key
 TO=$(BIN)
 TARGET=program

+ 1 - 1
configure.ac

@@ -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="0.9.9.4"
+PACKAGE_VERSION="0.9.14.2"
 PACKAGE_MAIL="APT Development Team <deity@lists.debian.org>"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"$PACKAGE_VERSION")

+ 2 - 2
debian/apt.cron.daily

@@ -197,11 +197,11 @@ check_size_constraints()
 		    delta=$(($now-$ctime))
 		fi
 		if [ $delta -le $MinAge ]; then
-		    debug_echo "skip remove by archive size:  $file, delta=$delta < $MinAgeSec"
+		    debug_echo "skip remove by archive size:  $file, delta=$delta < $MinAge"
 		    break
 		else
 		    # delete oldest file
-		    debug_echo "remove by archive size: $file, delta=$delta >= $MinAgeSec (sec), size=$size >= $MaxSize"
+		    debug_echo "remove by archive size: $file, delta=$delta >= $MinAge (sec), size=$size >= $MaxSize"
 		    rm -f $file
 		fi
 	    fi

+ 92 - 0
debian/changelog

@@ -1,3 +1,95 @@
+apt (0.9.14.2) unstable; urgency=low
+
+  [ Joe Hansen ]
+  * Danish translation update. Closes: #732166
+  
+  [ Peter Green ]
+  * add apt-vendor for raspbian. Closes: #732749
+
+  [ Thomas Bechtold ]
+  * apt-pkg/contrib/gpgv.cc: use /tmp as fallback dir if the
+    directory from $TMPDIR  is not available (closes: #728500)
+  
+  [ Michael Vogt ]
+  * vendor/getinfo:
+    - fix ubuntu-codename
+  * vendor/steamos/*:
+    - add steamos support
+  * bugfix/bts731738-fancy-progess:
+    - fix terminal size issues with e.g. "less" when "APT::Progress-Fancy=1"
+      is used (closes: #731738)
+  * feature/policy-parser-bts732746:
+    - allow more flexibility in /etc/apt/preferences, e.g. comment only
+      sections (closes: #732746)
+  * move TMPDIR handling into GetTempDir() and use that instead of
+    getenv("TMPDIR")
+  * update apt-key net-update and add integration test with the buildin
+    apt webserver
+  * run autopkgtest against the installed apt
+
+ -- Michael Vogt <mvo@debian.org>  Sun, 29 Dec 2013 16:41:16 +0100
+
+apt (0.9.14.1) unstable; urgency=medium
+
+  * fix apt-get source -t dist regression (closes: #731853)
+    and add testcase
+  * clarify error message when apt-get source=ver fails
+    (thans to David Kalnischkies)
+  * Fix conffile prompt regression (LP: #1260297)
+    and add testcase
+  * improve error message for apt-get source pkg:arch{=ver,/release}
+
+ -- Michael Vogt <mvo@debian.org>  Thu, 12 Dec 2013 18:34:29 +0100
+
+apt (0.9.14) unstable; urgency=low
+
+  [ David Kalnischkies ]
+  * merge ubuntus apport reporting changes to reduce diff
+  * enable NOISE for build logs to enable analyse
+  * introduce a vendor system to change sources.list
+  * add a vendor specific file to have configurable entities
+  * use a substvar to set the archive-keyring in debian/control
+  * cherry-pick ubuntus (disabled) net-update fixes
+  * generate apt-key script with vendor info about keys
+  * drop old /var/state to /var/lib transition artefacts
+
+  [ Steve Langasek ]
+  * prepare-release: declare the packages needed as source build deps.
+
+  [ Michael Vogt ]
+  * enable release based selection for deb-src (closes: 731102)
+  * document Dpkg::Progress-Fancy (closes: 726169), thanks to James McCoy
+  * vendor/makefile: fix build error for parallel builds
+  * Handle SIGWINCH in APT::Progress-Fancy=1
+
+ -- Michael Vogt <mvo@debian.org>  Sat, 07 Dec 2013 14:54:31 +0100
+
+apt (0.9.13.1) unstable; urgency=low
+
+  [ Colin Watson ]
+  * fix "apt-get  --purge build-dep" (closes: #720597)
+  * fix regression that APT::Keep-Fds is not honored (closes: #730490)
+  
+  [ Michael Vogt ]
+  * add "-f" option to "build-dep" as sbuild is using it to fix 
+    regression with cross-building (LP: #1255806)
+  * add autopkgtest support for the integration testsuite
+  * merge mvo/feature/short-list
+  * merge mvo/feature/edit-sources
+  * fix segfault in pkgDepCache::SetCandidateRelease() (closes: #709560)
+  * reset terminal on error (closes: #730795)
+  * fix apport report writing (LP: #1254499)
+
+ -- Michael Vogt <mvo@debian.org>  Fri, 29 Nov 2013 20:50:17 +0100
+
+apt (0.9.13) unstable; urgency=low
+
+  [ TJ Guthrie ]
+  * Changed MinAgeSec to MinAge in /etc/cron.daily/apt:200,204 
+    LP: #1206047
+
+ -- Michael Vogt <mvo@debian.org>  Sun, 24 Nov 2013 10:56:22 +0100
+
 apt (0.9.13~exp1) experimental; urgency=low
 
   * Improve the API for APT::Upgrade::Upgrade()

+ 2 - 1
debian/control

@@ -13,10 +13,11 @@ Build-Depends-Indep: doxygen, debiandoc-sgml
 Build-Conflicts: autoconf2.13, automake1.4
 Vcs-Git: git://anonscm.debian.org/apt/apt.git
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=apt/apt.git
+XS-Testsuite: autopkgtest
 
 Package: apt
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, debian-archive-keyring, gnupg
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${apt:keyring}, gnupg
 Replaces: manpages-pl (<< 20060617-3~), manpages-it (<< 2.80-4~)
 Breaks: manpages-pl (<< 20060617-3~), manpages-it (<< 2.80-4~)
 Conflicts: python-apt (<< 0.7.93.2~)

+ 0 - 1
debian/gbp.conf

@@ -1,6 +1,5 @@
 [DEFAULT]
 prebuild = ./prepare-release pre-export
 postbuild = ./prepare-release post-build
-export-dir = ../build-area
 debian-branch = debian/sid
 debian-tag = %(version)s

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 79 - 3
debian/libapt-pkg4.12.symbols


+ 0 - 32
debian/preinst

@@ -1,32 +0,0 @@
-#! /bin/sh
-
-set -e
-
-# dpkg does this for us while we are upgrading..
-#if [ "$1" = "upgrade" -a -L /var/state/apt -a -e /var/lib/apt -a ! -L /var/state/apt ] && dpkg --compare-versions "$2" ">=" "0.4.10"; then
-#  rm /var/state/apt
-#fi
-
-if [ "$1" = "upgrade" -o "$1" = "install" -a "$2" != "" ]; then
-  if [ ! -e /var/lib/apt -a -e /var/state/apt ]; then
-    # upgrading from /var/state/apt using apt.
-    # it's probably running now so we want to ensure /var/state/apt
-    # is still valid afterwards. and since we're upgrading
-
-    if [ -x /usr/bin/perl -a -d /var/state/apt -a ! -L /var/state/apt ] &&
-      perl -e 'exit 1 if ((stat("/var/lib"))[0] != (stat("/var/state/apt"))[0])'
-    then
-      # same fs, we can mv it
-      mv /var/state/apt /var/lib/apt
-      ln -s ../lib/apt /var/state/apt
-      # note that this symlink (/var/state/apt) will be removed when
-      # dpkg finishes unpacking the apt we're about to install; this is okay
-    else
-      # scary, let's just symlink it and hope
-      ln -s /var/state/apt /var/lib/apt
-    fi
-  fi
-  touch /var/lib/apt/lists/partial/.delete-me-later || true
-fi
-
-#DEBHELPER#

+ 4 - 1
debian/rules

@@ -3,6 +3,9 @@
 # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
 # Some lines taken from debmake, by Christoph Lameter.
 
+# build in verbose mode by default to make it easy to diangose issues
+export NOISY=1
+
 export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
@@ -216,7 +219,7 @@ apt: build-binary build-manpages debian/apt.install
 	dh_fixperms -p$@
 	dh_installdeb -p$@
 	dh_shlibdeps -p$@
-	dh_gencontrol -p$@
+	dh_gencontrol -p$@ -- -Vapt:keyring="$(shell ./vendor/getinfo keyring-package)"
 	dh_md5sums -p$@
 	dh_builddeb -p$@
 

+ 2 - 0
debian/tests/control

@@ -0,0 +1,2 @@
+Tests: run-tests
+Depends: @, 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

+ 18 - 0
debian/tests/run-tests

@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+# auto-package-test is very unhappy if stuff it writen to stderr
+exec 2> apt-stderr.log
+
+# we need the buildin webserver for the tests
+if [ ! -e environment.mak ]; then
+    ./configure
+fi
+make -C test/interactive-helper/
+
+# run against the installed apt
+APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR=$(pwd)/build/bin \
+APT_INTEGRATION_TESTS_METHODS_DIR=/usr/lib/apt/methods \
+APT_INTEGRATION_TESTS_BUILD_DIR=/usr/bin \
+./test/integration/run-tests

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

@@ -8,6 +8,8 @@
 <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent">
 %aptverbatiment;
 
+<!ENTITY % aptvendor SYSTEM "apt-vendor.ent">
+%aptvendor;
 ]>
 
 <refentry>

+ 2 - 0
doc/apt-cdrom.8.xml

@@ -8,6 +8,8 @@
 <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent">
 %aptverbatiment;
 
+<!ENTITY % aptvendor SYSTEM "apt-vendor.ent">
+%aptvendor;
 ]>
 
 <refentry>

+ 2 - 0
doc/apt-config.8.xml

@@ -8,6 +8,8 @@
 <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent">
 %aptverbatiment;
 
+<!ENTITY % aptvendor SYSTEM "apt-vendor.ent">
+%aptvendor;
 ]>
 
 <refentry>

+ 2 - 0
doc/apt-extracttemplates.1.xml

@@ -8,6 +8,8 @@
 <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent">
 %aptverbatiment;
 
+<!ENTITY % aptvendor SYSTEM "apt-vendor.ent">
+%aptvendor;
 ]>
 
 <refentry>

+ 2 - 0
doc/apt-ftparchive.1.xml

@@ -8,6 +8,8 @@
 <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent">
 %aptverbatiment;
 
+<!ENTITY % aptvendor SYSTEM "apt-vendor.ent">
+%aptvendor;
 ]>
 
 <refentry>

+ 3 - 1
doc/apt-get.8.xml

@@ -8,6 +8,8 @@
 <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent">
 %aptverbatiment;
 
+<!ENTITY % aptvendor SYSTEM "apt-vendor.ent">
+%aptvendor;
 ]>
 
 <refentry>
@@ -526,7 +528,7 @@
      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.
-     <literal>DpkgPM::Progress</literal>.</para></listitem>
+     Configuration Item: <literal>DpkgPM::Progress</literal> and <literal>Dpkg::Progress-Fancy</literal>.</para></listitem>
      </varlistentry>
     
 

+ 7 - 5
doc/apt-key.8.xml

@@ -8,6 +8,8 @@
 <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent">
 %aptverbatiment;
 
+<!ENTITY % aptvendor SYSTEM "apt-vendor.ent">
+%aptvendor;
 ]>
 
 <refentry>
@@ -130,7 +132,7 @@
        Update the local keyring with the archive keyring and remove from
        the local keyring the archive keys which are no longer valid.
        The archive keyring is shipped in the <literal>archive-keyring</literal> package of your
-       distribution, e.g. the <literal>debian-archive-keyring</literal> package in Debian.
+       distribution, e.g. the &keyring-package; package in &keyring-distro;.
 
      </para>
 
@@ -180,12 +182,12 @@
      <listitem><para>Local trust database of archive keys.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term><filename>/usr/share/keyrings/debian-archive-keyring.gpg</filename></term>
-     <listitem><para>Keyring of Debian archive trusted keys.</para></listitem>
+     <varlistentry><term>&keyring-filename;</term>
+     <listitem><para>Keyring of &keyring-distro; archive trusted keys.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term><filename>/usr/share/keyrings/debian-archive-removed-keys.gpg</filename></term>
-     <listitem><para>Keyring of Debian archive removed trusted keys.</para></listitem>
+     <varlistentry><term>&keyring-removed-filename;</term>
+     <listitem><para>Keyring of &keyring-distro; archive removed trusted keys.</para></listitem>
      </varlistentry>
 
    </variablelist>

+ 2 - 0
doc/apt-mark.8.xml

@@ -8,6 +8,8 @@
 <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent">
 %aptverbatiment;
 
+<!ENTITY % aptvendor SYSTEM "apt-vendor.ent">
+%aptvendor;
 ]>
 
 <refentry>

+ 5 - 3
doc/apt-secure.8.xml

@@ -8,6 +8,8 @@
 <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent">
 %aptverbatiment;
 
+<!ENTITY % aptvendor SYSTEM "apt-vendor.ent">
+%aptvendor;
 ]>
 
 <refentry>
@@ -103,10 +105,10 @@
    the maintainer signature is stripped off, and checksums of the package
    are computed and put in the Packages file. The checksums of all of the
    Packages files are then computed and put into the Release file. The
-   Release file is then signed by the archive key for this Debian release,
+   Release file is then signed by the archive key for this &keyring-distro; release,
    and distributed alongside the packages and the Packages files on
-   Debian mirrors. The keys are in the Debian archive keyring available in
-   the <package>debian-archive-keyring</package> package.
+   &keyring-distro; mirrors. The keys are in the &keyring-distro; archive keyring
+   available in the &keyring-package; package.
    </para>
 
    <para>

+ 2 - 0
doc/apt-sortpkgs.1.xml

@@ -8,6 +8,8 @@
 <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent">
 %aptverbatiment;
 
+<!ENTITY % aptvendor SYSTEM "apt-vendor.ent">
+%aptvendor;
 ]>
 
 <refentry>

+ 4 - 4
doc/apt-verbatim.ent

@@ -219,14 +219,14 @@
 ">
 
 <!-- this will be updated by 'prepare-release' -->
-<!ENTITY apt-product-version "0.9.7.6ubuntu2">
+<!ENTITY apt-product-version "0.9.14.2">
 
-<!-- Codenames for debian releases -->
+<!-- (Code)names for various things used all over the place -->
 <!ENTITY oldstable-codename "squeeze">
 <!ENTITY stable-codename "wheezy">
 <!ENTITY testing-codename "jessie">
-<!ENTITY stable-version "7.0">
-<!ENTITY ubuntu-codename "precise">
+<!ENTITY stable-version "7">
+<!ENTITY ubuntu-codename "trusty">
 
 <!-- good and bad just refers to matching and not matching a pattern…
      It is not a remark about the specific perl version.

+ 2 - 0
doc/apt.conf.5.xml

@@ -8,6 +8,8 @@
 <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent">
 %aptverbatiment;
 
+<!ENTITY % aptvendor SYSTEM "apt-vendor.ent">
+%aptvendor;
 ]>
 
 <refentry>

+ 2 - 0
doc/apt_preferences.5.xml

@@ -8,6 +8,8 @@
 <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent">
 %aptverbatiment;
 
+<!ENTITY % aptvendor SYSTEM "apt-vendor.ent">
+%aptvendor;
 ]>
 
 <refentry>

+ 5 - 2
doc/en/makefile

@@ -9,12 +9,15 @@ include ../../buildlib/defaults.mak
 ifdef XSLTPROC
 # generate a list of accepted man page translations
 SOURCE = $(patsubst ../%.xml,%,$(wildcard ../*.?.xml))
-INCLUDES = ../apt.ent ../apt-verbatim.ent
+INCLUDES = ../apt.ent ../apt-verbatim.ent apt-vendor.ent
 STYLESHEET=../manpage-style.xsl
 
 LOCAL := manpage-$(firstword $(SOURCE))
 $(LOCAL)-LIST := $(SOURCE)
 
+apt-vendor.ent: ../../vendor/current/apt-vendor.ent
+	ln -sf $(shell readlink -f $^) $@
+
 # Install generation hooks
 manpages: $($(LOCAL)-LIST) apt.8
 
@@ -30,7 +33,7 @@ apt.8: ../apt.8
 veryclean: clean/$(LOCAL)
 clean: clean/$(LOCAL)
 clean/$(LOCAL):
-	-rm -rf $($(@F)-LIST) apt.8
+	-rm -rf $($(@F)-LIST) apt.8 apt-vendor.ent
 endif
 
 # Chain to the manpage rule

+ 12 - 5
doc/makefile

@@ -12,8 +12,11 @@ include $(DEBIANDOC_H)
 
 doc: manpages debiandoc
 
-examples/sources.list: examples/sources.list.in apt-verbatim.ent
-	sed -e 's#&stable-codename;#$(shell grep --max-count=1 '^<!ENTITY stable-codename "' apt-verbatim.ent | cut -d'"' -f 2)#g' examples/sources.list.in > examples/sources.list
+examples/sources.list: ../vendor/current/sources.list
+	ln -sf $(shell readlink -f $^) $@
+
+apt-vendor.ent: ../vendor/current/apt-vendor.ent
+	ln -sf $(shell readlink -f $^) $@
 
 # Examples
 SOURCE = examples/apt.conf examples/sources.list examples/configure-index examples/apt-https-method-example.conf
@@ -23,9 +26,9 @@ include $(COPY_H)
 
 .PHONY: clean clean/subdirs veryclean veryclean/subdirs manpages/subdirs debiandoc/subdirs all binary doc stats
 
-clean: clean/subdirs
-veryclean: veryclean/subdirs
-manpages: manpages/subdirs
+clean: clean/subdirs clean/examples
+veryclean: veryclean/subdirs clean/examples
+manpages: apt-vendor.ent manpages/subdirs
 debiandoc: debiandoc/subdirs
 
 DOCUMENTATIONPO = $(patsubst %.po,%,$(notdir $(wildcard po/*.po)))
@@ -41,6 +44,10 @@ debiandoc/subdirs manpages/subdirs clean/subdirs veryclean/subdirs:
 		$(MAKE) -C $$dir $(patsubst %/subdirs,%,$@); \
 	done
 
+clean/examples:
+	rm -f examples/sources.list
+	rm -f apt-vendor.ent
+
 stats:
 	for i in po/*.po; do echo -n "$$i: "; msgfmt --output-file=/dev/null --statistics $$i; done
 

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 717 - 643
doc/po/apt-doc.pot


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 802 - 676
doc/po/de.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 801 - 676
doc/po/es.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 797 - 674
doc/po/fr.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 800 - 675
doc/po/it.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 787 - 676
doc/po/ja.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 779 - 676
doc/po/pl.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 799 - 675
doc/po/pt.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 738 - 665
doc/po/pt_BR.po


+ 2 - 0
doc/sources.list.5.xml

@@ -8,6 +8,8 @@
 <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent">
 %aptverbatiment;
 
+<!ENTITY % aptvendor SYSTEM "apt-vendor.ent">
+%aptvendor;
 ]>
 
 <refentry>

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1196 - 1145
po/ar.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1341 - 1266
po/ast.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1362 - 1287
po/bg.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1012 - 1014
po/bs.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1351 - 1274
po/ca.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1353 - 1278
po/cs.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1335 - 1263
po/cy.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1334 - 1416
po/da.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1384 - 1308
po/de.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1319 - 1250
po/dz.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1333 - 1263
po/el.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1356 - 1280
po/es.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1334 - 1262
po/eu.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1331 - 1259
po/fi.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1395 - 1312
po/fr.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1359 - 1281
po/gl.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1358 - 1289
po/hu.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1381 - 1300
po/it.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1367 - 1293
po/ja.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1301 - 1232
po/km.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1334 - 1259
po/ko.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1069 - 1068
po/ku.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1211 - 1149
po/lt.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1321 - 1248
po/mr.po


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1340 - 1264
po/nb.po


+ 0 - 0
po/ne.po


Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov