]> git.saurik.com Git - apt.git/commitdiff
merge 'after squeeze release'-stuff
authorDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 3 Feb 2011 13:22:32 +0000 (14:22 +0100)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 3 Feb 2011 13:22:32 +0000 (14:22 +0100)
[ David Kalnischkies ]
* apt-pkg/depcache.cc:
  - add SetCandidateRelease() to set a candidate version and
    the candidates of dependencies if needed to a specified
    release (Closes: #572709)
* cmdline/apt-get.cc:
  - if --print-uris is used don't setup downloader as we don't need
    progress, lock nor the directories it would create otherwise
  - show dependencies of essential packages which are going to remove
    only if they cause the remove of this essential (Closes: #601961)
  - keep not installed garbage packages uninstalled instead of showing
    in the autoremove section and installing those (Closes: #604222)
  - change pkg/release behavior to use the new SetCandidateRelease
    so installing packages from experimental or backports is easier
  - really do not show packages in the extra section if they were
    requested on the commandline, e.g. with a modifier (Closes: #184730)
* debian/control:
  - add Vcs-Browser now that loggerhead works again (Closes: #511168)
  - depend on debhelper 7 to raise compat level
  - depend on dpkg-dev (>= 1.15.8) to have c++ symbol mangling
* apt-pkg/contrib/fileutl.cc:
  - add a RealFileExists method and check that your configuration files
    are real files to avoid endless loops if not (Closes: #604401)
  - ignore non-regular files in GetListOfFilesInDir (Closes: #594694)
* apt-pkg/contrib/weakptr.h:
  - include stddefs.h to fix compile error (undefined NULL) with gcc-4.6
* methods/https.cc:
  - fix CURLOPT_SSL_VERIFYHOST by really passing 2 to it if enabled
* deb/dpkgpm.cc:
  - fix popen/fclose mismatch reported by cppcheck. Thanks to Petter
    Reinholdtsen for report and patch! (Closes: #607803)
* doc/apt.conf.5.xml:
  - fix multipl{y,e} spelling error reported by Jakub Wilk (Closes: #607636)
* apt-inst/contrib/extracttar.cc:
  - let apt-utils work with encoded tar headers if uid/gid are large.
    Thanks to Nobuhiro Hayashi for the patch! (Closes: #330162)
* apt-pkg/cacheiterator.h:
  - do not segfault if cache is not build (Closes: #254770)
* doc/apt-get.8.xml:
  - remove duplicated mentioning of --install-recommends
* doc/sources.list.5.xml:
  - remove obsolete references to non-us (Closes: #594495)
* debian/rules:
  - use -- instead of deprecated -u for dh_gencontrol
  - remove shlibs.local creation and usage
  - show differences in the symbol files, but never fail
* pre-build.sh:
  - remove as it is not needed for a working 'bzr bd'
* debian/{apt,apt-utils}.symbols:
  - ship experimental unmangled c++ symbol files
* methods/rred.cc:
  - operate optional on gzip compressed pdiffs
* apt-pkg/acquire-item.cc:
  - don't uncompress downloaded pdiff files before feeding it to rred
  - try downloading clearsigned InRelease before trying Release.gpg
  - change the internal handling of Extensions in pkgAcqIndex
  - add a special uncompressed compression type to prefer those files
  - download and use i18n/Index to choose which Translations to download
* cmdline/apt-key:
  - don't set trustdb-name as non-root so 'list' and 'finger'
    can be used without being root (Closes: #393005, #592107)
* apt-pkg/deb/deblistparser.cc:
  - rewrite LoadReleaseInfo to cope with clearsigned Releasefiles
* ftparchive/writer.cc:
  - add config option to search for more patterns in release command
  - include Index files by default in the Release file
* methods/{gzip,bzip}.cc:
  - print a good error message if FileSize() is zero
* apt-pkg/aptconfiguration.cc:
  - remove the inbuilt Translation files whitelist

15 files changed:
apt-pkg/cdrom.cc
apt-pkg/contrib/strutl.cc
apt-pkg/contrib/strutl.h
apt-pkg/deb/dpkgpm.cc
apt-pkg/init.cc
cmdline/apt-get.cc
debian/NEWS
debian/apt.conf.autoremove
debian/changelog
doc/apt-get.8.xml
doc/examples/configure-index
methods/cdrom.cc
methods/http.cc
test/integration/framework
test/integration/test-changelog [new file with mode: 0755]

index 0e36f44a27a0f7c9912808f213e8550c4484f7b0..04ace10a63320cc13337c38ffaaf49ec0a797cda 100644 (file)
@@ -198,7 +198,7 @@ int pkgCdrom::Score(string Path)
    // a symlink gets a big penalty
    struct stat Buf;
    string statPath = flNotFile(Path);
-   string cdromPath = _config->FindDir("Acquire::cdrom::mount","/cdrom/");
+   string cdromPath = _config->FindDir("Acquire::cdrom::mount");
    while(statPath != cdromPath && statPath != "./") {
       statPath.resize(statPath.size()-1);  // remove the trailing '/'
       if (lstat(statPath.c_str(),&Buf) == 0) {
@@ -509,7 +509,7 @@ bool pkgCdrom::Ident(string &ident, pkgCdromStatus *log)            /*{{{*/
    stringstream msg;
 
    // Startup
-   string CDROM = _config->FindDir("Acquire::cdrom::mount","/cdrom/");
+   string CDROM = _config->FindDir("Acquire::cdrom::mount");
    if (CDROM[0] == '.')
       CDROM= SafeGetCWD() + '/' + CDROM;
 
@@ -568,7 +568,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log)                                     /*{{{*/
    stringstream msg;
 
    // Startup
-   string CDROM = _config->FindDir("Acquire::cdrom::mount","/cdrom/");
+   string CDROM = _config->FindDir("Acquire::cdrom::mount");
    if (CDROM[0] == '.')
       CDROM= SafeGetCWD() + '/' + CDROM;
    
index f3704581044252ee39fb06959932bda0aaf402a0..2e2bb5ebcdfdfb985c427d2f16d403730b9f67aa 100644 (file)
@@ -1191,6 +1191,15 @@ char *safe_snprintf(char *Buffer,char *End,const char *Format,...)
    return Buffer + Did;
 }
                                                                        /*}}}*/
+// StripEpoch - Remove the version "epoch" from a version string       /*{{{*/
+// ---------------------------------------------------------------------
+string StripEpoch(const string &VerStr)
+{
+   size_t i = VerStr.find(":");
+   if (i == string::npos)
+      return VerStr;
+   return VerStr.substr(i+1);
+}
 
 // tolower_ascii - tolower() function that ignores the locale          /*{{{*/
 // ---------------------------------------------------------------------
index 6e0e253cf35e918a4629884384e607baf41c4adf..89cbf0370008f6c7db8c0909d159321811e6a66b 100644 (file)
@@ -62,6 +62,7 @@ void strprintf(string &out,const char *format,...) __like_printf(2);
 char *safe_snprintf(char *Buffer,char *End,const char *Format,...) __like_printf(3);
 bool CheckDomainList(const string &Host, const string &List);
 int tolower_ascii(int const c) __attrib_const __hot;
+string StripEpoch(const string &VerStr);
 
 #define APT_MKSTRCMP(name,func) \
 inline int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));}; \
index 3b10e1a23eaadcf8b943c7a1db192d94c751c253..7d0d34a460cd1e27dfd9c748e04558fca5cd8278 100644 (file)
@@ -1226,7 +1226,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
            strprintf(dpkg_error, "Sub-process %s exited unexpectedly",Args[0]);
 
         if(dpkg_error.size() > 0)
-           _error->Error(dpkg_error.c_str());
+           _error->Error("%s", dpkg_error.c_str());
 
         if(stopOnError) 
         {
index 734f5b2c442ac3ea1b1d1c7602e4be3e9a6f6073..a30f278441ff4ff9b5840a4719ac529ab757acb2 100644 (file)
@@ -52,7 +52,7 @@ bool pkgInitConfig(Configuration &Cnf)
    Cnf.Set("Dir::State::lists","lists/");
    Cnf.Set("Dir::State::cdroms","cdroms.list");
    Cnf.Set("Dir::State::mirrors","mirrors/");
-   
+
    // Cache
    Cnf.Set("Dir::Cache","var/cache/apt/");
    Cnf.Set("Dir::Cache::archives","archives/");
@@ -88,6 +88,9 @@ bool pkgInitConfig(Configuration &Cnf)
    // Translation
    Cnf.Set("APT::Acquire::Translation", "environment");
 
+   // Default cdrom mount point
+   Cnf.Set("Acquire::cdrom::mount", "/media/cdrom/");
+
    bool Res = true;
    
    // Read an alternate config file
index 0a22fd42baa05d7acd3aae50237cb8930c50011a..e93d12c2b908b9b43e986d9e779f9a60884bbf8b 100644 (file)
@@ -2200,6 +2200,59 @@ bool DoAutoClean(CommandLine &CmdL)
       Cleaner.Go(_config->FindDir("Dir::Cache::archives") + "partial/",*Cache);
 }
                                                                        /*}}}*/
+// DoDownload - download a binary                                      /*{{{*/
+// ---------------------------------------------------------------------
+bool DoDownload(CommandLine &CmdL)
+{
+   CacheFile Cache;
+   if (Cache.ReadOnlyOpen() == false)
+      return false;
+   
+   APT::CacheSetHelper helper(c0out);
+   APT::VersionSet verset = APT::VersionSet::FromCommandLine(Cache,
+               CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper);
+   pkgAcquire Fetcher;
+   AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0));
+   Fetcher.Setup(&Stat);
+
+   if (verset.empty() == true)
+      return false;
+
+   pkgRecords Recs(Cache);
+   pkgSourceList *SrcList = Cache.GetSourceList();
+   for (APT::VersionSet::const_iterator Ver = verset.begin(); 
+        Ver != verset.end(); 
+        ++Ver) 
+   {
+      string descr;
+      // get the right version
+      pkgCache::PkgIterator Pkg = Ver.ParentPkg();
+      pkgRecords::Parser &rec=Recs.Lookup(Ver.FileList());
+      pkgCache::VerFileIterator Vf = Ver.FileList();
+      if (Vf.end() == true)
+         return _error->Error("Can not find VerFile");
+      pkgCache::PkgFileIterator F = Vf.File();
+      pkgIndexFile *index;
+      if(SrcList->FindIndex(F, index) == false)
+         return _error->Error("FindIndex failed");
+      string uri = index->ArchiveURI(rec.FileName());
+      strprintf(descr, _("Downloading %s %s"), Pkg.Name(), Ver.VerStr());
+      // get the most appropriate hash
+      HashString hash;
+      if (rec.SHA256Hash() != "")
+         hash = HashString("sha256", rec.SHA256Hash());
+      else if (rec.SHA1Hash() != "")
+         hash = HashString("sha1", rec.SHA1Hash());
+      else if (rec.MD5Hash() != "")
+         hash = HashString("md5", rec.MD5Hash());
+      // get the file
+      new pkgAcqFile(&Fetcher, uri, hash.toStr(), (*Ver)->Size, descr, Pkg.Name(), ".");
+   }
+   bool result = (Fetcher.Run() == pkgAcquire::Continue);
+
+   return result;
+}
+                                                                       /*}}}*/
 // DoCheck - Perform the check operation                               /*{{{*/
 // ---------------------------------------------------------------------
 /* Opening automatically checks the system, this command is mostly used
@@ -2768,6 +2821,169 @@ bool DoBuildDep(CommandLine &CmdL)
    return true;
 }
                                                                        /*}}}*/
+// GetChangelogPath - return a path pointing to a changelog file or dir /*{{{*/
+// ---------------------------------------------------------------------
+/* This returns a "path" string for the changelog url construction.
+ * Please note that its not complete, it either needs a "/changelog"
+ * appended (for the packages.debian.org/changelogs site) or a
+ * ".changelog" (for third party sites that store the changelog in the
+ * pool/ next to the deb itself)
+ * Example return: "pool/main/a/apt/apt_0.8.8ubuntu3" 
+ */
+string GetChangelogPath(CacheFile &Cache, 
+                        pkgCache::PkgIterator Pkg,
+                        pkgCache::VerIterator Ver)
+{
+   string path;
+
+   pkgRecords Recs(Cache);
+   pkgRecords::Parser &rec=Recs.Lookup(Ver.FileList());
+   string srcpkg = rec.SourcePkg().empty() ? Pkg.Name() : rec.SourcePkg();
+   string ver = Ver.VerStr();
+   // if there is a source version it always wins
+   if (rec.SourceVer() != "")
+      ver = rec.SourceVer();
+   path = flNotFile(rec.FileName());
+   path += srcpkg + "_" + StripEpoch(ver);
+   return path;
+}
+                                                                       /*}}}*/
+// GuessThirdPartyChangelogUri - return url                            /*{{{*/
+// ---------------------------------------------------------------------
+/* Contruct a changelog file path for third party sites that do not use
+ * packages.debian.org/changelogs
+ * This simply uses the ArchiveURI() of the source pkg and looks for
+ * a .changelog file there, Example for "mediabuntu":
+ * apt-get changelog mplayer-doc:
+ *  http://packages.medibuntu.org/pool/non-free/m/mplayer/mplayer_1.0~rc4~try1.dsfg1-1ubuntu1+medibuntu1.changelog
+ */
+bool GuessThirdPartyChangelogUri(CacheFile &Cache, 
+                                 pkgCache::PkgIterator Pkg,
+                                 pkgCache::VerIterator Ver,
+                                 string &out_uri)
+{
+   // get the binary deb server path
+   pkgCache::VerFileIterator Vf = Ver.FileList();
+   if (Vf.end() == true)
+      return false;
+   pkgCache::PkgFileIterator F = Vf.File();
+   pkgIndexFile *index;
+   pkgSourceList *SrcList = Cache.GetSourceList();
+   if(SrcList->FindIndex(F, index) == false)
+      return false;
+
+   // get archive uri for the binary deb
+   string path_without_dot_changelog = GetChangelogPath(Cache, Pkg, Ver);
+   out_uri = index->ArchiveURI(path_without_dot_changelog + ".changelog");
+
+   // now strip away the filename and add srcpkg_srcver.changelog
+   return true;
+}
+// DownloadChangelog - Download the changelog                          /*{{{*/
+// ---------------------------------------------------------------------
+bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher, 
+                       pkgCache::VerIterator Ver, string targetfile)
+/* Download a changelog file for the given package version to
+ * targetfile. This will first try the server from Apt::Changelogs::Server
+ * (http://packages.debian.org/changelogs by default) and if that gives
+ * a 404 tries to get it from the archive directly (see 
+ * GuessThirdPartyChangelogUri for details how)
+ */
+{
+   string path;
+   string descr;
+   string server;
+   string changelog_uri;
+
+   // data structures we need
+   pkgCache::PkgIterator Pkg = Ver.ParentPkg();
+
+   // make the server root configurable
+   server = _config->Find("Apt::Changelogs::Server",
+                          "http://packages.debian.org/changelogs");
+   path = GetChangelogPath(CacheFile, Pkg, Ver);
+   strprintf(changelog_uri, "%s/%s/changelog", server.c_str(), path.c_str());
+   strprintf(descr, _("Changelog for %s (%s)"), Pkg.Name(), changelog_uri.c_str());
+   // queue it
+   new pkgAcqFile(&Fetcher, changelog_uri, "", 0, descr, Pkg.Name(), "ignored", targetfile);
+
+   // try downloading it, if that fails, they third-party-changelogs location
+   // FIXME: res is "Continue" even if I get a 404?!?
+   int res = Fetcher.Run();
+   if (!FileExists(targetfile))
+   {
+      string third_party_uri;
+      if (GuessThirdPartyChangelogUri(CacheFile, Pkg, Ver, third_party_uri))
+      {
+         strprintf(descr, _("Changelog for %s (%s)"), Pkg.Name(), third_party_uri.c_str());
+         new pkgAcqFile(&Fetcher, third_party_uri, "", 0, descr, Pkg.Name(), "ignored", targetfile);
+         res = Fetcher.Run();
+      }
+   }
+
+   if (FileExists(targetfile))
+      return true;
+
+   // error
+   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)
+{
+   CacheFile Cache;
+   if (Cache.ReadOnlyOpen() == false)
+      return false;
+   
+   APT::CacheSetHelper helper(c0out);
+   APT::VersionSet verset = APT::VersionSet::FromCommandLine(Cache,
+               CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper);
+   pkgAcquire Fetcher;
+   AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0));
+   Fetcher.Setup(&Stat);
+
+   if (verset.empty() == true)
+      return false;
+   char *tmpdir = mkdtemp(strdup("/tmp/apt-changelog-XXXXXX"));
+   if (tmpdir == NULL) {
+      return _error->Errno("mkdtemp", "mkdtemp failed");
+   }
+   
+   for (APT::VersionSet::const_iterator Ver = verset.begin(); 
+        Ver != verset.end(); 
+        ++Ver) 
+   {
+      string changelogfile = string(tmpdir) + "changelog";
+      if (DownloadChangelog(Cache, Fetcher, Ver, changelogfile))
+         DisplayFileInPager(changelogfile);
+      // cleanup temp file
+      unlink(changelogfile.c_str());
+   }
+   // clenaup tmp dir
+   rmdir(tmpdir);
+   free(tmpdir);
+   return true;
+}
+                                                                       /*}}}*/
 // DoMoo - Never Ask, Never Tell                                       /*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -2860,6 +3076,8 @@ bool ShowHelp(CommandLine &CmdL)
       "   check - Verify that there are no broken dependencies\n"
       "   markauto - Mark the given packages as automatically installed\n"
       "   unmarkauto - Mark the given packages as manually installed\n"
+      "   changelog - Download and display the changelog for the given package\n"
+      "   download - Download the binary package into the current directory\n"
       "\n"
       "Options:\n"
       "  -h  This help text.\n"
@@ -2958,6 +3176,8 @@ int main(int argc,const char *argv[])                                     /*{{{*/
                                    {"autoclean",&DoAutoClean},
                                    {"check",&DoCheck},
                                   {"source",&DoSource},
+                                   {"download",&DoDownload},
+                                   {"changelog",&DoChangelog},
                                   {"moo",&DoMoo},
                                   {"help",&ShowHelp},
                                    {0,0}};
index 59b319b864f651ba3b59a597ff5c8f1417556f05..91b71225f734bbadc5f35bde3f9b648812a3e8dd 100644 (file)
@@ -1,4 +1,4 @@
-apt (0.8.11+wheezy) UNRELEASED; urgency=low
+apt (0.8.11) UNRELEASED; urgency=low
 
   * apt-get install pkg/experimental will now not only switch the
     candidate of package pkg to the version from the release experimental
index b3f4a3edd9f5f5c1330b732af458f527fc8704c9..ebe49c7cd4b16bd5bc5a405add6b3a5bd8494bb3 100644 (file)
@@ -8,6 +8,7 @@ APT
        "^kfreebsd-image.*";
        "^linux-restricted-modules.*";
        "^linux-ubuntu-modules-.*";
+       "^gnumach$";
   };
 
   Never-MarkAuto-Sections
index b3da322478e4084ffae4d8be692040dfd2d47a02..52565473270c204e9ec0826899fd1fb8e1719496 100644 (file)
@@ -1,5 +1,6 @@
-apt (0.8.11+wheezy) unstable; urgency=low
+apt (0.8.11) UNRELEASED; urgency=low
 
+  [ David Kalnischkies ]
   * apt-pkg/depcache.cc:
     - add SetCandidateRelease() to set a candidate version and
       the candidates of dependencies if needed to a specified
@@ -70,6 +71,22 @@ apt (0.8.11+wheezy) unstable; urgency=low
   * apt-pkg/aptconfiguration.cc:
     - remove the inbuilt Translation files whitelist
 
+  [ Michael Vogt ]
+  * methods/http.cc:
+    - do not hang if Acquire::http::ProxyAutoDetect can not be
+      executed or returns no data (LP: #654393)
+  * debian/apt.conf.autoremove:
+    - never autoremove the GNU/Hurd kernel (closes: #588423), thanks
+      to Guillem Jover
+  * apt-pkg/cdrom.cc, apt-pkg/init.cc, methods/cdrom.cc:
+    - use /media/cdrom as default mountoint (closes: #611569)
+
+  [ Martin Pitt ]
+  * test/integration/test-compressed-indexes, test/test-indexes.sh:
+    - Explicitly disable compressed indexes at the start. This ensures that we
+      will actually test uncompressed indexes regardless of the internal
+      default value of Acquire::GzipIndexes.
+
  -- David Kalnischkies <kalnischkies@gmail.com>  Fri, 28 Jan 2011 12:22:25 +0100
 
 apt (0.8.10.3) unstable; urgency=low
index 1f14c6bd5c1b65d3bd8f7d75daf5c95fed70a215..1688c91366acd7be046b0a97ed72fa61553bd1f2 100644 (file)
      for broken dependencies.</para></listitem>
      </varlistentry>
 
+     <varlistentry><term>download</term>
+       <listitem><para><literal>download</literal> will download the given
+           binary package into the current directoy.
+       </para></listitem>
+     </varlistentry>
+
      <varlistentry><term>clean</term>
      <listitem><para><literal>clean</literal> clears out the local repository of retrieved package 
      files. It removes everything but the lock file from 
      <listitem><para><literal>autoremove</literal> is used to remove packages that were automatically
      installed to satisfy dependencies for some package and that are no more needed.</para></listitem>
      </varlistentry>
+
+     <varlistentry><term>changelog</term>
+       <listitem><para><literal>changelog</literal> downloads a package changelog and displays
+           it through <command>sensible-pager</command>. The server name and base
+           directory is defined in the <literal>APT::Changelogs::Server</literal>
+           variable (e. g. <ulink>http://packages.debian.org/changelogs</ulink> for
+           Debian or <ulink>http://changelogs.ubuntu.com/changelogs</ulink> for
+           Ubuntu).
+           By default it displays the changelog for the version that is
+           installed.  However, you can specify the same options as for
+           the <option>install</option> command.
+         </para>
+       </listitem>
+     </varlistentry>
+
+
+
    </variablelist>
  </refsect1>
  
index fd14d4dd75d20b315b2ddd5566022279093fe5d4..6119d67d081e4f4b392d10b3c19c9c2328ab5923 100644 (file)
@@ -115,54 +115,62 @@ APT
   // does a ExecFork)
   Keep-Fds {};
 
+  Changelogs
+  {
+    // server the provides the changelogs, the code will assume
+    // the changlogs are in the pool/ under a srcpkg_ver directory 
+    // with the name "changelog"
+    Server "http://packages.debian.org/changelogs";
+  }:
+
   // control parameters for cron jobs by /etc/cron.daily/apt
   Periodic
   {
-  BackupArchiveInterval "0";
-  // - Backup after n-days if archive contents changed.(0=disable)
-
-  BackupLevel "3";
-  // - Backup level.(0=disable), 1 is invalid.
-
-  // APT::Archives::MaxAge "0"; (old, deprecated)
-  MaxAge "0"; // (new)
-  // - Set maximum allowed age of a cache package file. If a cache 
-  //   package file is older it is deleted (0=disable)
-
-  // APT::Archives::MinAge "2"; (old, deprecated)
-  MinAge "2"; // (new)
-  // - Set minimum age of a package file. If a file is younger it
-  //   will not be deleted (0=disable). Usefull to prevent races 
-  //   and to keep backups of the packages for emergency.
-
-  // APT::Archives::MaxSize "0"; (old, deprecated)
-  MaxSize "0"; // (new)
-  // - Set maximum size of the cache in MB (0=disable). If the cache
-  //   is bigger, cached package files are deleted until the size
-  //   requirement is met (the biggest packages will be deleted 
-  //   first).
-
-  Update-Package-Lists "0";
-  // - Do "apt-get update" automatically every n-days (0=disable)
-  //   
-  Download-Upgradeable-Packages "0";
-  // - Do "apt-get upgrade --download-only" every n-days (0=disable)
-  //
-  Unattended-Upgrade "0";
-  // - Run the "unattended-upgrade" security upgrade script 
-  //   every n-days (0=disabled)
-  //   Requires the package "unattended-upgrades" and will write
-  //   a log in /var/log/unattended-upgrades
-  //
-  AutocleanInterval "0";
-  // - Do "apt-get autoclean" every n-days (0=disable)
-
-  Verbose "0";
-  // - Send report mail to root
-  //   0:  no report             (or null string)
-  //   1:  progress report       (actually any string)
-  //   2:  + command outputs     (remove -qq, remove 2>/dev/null, add -d)
-  //   3:  + trace on            
+    BackupArchiveInterval "0";
+    // - Backup after n-days if archive contents changed.(0=disable)
+
+    BackupLevel "3";
+    // - Backup level.(0=disable), 1 is invalid.
+
+    // APT::Archives::MaxAge "0"; (old, deprecated)
+    MaxAge "0"; // (new)
+    // - Set maximum allowed age of a cache package file. If a cache 
+    //   package file is older it is deleted (0=disable)
+
+    // APT::Archives::MinAge "2"; (old, deprecated)
+    MinAge "2"; // (new)
+    // - Set minimum age of a package file. If a file is younger it
+    //   will not be deleted (0=disable). Usefull to prevent races 
+    //   and to keep backups of the packages for emergency.
+
+    // APT::Archives::MaxSize "0"; (old, deprecated)
+    MaxSize "0"; // (new)
+    // - Set maximum size of the cache in MB (0=disable). If the cache
+    //   is bigger, cached package files are deleted until the size
+    //   requirement is met (the biggest packages will be deleted 
+    //   first).
+
+    Update-Package-Lists "0";
+    // - Do "apt-get update" automatically every n-days (0=disable)
+    //   
+    Download-Upgradeable-Packages "0";
+    // - Do "apt-get upgrade --download-only" every n-days (0=disable)
+    //
+    Unattended-Upgrade "0";
+    // - Run the "unattended-upgrade" security upgrade script 
+    //   every n-days (0=disabled)
+    //   Requires the package "unattended-upgrades" and will write
+    //   a log in /var/log/unattended-upgrades
+    //
+    AutocleanInterval "0";
+    // - Do "apt-get autoclean" every n-days (0=disable)
+
+    Verbose "0";
+    // - Send report mail to root
+    //   0:  no report             (or null string)
+    //   1:  progress report       (actually any string)
+    //   2:  + command outputs     (remove -qq, remove 2>/dev/null, add -d)
+    //   3:  + trace on            
   };
 };
 
index bf4281e403586a9ef73838d49e780ac49de34df6..b25fdf5a855738e4b37dadd5380897333998a29f 100644 (file)
@@ -220,7 +220,7 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
    }
 
    bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect", true);
-   CDROM = _config->FindDir("Acquire::cdrom::mount","/cdrom/");
+   CDROM = _config->FindDir("Acquire::cdrom::mount");
    if (Debug)
       clog << "Looking for CDROM at " << CDROM << endl;
 
index 25e31de9a3126becc17db843f4e4e59a2a1837c5..dfc1619e3c4994c9dda537c2728c6722e9b8fd82 100644 (file)
@@ -1349,9 +1349,10 @@ bool HttpMethod::AutoDetectProxy()
    pid_t Process = ExecFork();
    if (Process == 0)
    {
+      close(Pipes[0]);
       dup2(Pipes[1],STDOUT_FILENO);
       SetCloseExec(STDOUT_FILENO,false);
-      
+
       const char *Args[2];
       Args[0] = AutoDetectProxyCmd.c_str();
       Args[1] = 0;
@@ -1361,10 +1362,18 @@ bool HttpMethod::AutoDetectProxy()
    }
    char buf[512];
    int InFd = Pipes[0];
-   if (read(InFd, buf, sizeof(buf)) < 0)
+   close(Pipes[1]);
+   int res = read(InFd, buf, sizeof(buf));
+   ExecWait(Process, "ProxyAutoDetect", true);
+
+   if (res < 0)
       return _error->Errno("read", "Failed to read");
-   ExecWait(Process, "ProxyAutoDetect");
-   
+   if (res == 0)
+      return _error->Warning("ProxyAutoDetect returned no data");
+
+   // add trailing \0
+   buf[res] = 0;
+
    if (Debug)
       clog << "auto detect command returned: '" << buf << "'" << endl;
 
index ee4048a532306e17159eb0f62cfe5eeb018db3c7..fe1db14bcc3b71848d7647f101f0829e3f2bee17 100644 (file)
@@ -137,6 +137,7 @@ setupenvironment() {
        echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf
        echo "Dir::Bin::Methods \"${BUILDDIRECTORY}/methods\";" >> aptconfig.conf
        echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf
+       echo "Dir::Bin::methods \"${BUILDDIRECTORY}/methods\";" >> aptconfig.conf
        echo "DPKG::options:: \"dpkg\";" >> aptconfig.conf
        echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf
        echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf
diff --git a/test/integration/test-changelog b/test/integration/test-changelog
new file mode 100755 (executable)
index 0000000..292df6e
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+# this will be valid until ubuntu lucid is EOL (04/2015)
+pkgchangelogtest="Package: apt
+Architecture: i386
+Version: 0.7.25.3ubuntu7
+Filename: pool/main/a/apt/apt_0.7.25.3ubuntu7_i386.deb
+Section: admin
+"
+cat <<-EOF >aptarchive/Packages
+$pkgchangelogtest
+EOF
+
+setupaptarchive
+
+echo "Apt::Changelogs::Server \"http://changelogs.ubuntu.com/\";" >> ./aptconfig.conf
+msgnmsg "apt-get changelog: "
+aptget changelog apt -qq > downloaded-changelog
+expected="apt (0.7.25.3ubuntu7) lucid; urgency=low"
+got="$(head -n1 downloaded-changelog)"
+if [ -s downloaded-changelog ] && [ "$got" = "$expected" ]; then
+    msgpass
+else
+    msgfail 
+    msgwarn "$got != $expected"
+fi
+