apt: Remove workarounds for host gcc < 5

(From OE-Core rev: f905eabaeb6b32ac9f3d6d8695fe9f8628c1bec5)

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Adrian Bunk
2020-05-12 23:37:45 +03:00
committed by Richard Purdie
parent d91e47d9ab
commit e992ffd162
4 changed files with 1 additions and 162 deletions

View File

@@ -2,6 +2,4 @@ require apt-native.inc
SRC_URI += "file://noconfigure.patch \
file://no-curl.patch \
file://gcc_4.x_apt-pkg-contrib-strutl.cc-Include-array-header.patch \
file://gcc_4.x_Revert-avoid-changing-the-global-LC_TIME-for-Release.patch \
file://gcc_4.x_Revert-use-de-localed-std-put_time-instead-rolling-o.patch"
"

View File

@@ -1,80 +0,0 @@
From 7ef2b2dba0e0bee450da3c8450ea782a3e7d6429 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal.limon@linux.intel.com>
Date: Tue, 22 Aug 2017 11:49:01 -0500
Subject: [PATCH 3/3] Revert "avoid changing the global LC_TIME for Release
writing"
This reverts commit 78e7b683c645e907db12658405a4b201a6243ea8.
After we drop debian8 and centos7 that has gcc < 5 (std::put_time not available)
versions this patch can be remove.
Signed-off-by: Anibal Limon <limon.anibal@gmail.com>
Upstream-Status: Inappropriate [embedded specific]
---
ftparchive/writer.cc | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc
index 2596382..e43a643 100644
--- a/ftparchive/writer.cc
+++ b/ftparchive/writer.cc
@@ -37,7 +37,6 @@
#include <unistd.h>
#include <ctime>
#include <iostream>
-#include <iomanip>
#include <sstream>
#include <memory>
#include <utility>
@@ -984,29 +983,35 @@ ReleaseWriter::ReleaseWriter(FileFd * const GivenOutput, string const &/*DB*/) :
AddPatterns(_config->FindVector("APT::FTPArchive::Release::Patterns"));
time_t const now = time(NULL);
- auto const posix = std::locale("C.UTF-8");
- // FIXME: use TimeRFC1123 here? But that uses GMT to satisfy HTTP/1.1
- std::ostringstream datestr;
- datestr.imbue(posix);
- datestr << std::put_time(gmtime(&now), "%a, %d %b %Y %H:%M:%S UTC");
+ setlocale(LC_TIME, "C");
+
+ char datestr[128];
+ if (strftime(datestr, sizeof(datestr), "%a, %d %b %Y %H:%M:%S UTC",
+ gmtime(&now)) == 0)
+ {
+ datestr[0] = '\0';
+ }
time_t const validuntil = now + _config->FindI("APT::FTPArchive::Release::ValidTime", 0);
- std::ostringstream validstr;
- if (validuntil != now)
+ char validstr[128];
+ if (now == validuntil ||
+ strftime(validstr, sizeof(validstr), "%a, %d %b %Y %H:%M:%S UTC",
+ gmtime(&validuntil)) == 0)
{
- datestr.imbue(posix);
- validstr << std::put_time(gmtime(&validuntil), "%a, %d %b %Y %H:%M:%S UTC");
+ validstr[0] = '\0';
}
+ setlocale(LC_TIME, "");
+
map<string,string> Fields;
Fields["Origin"] = "";
Fields["Label"] = "";
Fields["Suite"] = "";
Fields["Version"] = "";
Fields["Codename"] = "";
- Fields["Date"] = datestr.str();
- Fields["Valid-Until"] = validstr.str();
+ Fields["Date"] = datestr;
+ Fields["Valid-Until"] = validstr;
Fields["Architectures"] = "";
Fields["Components"] = "";
Fields["Description"] = "";
--
2.1.4

View File

@@ -1,46 +0,0 @@
From c72ef9b6ae83a0a2fbbefd5c050335f65f0d2bc9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal.limon@linux.intel.com>
Date: Tue, 22 Aug 2017 11:48:46 -0500
Subject: [PATCH 2/3] Revert "use de-localed std::put_time instead rolling our
own"
This reverts commit 4ed2a17ab4334f019c00512aa54a162f0bf083c4.
After we drop debian8 and centos7 that has gcc < 5 (std::put_time not available)
versions this patch can be remove.
Signed-off-by: Anibal Limon <limon.anibal@gmail.com>
Upstream-Status: Inappropriate [embedded specific]
---
apt-pkg/contrib/strutl.cc | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index c2ff01d..e9ef2be 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -760,11 +760,15 @@ string TimeRFC1123(time_t Date)
if (gmtime_r(&Date, &Conv) == NULL)
return "";
- auto const posix = std::locale::classic();
- std::ostringstream datestr;
- datestr.imbue(posix);
- datestr << std::put_time(&Conv, "%a, %d %b %Y %H:%M:%S GMT");
- return datestr.str();
+ char Buf[300];
+ const char *Day[] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
+ const char *Month[] = {"Jan","Feb","Mar","Apr","May","Jun","Jul",
+ "Aug","Sep","Oct","Nov","Dec"};
+
+ snprintf(Buf, sizeof(Buf), "%s, %02i %s %i %02i:%02i:%02i GMT",Day[Conv.tm_wday],
+ Conv.tm_mday,Month[Conv.tm_mon],Conv.tm_year+1900,Conv.tm_hour,
+ Conv.tm_min,Conv.tm_sec);
+ return Buf;
}
/*}}}*/
// ReadMessages - Read messages from the FD /*{{{*/
--
2.1.4

View File

@@ -1,33 +0,0 @@
From ff8562f7724c4db4b83635af9e627f3495222327 Mon Sep 17 00:00:00 2001
From: Anibal Limon <limon.anibal@gmail.com>
Date: Tue, 22 Aug 2017 04:41:31 -0500
Subject: [PATCH 1/3] apt-pkg/contrib/strutl.cc: Include array header
If GCC version is less than 5 the array header needs to be included
to support std::array.
After we drop debian8 and centos7 that has gcc < 5 versions this patch
can be remove.
Signed-off-by: Anibal Limon <limon.anibal@gmail.com>
Upstream-Status: Inappropriate [embedded specific]
---
apt-pkg/contrib/strutl.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index 60d0ca8..c2ff01d 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -27,6 +27,7 @@
#include <sstream>
#include <string>
#include <vector>
+#include <array>
#include <stddef.h>
#include <stdlib.h>
--
2.1.4