]> git.saurik.com Git - apt.git/commitdiff
* ftparchive/writer.cc:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Tue, 8 Jun 2010 22:12:14 +0000 (00:12 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Tue, 8 Jun 2010 22:12:14 +0000 (00:12 +0200)
  - add ValidTime option to generate a Valid-Until header in Release file

debian/changelog
doc/apt-ftparchive.1.xml
ftparchive/writer.cc

index 2a40d084ea0886a27722b261d0ebba001ca83b0a..fa0e667e73c2ed20ff1916a017f6fa50c20f85d2 100644 (file)
@@ -47,6 +47,8 @@ apt (0.7.26~exp5) experimental; urgency=low
   * apt-pkg/contrib/strutl.cc:
     - split StrToTime() into HTTP1.1 and FTP date parser methods and
       use strptime() instead of some selfmade scanf mangling
+  * ftparchive/writer.cc:
+    - add ValidTime option to generate a Valid-Until header in Release file
 
   [ Michael Vogt ]
   * methods/http.{cc,h}:
index a3ac45bd3764b55b25e314e895d9967c9f6affbf..549aa6a347025c0fb1ce90c153ce4e10928eeebe 100644 (file)
      e.g. <literal>APT::FTPArchive::Release::Origin</literal>.  The supported fields
      are: <literal>Origin</literal>, <literal>Label</literal>, <literal>Suite</literal>,
      <literal>Version</literal>, <literal>Codename</literal>, <literal>Date</literal>,
-     <literal>Architectures</literal>, <literal>Components</literal>, <literal>Description</literal>.</para></listitem>
+     <literal>Valid-Until</literal>, <literal>Architectures</literal>,
+     <literal>Components</literal>, <literal>Description</literal>.</para></listitem>
 
      </varlistentry>
 
index 6cda29b213d4c498caa55d01274c14be0a21c713..650eec57c38dbe711d536d866bfea2ac8b83137b 100644 (file)
@@ -924,6 +924,15 @@ ReleaseWriter::ReleaseWriter(string const &DB)
       datestr[0] = '\0';
    }
 
+   time_t const validuntil = now + _config->FindI("APT::FTPArchive::Release::ValidTime", 0);
+   char validstr[128];
+   if (now == validuntil ||
+       strftime(validstr, sizeof(validstr), "%a, %d %b %Y %H:%M:%S UTC",
+                gmtime(&validuntil)) == 0)
+   {
+      datestr[0] = '\0';
+   }
+
    map<string,string> Fields;
    Fields["Origin"] = "";
    Fields["Label"] = "";
@@ -931,6 +940,7 @@ ReleaseWriter::ReleaseWriter(string const &DB)
    Fields["Version"] = "";
    Fields["Codename"] = "";
    Fields["Date"] = datestr;
+   Fields["Valid-Until"] = validstr;
    Fields["Architectures"] = "";
    Fields["Components"] = "";
    Fields["Description"] = "";