summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/apt/apt/gcc_4.x_Revert-avoid-changing-the-global-LC_TIME-for-Release.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/apt/apt/gcc_4.x_Revert-avoid-changing-the-global-LC_TIME-for-Release.patch')
-rw-r--r--meta/recipes-devtools/apt/apt/gcc_4.x_Revert-avoid-changing-the-global-LC_TIME-for-Release.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/meta/recipes-devtools/apt/apt/gcc_4.x_Revert-avoid-changing-the-global-LC_TIME-for-Release.patch b/meta/recipes-devtools/apt/apt/gcc_4.x_Revert-avoid-changing-the-global-LC_TIME-for-Release.patch
new file mode 100644
index 0000000000..438de209a2
--- /dev/null
+++ b/meta/recipes-devtools/apt/apt/gcc_4.x_Revert-avoid-changing-the-global-LC_TIME-for-Release.patch
@@ -0,0 +1,80 @@
1From 7ef2b2dba0e0bee450da3c8450ea782a3e7d6429 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal.limon@linux.intel.com>
3Date: Tue, 22 Aug 2017 11:49:01 -0500
4Subject: [PATCH 3/3] Revert "avoid changing the global LC_TIME for Release
5 writing"
6
7This reverts commit 78e7b683c645e907db12658405a4b201a6243ea8.
8
9After we drop debian8 and centos7 that has gcc < 5 (std::put_time not available)
10versions this patch can be remove.
11
12Signed-off-by: Anibal Limon <limon.anibal@gmail.com>
13
14Upstream-Status: Inappropriate [embedded specific]
15---
16 ftparchive/writer.cc | 29 +++++++++++++++++------------
17 1 file changed, 17 insertions(+), 12 deletions(-)
18
19diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc
20index 2596382..e43a643 100644
21--- a/ftparchive/writer.cc
22+++ b/ftparchive/writer.cc
23@@ -37,7 +37,6 @@
24 #include <unistd.h>
25 #include <ctime>
26 #include <iostream>
27-#include <iomanip>
28 #include <sstream>
29 #include <memory>
30 #include <utility>
31@@ -984,29 +983,35 @@ ReleaseWriter::ReleaseWriter(FileFd * const GivenOutput, string const &/*DB*/) :
32 AddPatterns(_config->FindVector("APT::FTPArchive::Release::Patterns"));
33
34 time_t const now = time(NULL);
35- auto const posix = std::locale("C.UTF-8");
36
37- // FIXME: use TimeRFC1123 here? But that uses GMT to satisfy HTTP/1.1
38- std::ostringstream datestr;
39- datestr.imbue(posix);
40- datestr << std::put_time(gmtime(&now), "%a, %d %b %Y %H:%M:%S UTC");
41+ setlocale(LC_TIME, "C");
42+
43+ char datestr[128];
44+ if (strftime(datestr, sizeof(datestr), "%a, %d %b %Y %H:%M:%S UTC",
45+ gmtime(&now)) == 0)
46+ {
47+ datestr[0] = '\0';
48+ }
49
50 time_t const validuntil = now + _config->FindI("APT::FTPArchive::Release::ValidTime", 0);
51- std::ostringstream validstr;
52- if (validuntil != now)
53+ char validstr[128];
54+ if (now == validuntil ||
55+ strftime(validstr, sizeof(validstr), "%a, %d %b %Y %H:%M:%S UTC",
56+ gmtime(&validuntil)) == 0)
57 {
58- datestr.imbue(posix);
59- validstr << std::put_time(gmtime(&validuntil), "%a, %d %b %Y %H:%M:%S UTC");
60+ validstr[0] = '\0';
61 }
62
63+ setlocale(LC_TIME, "");
64+
65 map<string,string> Fields;
66 Fields["Origin"] = "";
67 Fields["Label"] = "";
68 Fields["Suite"] = "";
69 Fields["Version"] = "";
70 Fields["Codename"] = "";
71- Fields["Date"] = datestr.str();
72- Fields["Valid-Until"] = validstr.str();
73+ Fields["Date"] = datestr;
74+ Fields["Valid-Until"] = validstr;
75 Fields["Architectures"] = "";
76 Fields["Components"] = "";
77 Fields["Description"] = "";
78--
792.1.4
80