Просмотр исходного кода

* [BREAK] merged lp:~mvo/apt/history
- this writes a /var/log/apt/history tagfile that contains details
from the transaction (complements term.log)
* methods/http.cc:
- add cache-control headers even if no cache is given to allow
adding options for intercepting proxies
- add Acquire::http::ProxyAutoDetect configuration that
can be used to call a external helper to figure out the
proxy configuration and return it to apt via stdout
(this is a step towards WPAD and zeroconf/avahi support)
* abicheck/
- add new abitest tester using the ABI Compliance Checker from
http://ispras.linuxfoundation.org/index.php/ABI_compliance_checker
* Change the package index Info methods to allow apt-cache policy to be
useful when using several different archives on the same host.
(Closes: #329814, LP: #22354)

Michael Vogt лет назад: 16
Родитель
Сommit
b9dacd11a4

+ 29 - 6
AUTHORS

@@ -1,4 +1,32 @@
-The project hierachy stands at:
+The  project contributors:
+
+Michael Vogt <mvo@debian.org>
+- Development, bug fixes
+
+David Kalnischkies <kalnischkies+debian@gmail.com>
+- Development, bug fixes
+
+Christian Perrier <bubulle@debian.org>
+- Translations hero/coordinator
+
+
+Past Contributors:
+
+Robert Collins <robert.collins@canonical.com>
+- Change the package index Info methods to allow apt-cache policy to be useful
+  when using several different archives on the same host.
+
+Julian Andres Klode
+- Development, bug fixes
+
+Eugene V. Lyubimkin
+- Development, bug fixes
+
+Otavio Salvador
+- Development, bug fixes
+
+Luca Bruno
+- Development, bug fixes
 
 CVS:jgg Jason Gunthorpe <jgg@debian.org>
 - The Mad Cow incarnate
@@ -9,11 +37,6 @@ CVS:mdz Matt Zimmerman <mdz@debian.org>
 CVS:piefel Michael Piefel <piefel@debian.org>
 - i18n and l10n
 
-Michael Vogt <mvo@debian.org>
-- Development and bug fixes
-
-Past Contributors:
-
 CVS:che Ben Gertzfield <che@debian.org>
 - Packaging and Releases
 

Разница между файлами не показана из-за своего большого размера
+ 7325 - 0
abicheck/abi-compliance-checker.pl


+ 11 - 0
abicheck/apt_build.xml.in

@@ -0,0 +1,11 @@
+<version>
+ build-branch
+</version>
+   
+ <headers>
+  @build_path@/include/apt-pkg
+ </headers>
+   
+ <libs>
+  @build_path@/bin/
+ </libs>

+ 11 - 0
abicheck/apt_installed.xml.in

@@ -0,0 +1,11 @@
+<version>
+ installed 
+</version>
+   
+<headers>
+ /usr/include/apt-pkg/
+</headers>
+   
+<libs>
+ @installed_libapt@
+</libs>

+ 14 - 0
abicheck/run_abi_test

@@ -0,0 +1,14 @@
+#!/bin/sh
+
+if [ ! -d ../build ]; then
+	echo "../build missing, did you run make?"
+	exit 1
+fi
+
+LIBPATH=$(find /usr/lib/ -type f  -name "libapt-*.so.*" -printf %p\\\\n)
+sed s#@installed_libapt@#$LIBPATH# apt_installed.xml.in > apt_installed.xml
+
+BUILDPATH=$(readlink -f ../build)
+sed s#@build_path@#$BUILDPATH# apt_build.xml.in > apt_build.xml
+
+perl abi-compliance-checker.pl -l apt -d1 apt_installed.xml -d2 apt_build.xml

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

@@ -1323,3 +1323,15 @@ string URI::SiteOnly(const string &URI)
    return U;
 }
 									/*}}}*/
+// URI::NoUserPassword - Return the schema, site and path for the URI	/*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string URI::NoUserPassword(const string &URI)
+{
+   ::URI U(URI);
+   U.User.clear();
+   U.Password.clear();
+   U.Port = 0;
+   return U;
+}
+									/*}}}*/

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

@@ -120,6 +120,7 @@ class URI
    inline void operator =(const string &From) {CopyFrom(From);};
    inline bool empty() {return Access.empty();};
    static string SiteOnly(const string &URI);
+   static string NoUserPassword(const string &URI);
    
    URI(string Path) {CopyFrom(Path);};
    URI() : Port(0) {};

+ 6 - 6
apt-pkg/deb/debindexfile.cc

@@ -35,12 +35,12 @@ debSourcesIndex::debSourcesIndex(string URI,string Dist,string Section,bool Trus
 // SourcesIndex::SourceInfo - Short 1 liner describing a source		/*{{{*/
 // ---------------------------------------------------------------------
 /* The result looks like:
-     http://foo/ stable/main src 1.1.1 (dsc) */
+     http://foo/debian/ stable/main src 1.1.1 (dsc) */
 string debSourcesIndex::SourceInfo(pkgSrcRecords::Parser const &Record,
 				   pkgSrcRecords::File const &File) const
 {
    string Res;
-   Res = ::URI::SiteOnly(URI) + ' ';
+   Res = ::URI::NoUserPassword(URI) + ' ';
    if (Dist[Dist.size() - 1] == '/')
    {
       if (Dist != "/")
@@ -88,7 +88,7 @@ string debSourcesIndex::Describe(bool Short) const
 /* */
 string debSourcesIndex::Info(const char *Type) const
 {
-   string Info = ::URI::SiteOnly(URI) + ' ';
+   string Info = ::URI::NoUserPassword(URI) + ' ';
    if (Dist[Dist.size() - 1] == '/')
    {
       if (Dist != "/")
@@ -159,7 +159,7 @@ debPackagesIndex::debPackagesIndex(string URI,string Dist,string Section,bool Tr
 /* This is a shorter version that is designed to be < 60 chars or so */
 string debPackagesIndex::ArchiveInfo(pkgCache::VerIterator Ver) const
 {
-   string Res = ::URI::SiteOnly(URI) + ' ';
+   string Res = ::URI::NoUserPassword(URI) + ' ';
    if (Dist[Dist.size() - 1] == '/')
    {
       if (Dist != "/")
@@ -195,7 +195,7 @@ string debPackagesIndex::Describe(bool Short) const
 /* */
 string debPackagesIndex::Info(const char *Type) const 
 {
-   string Info = ::URI::SiteOnly(URI) + ' ';
+   string Info = ::URI::NoUserPassword(URI) + ' ';
    if (Dist[Dist.size() - 1] == '/')
    {
       if (Dist != "/")
@@ -395,7 +395,7 @@ string debTranslationsIndex::Describe(bool Short) const
 /* */
 string debTranslationsIndex::Info(const char *Type) const 
 {
-   string Info = ::URI::SiteOnly(URI) + ' ';
+   string Info = ::URI::NoUserPassword(URI) + ' ';
    if (Dist[Dist.size() - 1] == '/')
    {
       if (Dist != "/")

+ 75 - 14
apt-pkg/deb/dpkgpm.cc

@@ -550,12 +550,31 @@ void pkgDPkgPM::DoDpkgStatusFd(int statusfd, int OutStatusFd)
    dpkgbuf_pos = dpkgbuf+dpkgbuf_pos-p;
 }
 									/*}}}*/
+// DPkgPM::WriteHistoryTag						/*{{{*/
+void pkgDPkgPM::WriteHistoryTag(string tag, string value)
+{
+   if (value.size() > 0)
+   {
+      // poor mans rstrip(", ")
+      if (value[value.size()-2] == ',' && value[value.size()-1] == ' ')
+	 value.erase(value.size() - 2, 2);
+      fprintf(history_out, "%s: %s\n", tag.c_str(), value.c_str());
+   }
+}									/*}}}*/
 // DPkgPM::OpenLog							/*{{{*/
 bool pkgDPkgPM::OpenLog()
 {
    string logdir = _config->FindDir("Dir::Log");
    if(not FileExists(logdir))
       return _error->Error(_("Directory '%s' missing"), logdir.c_str());
+
+   // get current time
+   char timestr[200];
+   time_t t = time(NULL);
+   struct tm *tmp = localtime(&t);
+   strftime(timestr, sizeof(timestr), "%F  %T", tmp);
+
+   // open terminal log
    string logfile_name = flCombine(logdir,
 				   _config->Find("Dir::Log::Terminal"));
    if (!logfile_name.empty())
@@ -565,31 +584,70 @@ bool pkgDPkgPM::OpenLog()
 	 return _error->WarningE(_("Could not open file '%s'"), logfile_name.c_str());
 
       chmod(logfile_name.c_str(), 0600);
-      // output current time
-      char outstr[200];
-      time_t t = time(NULL);
-      struct tm *tmp = localtime(&t);
-      strftime(outstr, sizeof(outstr), "%F  %T", tmp);
-      fprintf(term_out, "\nLog started: %s\n", outstr);
+      fprintf(term_out, "\nLog started: %s\n", timestr);
    }
+
+   // write 
+   string history_name = flCombine(logdir,
+				   _config->Find("Dir::Log::History"));
+   if (!history_name.empty())
+   {
+      history_out = fopen(history_name.c_str(),"a");
+      chmod(history_name.c_str(), 0644);
+      fprintf(history_out, "\nStart-Date: %s\n", timestr);
+      string remove, purge, install, upgrade, downgrade;
+      for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+      {
+	 if (Cache[I].NewInstall())
+	    install += I.Name() + string(" (") + Cache[I].CandVersion + string("), ");
+	 else if (Cache[I].Upgrade())
+	    upgrade += I.Name() + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), ");
+	 else if (Cache[I].Downgrade())
+	    downgrade += I.Name() + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), ");
+	 else if (Cache[I].Delete())
+	 {
+	    if ((Cache[I].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge)
+	       purge += I.Name() + string(" (") + Cache[I].CurVersion + string("), ");	    
+	    else
+	       remove += I.Name() + string(" (") + Cache[I].CurVersion + string("), ");	    
+	 }
+      }
+      WriteHistoryTag("Install", install);
+      WriteHistoryTag("Upgrade", upgrade);
+      WriteHistoryTag("Downgrade",downgrade);
+      WriteHistoryTag("Remove",remove);
+      WriteHistoryTag("Purge",purge);
+      fflush(history_out);
+   }
+   
    return true;
 }
 									/*}}}*/
 // DPkg::CloseLog							/*{{{*/
 bool pkgDPkgPM::CloseLog()
 {
+   char timestr[200];
+   time_t t = time(NULL);
+   struct tm *tmp = localtime(&t);
+   strftime(timestr, sizeof(timestr), "%F  %T", tmp);
+
    if(term_out)
    {
-      char outstr[200];
-      time_t t = time(NULL);
-      struct tm *tmp = localtime(&t);
-      strftime(outstr, sizeof(outstr), "%F  %T", tmp);
       fprintf(term_out, "Log ended: ");
-      fprintf(term_out, "%s", outstr);
+      fprintf(term_out, "%s", timestr);
       fprintf(term_out, "\n");
       fclose(term_out);
    }
    term_out = NULL;
+
+   if(history_out)
+   {
+      if (dpkg_error.size() > 0)
+	 fprintf(history_out, "Error: %s\n", dpkg_error.c_str());
+      fprintf(history_out, "End-Date: %s\n", timestr);
+      fclose(history_out);
+   }
+
    return true;
 }
 									/*}}}*/
@@ -1059,11 +1117,14 @@ bool pkgDPkgPM::Go(int OutStatusFd)
 	    RunScripts("DPkg::Post-Invoke");
 
 	 if (WIFSIGNALED(Status) != 0 && WTERMSIG(Status) == SIGSEGV) 
-	    _error->Error("Sub-process %s received a segmentation fault.",Args[0]);
+	    strprintf(dpkg_error, "Sub-process %s received a segmentation fault.",Args[0]);
 	 else if (WIFEXITED(Status) != 0)
-	    _error->Error("Sub-process %s returned an error code (%u)",Args[0],WEXITSTATUS(Status));
+	    strprintf(dpkg_error, "Sub-process %s returned an error code (%u)",Args[0],WEXITSTATUS(Status));
 	 else 
-	    _error->Error("Sub-process %s exited unexpectedly",Args[0]);
+	    strprintf(dpkg_error, "Sub-process %s exited unexpectedly",Args[0]);
+
+	 if(dpkg_error.size() > 0)
+	    _error->Error(dpkg_error.c_str());
 
 	 if(stopOnError) 
 	 {

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

@@ -29,7 +29,9 @@ class pkgDPkgPM : public pkgPackageManager
    char dpkgbuf[1024];
    int dpkgbuf_pos;
    FILE *term_out;
-   
+   FILE *history_out;
+   string dpkg_error;
+
    protected:
 
    // progress reporting
@@ -66,6 +68,7 @@ class pkgDPkgPM : public pkgPackageManager
    // Helpers
    bool RunScriptsWithPkgs(const char *Cnf);
    bool SendV2Pkgs(FILE *F);
+   void WriteHistoryTag(string tag, string value);
 
    // dpkg log
    bool OpenLog();

+ 1 - 0
apt-pkg/init.cc

@@ -75,6 +75,7 @@ bool pkgInitConfig(Configuration &Cnf)
    // State   
    Cnf.Set("Dir::Log","var/log/apt");
    Cnf.Set("Dir::Log::Terminal","term.log");
+   Cnf.Set("Dir::Log::History","history.log");
 
    // Translation
    Cnf.Set("APT::Acquire::Translation", "environment");

+ 9 - 1
debian/apt.logrotate

@@ -1,5 +1,13 @@
 /var/log/apt/term.log {
-  rotate 6
+  rotate 12
+  monthly
+  compress
+  missingok
+  notifempty
+}
+
+/var/log/apt/history.log {
+  rotate 12
   monthly
   compress
   missingok

+ 26 - 6
debian/changelog

@@ -21,8 +21,28 @@ apt (0.7.26) UNRELEASED; urgency=low
 
   [ Ivan Masár ]
   * Slovak translation update. Closes: #568294
-
- -- David Kalnischkies <kalnischkies@gmail.com>  Sat, 13 Feb 2010 01:42:50 +0100
+  
+  [ Michael Vogt ]
+  * [BREAK] merged lp:~mvo/apt/history
+    - this writes a /var/log/apt/history tagfile that contains details
+      from the transaction (complements term.log)
+  * methods/http.cc:
+    - add cache-control headers even if no cache is given to allow
+      adding options for intercepting proxies
+    - add Acquire::http::ProxyAutoDetect configuration that 
+      can be used to call a external helper to figure out the 
+      proxy configuration and return it to apt via stdout
+      (this is a step towards WPAD and zeroconf/avahi support)
+  * abicheck/
+    - add new abitest tester using the ABI Compliance Checker from
+      http://ispras.linuxfoundation.org/index.php/ABI_compliance_checker
+
+  [ Robert Collins ]
+  * Change the package index Info methods to allow apt-cache policy to be
+    useful when using several different archives on the same host.
+    (Closes: #329814, LP: #22354)
+
+ -- Michael Vogt <michael.vogt@ubuntu.com>  Fri, 18 Dec 2009 16:54:18 +0100
 
 apt (0.7.25.3) unstable; urgency=low
 
@@ -31,7 +51,7 @@ apt (0.7.25.3) unstable; urgency=low
 
   [ David Kalnischkies ]
   * apt-pkg/contrib/macros.h:
-    - install the header system.h with a new name to be able to use 
+    - install the header system.h with a new name to be able to use
       it in other headers (Closes: #567662)
   * cmdline/acqprogress.cc:
     - Set Mode to Medium so that the correct prefix is used.
@@ -40,7 +60,7 @@ apt (0.7.25.3) unstable; urgency=low
     - generate sha1 and sha256 checksums for dsc (Closes: #567343)
   * cmdline/apt-get.cc:
     - don't mark as manually if in download only (Closes: #468180)
-  
+
  -- Michael Vogt <mvo@debian.org>  Mon, 01 Feb 2010 18:41:15 +0100
 
 apt (0.7.25.2) unstable; urgency=low
@@ -64,7 +84,7 @@ apt (0.7.25.2) unstable; urgency=low
       packages that are not in the extended_states file yet
       (closes: #534920)
   * ftparchive/writer.{cc,h}:
-    - merge crash fix for apt-ftparchive on hurd, thanks to 
+    - merge crash fix for apt-ftparchive on hurd, thanks to
       Samuel Thibault for the patch (closes: #566664)
 
   [ David Kalnischkies ]
@@ -103,7 +123,7 @@ apt (0.7.25.1) unstable; urgency=low
   * French manpage translation update
   * Russian translation update by Yuri Kozlov
     Closes: #564171
-  
+
   [Chris Leick]
   * spot & fix various typos in all manpages
   * German manpage translation update

+ 8 - 0
doc/examples/configure-index

@@ -338,6 +338,14 @@ Dir "/"
   // Location of the logfile
   Log "var/log/apt" {
 	Terminal "term.log";
+	History "history.log";
+  };
+
+  // Media 
+  Media 
+  {
+	// Media AutoDetect mount path
+	MountPath "/media/apt";
   };
 
   // Media 

+ 48 - 45
doc/po/fr.po

@@ -1059,12 +1059,6 @@ msgstr ""
 #. type: Plain text
 #: apt.ent:362
 #, no-wrap
-#| msgid ""
-#| "<!ENTITY file-sourceslist \"\n"
-#| "     <varlistentry><term><filename>/etc/apt/sources.list</filename></term>\n"
-#| "     <listitem><para>Locations to fetch packages from.\n"
-#| "     Configuration Item: <literal>Dir::Etc::SourceList</literal>.</para></listitem>\n"
-#| "     </varlistentry>\n"
 msgid ""
 "<!ENTITY file-trustedgpg \"\n"
 "     <varlistentry><term><filename>/etc/apt/trusted.gpg</filename></term>\n"
@@ -1142,7 +1136,7 @@ msgstr ""
 "     traduction est légèrement en retard sur le contenu d'origine.\n"
 "\">\n"
 
-#.  The last update date
+#.  The last update date 
 #. type: Content of: <refentry><refentryinfo>
 #: apt-cache.8.xml:13 apt-config.8.xml:13 apt-extracttemplates.1.xml:13
 #: apt-sortpkgs.1.xml:13 sources.list.5.xml:13
@@ -2518,7 +2512,7 @@ msgstr ""
 "<command>apt-extracttemplates</command> retourne zéro si tout se passe bien, "
 "le nombre 100 en cas d'erreur."
 
-#.  The last update date
+#.  The last update date 
 #. type: Content of: <refentry><refentryinfo>
 #: apt-ftparchive.1.xml:13
 msgid ""
@@ -2642,7 +2636,8 @@ msgstr ""
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-ftparchive.1.xml:82 apt-ftparchive.1.xml:106
-msgid "The option <option>--db</option> can be used to specify a binary caching DB."
+msgid ""
+"The option <option>--db</option> can be used to specify a binary caching DB."
 msgstr ""
 "On peut se servir de l'option <option>--db</option> pour demander un cache "
 "binaire."
@@ -2797,8 +2792,10 @@ msgstr ""
 
 #. type: Content of: <refentry><refsect1><para>
 #: apt-ftparchive.1.xml:155
-msgid "The generate configuration has 4 separate sections, each described below."
-msgstr "Ce fichier de configuration possède quatre sections, décrites ci-dessous."
+msgid ""
+"The generate configuration has 4 separate sections, each described below."
+msgstr ""
+"Ce fichier de configuration possède quatre sections, décrites ci-dessous."
 
 #. type: Content of: <refentry><refsect1><refsect2><title>
 #: apt-ftparchive.1.xml:157
@@ -3095,9 +3092,6 @@ msgstr "Sources"
 
 #. type: Content of: <refentry><refsect1><refsect2><variablelist><varlistentry><listitem><para>
 #: apt-ftparchive.1.xml:288
-#| msgid ""
-#| "Sets the output Packages file. Defaults to <filename>$(DIST)/$(SECTION)/"
-#| "source/Sources</filename>"
 msgid ""
 "Sets the output Sources file. Defaults to <filename>$(DIST)/$(SECTION)/"
 "source/Sources</filename>"
@@ -3243,10 +3237,6 @@ msgstr ""
 #. type: Content of: <refentry><refsect1><refsect2><para><programlisting>
 #: apt-ftparchive.1.xml:354
 #, no-wrap
-#| msgid ""
-#| "for i in Sections do \n"
-#| "   for j in Architectures do\n"
-#| "      Generate for DIST=scope SECTION=i ARCH=j\n"
 msgid ""
 "for i in Sections do \n"
 "   for j in Architectures do\n"
@@ -3260,17 +3250,14 @@ msgstr ""
 
 #. type: Content of: <refentry><refsect1><refsect2><para>
 #: apt-ftparchive.1.xml:351
-#| msgid ""
-#| "When processing a <literal>Tree</literal> section <command>apt-"
-#| "ftparchive</command> performs an operation similar to:"
 msgid ""
 "When processing a <literal>Tree</literal> section <command>apt-ftparchive</"
 "command> performs an operation similar to: <placeholder type=\"programlisting"
 "\" id=\"0\"/>"
 msgstr ""
 "Quand il exécute la section <literal>Tree</literal>, <command>apt-"
-"ftparchive</command> effectue une opération analogue à : <placeholder type=\"programlisting"
-"\" id=\"0\"/>"
+"ftparchive</command> effectue une opération analogue à : <placeholder type="
+"\"programlisting\" id=\"0\"/>"
 
 #. type: Content of: <refentry><refsect1><refsect2><variablelist><varlistentry><term>
 #: apt-ftparchive.1.xml:360
@@ -3696,7 +3683,7 @@ msgstr ""
 "<command>apt-ftparchive</command> retourne zéro si tout se passe bien, le "
 "nombre 100 en cas d'erreur."
 
-#.  The last update date
+#.  The last update date 
 #. type: Content of: <refentry><refentryinfo>
 #: apt-get.8.xml:13
 msgid ""
@@ -3714,7 +3701,8 @@ msgstr "apt-get"
 #. type: Content of: <refentry><refnamediv><refpurpose>
 #: apt-get.8.xml:30
 msgid "APT package handling utility -- command-line interface"
-msgstr "Utilitaire APT pour la gestion des paquets -- interface en ligne de commande."
+msgstr ""
+"Utilitaire APT pour la gestion des paquets -- interface en ligne de commande."
 
 #. type: Content of: <refentry><refsynopsisdiv><cmdsynopsis>
 #: apt-get.8.xml:36
@@ -5072,8 +5060,10 @@ msgstr "Trousseau des clés fiables de l'archive Debian."
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-key.8.xml:166
-msgid "<filename>/usr/share/keyrings/debian-archive-removed-keys.gpg</filename>"
-msgstr "<filename>/usr/share/keyrings/debian-archive-removed-keys.gpg</filename>"
+msgid ""
+"<filename>/usr/share/keyrings/debian-archive-removed-keys.gpg</filename>"
+msgstr ""
+"<filename>/usr/share/keyrings/debian-archive-removed-keys.gpg</filename>"
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-key.8.xml:167
@@ -5085,7 +5075,7 @@ msgstr "Trousseau des clés fiables supprimées de l'archive Debian."
 msgid "&apt-get;, &apt-secure;"
 msgstr "&apt-get;, &apt-secure;"
 
-#.  The last update date
+#.  The last update date 
 #. type: Content of: <refentry><refentryinfo>
 #: apt-mark.8.xml:13
 msgid ""
@@ -5195,8 +5185,10 @@ msgstr ""
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-mark.8.xml:93
-msgid "<option>-f=<filename><replaceable>FILENAME</replaceable></filename></option>"
-msgstr "<option>-f=<filename><replaceable>FICHIER</replaceable></filename></option>"
+msgid ""
+"<option>-f=<filename><replaceable>FILENAME</replaceable></filename></option>"
+msgstr ""
+"<option>-f=<filename><replaceable>FICHIER</replaceable></filename></option>"
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-mark.8.xml:94
@@ -5656,7 +5648,7 @@ msgstr ""
 "<command>apt-sortpkgs</command> retourne zéro si tout se passe bien ou 100 "
 "en cas d'erreur."
 
-#.  The last update date
+#.  The last update date 
 #. type: Content of: <refentry><refentryinfo>
 #: apt.conf.5.xml:13
 #, fuzzy
@@ -5729,7 +5721,8 @@ msgstr ""
 #| msgid ""
 #| "APT configuration file.  Configuration Item: <literal>Dir::Etc::Main</"
 #| "literal>."
-msgid "the main configuration file specified by <literal>Dir::Etc::main</literal>"
+msgid ""
+"the main configuration file specified by <literal>Dir::Etc::main</literal>"
 msgstr ""
 "Fichier de configuration d'APT. Élément de configuration : <literal>Dir::"
 "Etc::Main</literal>."
@@ -7478,7 +7471,7 @@ msgstr ""
 
 #.  TODO: provide a
 #. 	   motivating example, except I haven't a clue why you'd want
-#. 	   to do this.
+#. 	   to do this. 
 #. type: Content of: <refentry><refsect1><para><itemizedlist><listitem><para>
 #: apt.conf.5.xml:692
 msgid ""
@@ -7500,7 +7493,8 @@ msgstr "<literal>Debug::Acquire::cdrom</literal>"
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt.conf.5.xml:711
-msgid "Print information related to accessing <literal>cdrom://</literal> sources."
+msgid ""
+"Print information related to accessing <literal>cdrom://</literal> sources."
 msgstr ""
 "Affiche les informations concernant les sources de type <literal>cdrom://</"
 "literal>"
@@ -7513,7 +7507,8 @@ msgstr "<literal>Debug::Acquire::ftp</literal>"
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt.conf.5.xml:722
 msgid "Print information related to downloading packages using FTP."
-msgstr "Affiche les informations concernant le téléchargement de paquets par FTP."
+msgstr ""
+"Affiche les informations concernant le téléchargement de paquets par FTP."
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt.conf.5.xml:729
@@ -7523,7 +7518,8 @@ msgstr "<literal>Debug::Acquire::http</literal>"
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt.conf.5.xml:733
 msgid "Print information related to downloading packages using HTTP."
-msgstr "Affiche les informations concernant le téléchargement de paquets par HTTP."
+msgstr ""
+"Affiche les informations concernant le téléchargement de paquets par HTTP."
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt.conf.5.xml:740
@@ -7684,7 +7680,8 @@ msgstr "<literal>Debug::pkgAcquire::Worker</literal>"
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt.conf.5.xml:862
-msgid "Log all interactions with the sub-processes that actually perform downloads."
+msgid ""
+"Log all interactions with the sub-processes that actually perform downloads."
 msgstr ""
 "Affiche toutes les interactions avec les processus enfants qui se chargent "
 "effectivement des téléchargements."
@@ -7825,7 +7822,8 @@ msgstr "<literal>Debug::pkgPackageManager</literal>"
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt.conf.5.xml:963
-msgid "Output status messages tracing the steps performed when invoking &dpkg;."
+msgid ""
+"Output status messages tracing the steps performed when invoking &dpkg;."
 msgstr "Affiche le détail des opérations liées à l'invocation de &dpkg;."
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
@@ -7896,13 +7894,13 @@ msgstr ""
 msgid "&file-aptconf;"
 msgstr "&file-aptconf;"
 
-#.  ? reading apt.conf
+#.  ? reading apt.conf 
 #. type: Content of: <refentry><refsect1><para>
 #: apt.conf.5.xml:1042
 msgid "&apt-cache;, &apt-config;, &apt-preferences;."
 msgstr "&apt-cache;, &apt-config;, &apt-preferences;."
 
-#.  The last update date
+#.  The last update date 
 #. type: Content of: <refentry><refentryinfo>
 #: apt_preferences.5.xml:13
 msgid "&apt-author.team; &apt-email; &apt-product; <date>04 May 2009</date>"
@@ -8052,7 +8050,8 @@ msgstr "une priorité égale à 990"
 
 #. type: Content of: <refentry><refsect1><refsect2><para><variablelist><varlistentry><listitem><simpara>
 #: apt_preferences.5.xml:101
-msgid "to the versions that are not installed and belong to the target release."
+msgid ""
+"to the versions that are not installed and belong to the target release."
 msgstr ""
 "est affectée aux versions qui ne sont pas installées et qui appartiennent à "
 "la distribution par défaut."
@@ -8537,7 +8536,8 @@ msgstr ""
 #. type: Content of: <refentry><refsect1><refsect2><title>
 #: apt_preferences.5.xml:313
 msgid "Determination of Package Version and Distribution Properties"
-msgstr "Détermination de la version des paquets et des propriétés des distributions"
+msgstr ""
+"Détermination de la version des paquets et des propriétés des distributions"
 
 #. type: Content of: <refentry><refsect1><refsect2><para>
 #: apt_preferences.5.xml:315
@@ -9630,7 +9630,8 @@ msgstr "$Id: guide.sgml,v 1.7 2003/04/26 23:26:13 doogie Exp $"
 
 #. type: <abstract></abstract>
 #: guide.sgml:11
-msgid "This document provides an overview of how to use the the APT package manager."
+msgid ""
+"This document provides an overview of how to use the the APT package manager."
 msgstr ""
 "Ce document fournit un aperçu des méthode d'utilisation du gestionnaire de "
 "paquets APT."
@@ -10561,8 +10562,10 @@ msgstr "Résumé final"
 
 #. type: <p></p>
 #: guide.sgml:447
-msgid "Finally, APT will print out a summary of all the changes that will occur."
-msgstr "Anfin, APT affichera un résumé de toutes les opérations qui prendront place."
+msgid ""
+"Finally, APT will print out a summary of all the changes that will occur."
+msgstr ""
+"Anfin, APT affichera un résumé de toutes les opérations qui prendront place."
 
 #. type: <example></example>
 #: guide.sgml:452

+ 1 - 1
methods/cdrom.cc

@@ -219,7 +219,7 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
       return true;
    }
 
-   bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect", false);
+   bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect", true);
    CDROM = _config->FindDir("Acquire::cdrom::mount","/cdrom/");
    if (Debug)
       clog << "Looking for CDROM at " << CDROM << endl;

+ 64 - 15
methods/http.cc

@@ -682,23 +682,25 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out)
        	 and a no-store directive for archives. */
       sprintf(Buf,"GET %s HTTP/1.1\r\nHost: %s\r\n",
 	      Itm->Uri.c_str(),ProperHost.c_str());
-      // only generate a cache control header if we actually want to 
-      // use a cache
-      if (_config->FindB("Acquire::http::No-Cache",false) == false)
+   }
+   // generate a cache control header (if needed)
+   if (_config->FindB("Acquire::http::No-Cache",false) == true) 
+   {
+      strcat(Buf,"Cache-Control: no-cache\r\nPragma: no-cache\r\n");
+   }
+   else
+   {
+      if (Itm->IndexFile == true) 
       {
-	 if (Itm->IndexFile == true)
-	    sprintf(Buf+strlen(Buf),"Cache-Control: max-age=%u\r\n",
-		    _config->FindI("Acquire::http::Max-Age",0));
-	 else
-	 {
-	    if (_config->FindB("Acquire::http::No-Store",false) == true)
-	       strcat(Buf,"Cache-Control: no-store\r\n");
-	 }	 
+	 sprintf(Buf+strlen(Buf),"Cache-Control: max-age=%u\r\n",
+		 _config->FindI("Acquire::http::Max-Age",0));
+      }
+      else
+      {
+	 if (_config->FindB("Acquire::http::No-Store",false) == true)
+	    strcat(Buf,"Cache-Control: no-store\r\n");
       }
    }
-   // generate a no-cache header if needed
-   if (_config->FindB("Acquire::http::No-Cache",false) == true)
-      strcat(Buf,"Cache-Control: no-cache\r\nPragma: no-cache\r\n");
 
    
    string Req = Buf;
@@ -1071,7 +1073,11 @@ bool HttpMethod::Configuration(string Message)
    PipelineDepth = _config->FindI("Acquire::http::Pipeline-Depth",
 				  PipelineDepth);
    Debug = _config->FindB("Debug::Acquire::http",false);
-   
+   AutoDetectProxyCmd = _config->Find("Acquire::http::ProxyAutoDetect");
+
+   // Get the proxy to use
+   AutoDetectProxy();
+
    return true;
 }
 									/*}}}*/
@@ -1321,6 +1327,49 @@ int HttpMethod::Loop()
    return 0;
 }
 									/*}}}*/
+// HttpMethod::AutoDetectProxy - auto detect proxy			/*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool HttpMethod::AutoDetectProxy()
+{
+   if (AutoDetectProxyCmd.empty())
+      return true;
+
+   if (Debug)
+      clog << "Using auto proxy detect command: " << AutoDetectProxyCmd << endl;
+
+   int Pipes[2] = {-1,-1};
+   if (pipe(Pipes) != 0)
+      return _error->Errno("pipe", "Failed to create Pipe");
+
+   pid_t Process = ExecFork();
+   if (Process == 0)
+   {
+      dup2(Pipes[1],STDOUT_FILENO);
+      SetCloseExec(STDOUT_FILENO,false);
+      
+      const char *Args[2];
+      Args[0] = AutoDetectProxyCmd.c_str();
+      Args[1] = 0;
+      execv(Args[0],(char **)Args);
+      cerr << "Failed to exec method " << Args[0] << endl;
+      _exit(100);
+   }
+   char buf[512];
+   int InFd = Pipes[0];
+   if (read(InFd, buf, sizeof(buf)) < 0)
+      return _error->Errno("read", "Failed to read");
+   ExecWait(Process, "ProxyAutoDetect");
+   
+   if (Debug)
+      clog << "auto detect command returned: '" << buf << "'" << endl;
+
+   if (strstr(buf, "http://") == buf)
+      _config->Set("Acquire::http::proxy", _strstrip(buf));
+
+   return true;
+}
+									/*}}}*/
 
 int main()
 {

+ 2 - 0
methods/http.h

@@ -134,6 +134,7 @@ class HttpMethod : public pkgAcqMethod
    bool Flush(ServerState *Srv);
    bool ServerDie(ServerState *Srv);
    int DealWithHeaders(FetchResult &Res,ServerState *Srv);
+   bool AutoDetectProxy();
 
    virtual bool Fetch(FetchItem *);
    virtual bool Configuration(string Message);
@@ -145,6 +146,7 @@ class HttpMethod : public pkgAcqMethod
    static void SigTerm(int);
    
    string NextURI;
+   string AutoDetectProxyCmd;
    
    public:
    friend class ServerState;