summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-06-09 00:12:14 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-06-09 00:12:14 +0200
commitc99e48ec26e693d9aa4a2a9f868284f7aa49784d (patch)
tree3e395a2cfce47076037885212a6453a94034a99b
parentbbde96a611f39f5040b332dae1515207db341743 (diff)
* ftparchive/writer.cc:
- add ValidTime option to generate a Valid-Until header in Release file
-rw-r--r--debian/changelog2
-rw-r--r--doc/apt-ftparchive.1.xml3
-rw-r--r--ftparchive/writer.cc10
3 files changed, 14 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 2a40d084e..fa0e667e7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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}:
diff --git a/doc/apt-ftparchive.1.xml b/doc/apt-ftparchive.1.xml
index a3ac45bd3..549aa6a34 100644
--- a/doc/apt-ftparchive.1.xml
+++ b/doc/apt-ftparchive.1.xml
@@ -122,7 +122,8 @@
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>
diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc
index 6cda29b21..650eec57c 100644
--- a/ftparchive/writer.cc
+++ b/ftparchive/writer.cc
@@ -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"] = "";