summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2022-09-17 08:14:02 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-09-20 23:17:53 +0100
commit4169c106a3313071acb34cce41873e1ce93b0be7 (patch)
tree51a741040a92c81eb0d96f420b020700719e7b29
parent249f19e21a65f42742efcf125065961ce9e32770 (diff)
downloadpoky-4169c106a3313071acb34cce41873e1ce93b0be7.tar.gz
apt: Fix type mismatches and ptest builds
These issues are found with clang15 (From OE-Core rev: 43ac1ce1df152753d9c92360942d99add81bd4ca) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/apt/apt/0001-typecast-time_t-and-suseconds_t-from-std-chrono.patch64
-rw-r--r--meta/recipes-devtools/apt/apt/0002-interactive-helper-Undefine-_FORTIFY_SOURCE.patch27
-rw-r--r--meta/recipes-devtools/apt/apt_2.4.5.bb2
3 files changed, 93 insertions, 0 deletions
diff --git a/meta/recipes-devtools/apt/apt/0001-typecast-time_t-and-suseconds_t-from-std-chrono.patch b/meta/recipes-devtools/apt/apt/0001-typecast-time_t-and-suseconds_t-from-std-chrono.patch
new file mode 100644
index 0000000000..fc3509d336
--- /dev/null
+++ b/meta/recipes-devtools/apt/apt/0001-typecast-time_t-and-suseconds_t-from-std-chrono.patch
@@ -0,0 +1,64 @@
1From b7a1a4d3259557f2587f7d5d47502691d94c21c2 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 16 Sep 2022 20:00:30 -0700
4Subject: [PATCH 1/2] typecast time_t and suseconds_t from std::chrono
5
6This fixes build on some architectures like mips
7progress.cc:125:31: error: non-constant-expression cannot be narrowed from type 'std::chrono::duration<long long>::rep' (aka 'long long') to '__time_t' (aka 'long') in initializer list [-Wc++11-narrowing]
8 struct timeval NowTime = { Now_sec.count(), Now_usec.count() };
9
10Upstream-Status: Submitted [https://salsa.debian.org/apt-team/apt/-/merge_requests/259]
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 apt-pkg/acquire.cc | 4 ++--
14 apt-pkg/contrib/progress.cc | 2 +-
15 ftparchive/apt-ftparchive.cc | 2 +-
16 3 files changed, 4 insertions(+), 4 deletions(-)
17
18diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
19index 100ccde..dd0624a 100644
20--- a/apt-pkg/acquire.cc
21+++ b/apt-pkg/acquire.cc
22@@ -53,11 +53,11 @@
23 using namespace std;
24
25 // helper to convert time_point to a timeval
26-static struct timeval SteadyDurationToTimeVal(std::chrono::steady_clock::duration Time)
27+constexpr struct timeval SteadyDurationToTimeVal(std::chrono::steady_clock::duration Time)
28 {
29 auto const Time_sec = std::chrono::duration_cast<std::chrono::seconds>(Time);
30 auto const Time_usec = std::chrono::duration_cast<std::chrono::microseconds>(Time - Time_sec);
31- return {Time_sec.count(), Time_usec.count()};
32+ return timeval{static_cast<time_t>(Time_sec.count()), static_cast<suseconds_t>(Time_usec.count())};
33 }
34
35 std::string pkgAcquire::URIEncode(std::string const &part) /*{{{*/
36diff --git a/apt-pkg/contrib/progress.cc b/apt-pkg/contrib/progress.cc
37index 03f88d4..eb688b9 100644
38--- a/apt-pkg/contrib/progress.cc
39+++ b/apt-pkg/contrib/progress.cc
40@@ -122,7 +122,7 @@ bool OpProgress::CheckChange(float Interval)
41 auto const Now = std::chrono::steady_clock::now().time_since_epoch();
42 auto const Now_sec = std::chrono::duration_cast<std::chrono::seconds>(Now);
43 auto const Now_usec = std::chrono::duration_cast<std::chrono::microseconds>(Now - Now_sec);
44- struct timeval NowTime = { Now_sec.count(), Now_usec.count() };
45+ struct timeval NowTime = { static_cast<time_t>(Now_sec.count()), static_cast<suseconds_t>(Now_usec.count()) };
46
47 std::chrono::duration<decltype(Interval)> Delta =
48 std::chrono::seconds(NowTime.tv_sec - LastTime.tv_sec) +
49diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc
50index 56fdc22..0a253b1 100644
51--- a/ftparchive/apt-ftparchive.cc
52+++ b/ftparchive/apt-ftparchive.cc
53@@ -58,7 +58,7 @@ static struct timeval GetTimevalFromSteadyClock() /*{{{*/
54 auto const Time = std::chrono::steady_clock::now().time_since_epoch();
55 auto const Time_sec = std::chrono::duration_cast<std::chrono::seconds>(Time);
56 auto const Time_usec = std::chrono::duration_cast<std::chrono::microseconds>(Time - Time_sec);
57- return { Time_sec.count(), Time_usec.count() };
58+ return { static_cast<time_t>(Time_sec.count()), static_cast<suseconds_t>(Time_usec.count()) };
59 }
60 /*}}}*/
61 static auto GetTimeDeltaSince(struct timeval StartTime) /*{{{*/
62--
632.37.3
64
diff --git a/meta/recipes-devtools/apt/apt/0002-interactive-helper-Undefine-_FORTIFY_SOURCE.patch b/meta/recipes-devtools/apt/apt/0002-interactive-helper-Undefine-_FORTIFY_SOURCE.patch
new file mode 100644
index 0000000000..18c4641b22
--- /dev/null
+++ b/meta/recipes-devtools/apt/apt/0002-interactive-helper-Undefine-_FORTIFY_SOURCE.patch
@@ -0,0 +1,27 @@
1From 891076c2cf4298b5d587545497f4831f0d21caa1 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 16 Sep 2022 20:04:43 -0700
4Subject: [PATCH 2/2] interactive-helper: Undefine _FORTIFY_SOURCE
5
6This ensures that it compiles when clang compiler is passing
7-DFORTIFY_SOURCES=2
8
9Upstream-Status: Submitted [https://salsa.debian.org/apt-team/apt/-/merge_requests/259]
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 test/interactive-helper/libnoprofile.c | 1 +
13 1 file changed, 1 insertion(+)
14
15diff --git a/test/interactive-helper/libnoprofile.c b/test/interactive-helper/libnoprofile.c
16index f11b898..b26ec2a 100644
17--- a/test/interactive-helper/libnoprofile.c
18+++ b/test/interactive-helper/libnoprofile.c
19@@ -1,4 +1,5 @@
20 #define _GNU_SOURCE
21+#undef _FORTIFY_SOURCE
22 #include <stdarg.h>
23 #include <stdlib.h>
24 #include <string.h>
25--
262.37.3
27
diff --git a/meta/recipes-devtools/apt/apt_2.4.5.bb b/meta/recipes-devtools/apt/apt_2.4.5.bb
index 564bdeec41..4b9f804039 100644
--- a/meta/recipes-devtools/apt/apt_2.4.5.bb
+++ b/meta/recipes-devtools/apt/apt_2.4.5.bb
@@ -14,6 +14,8 @@ SRC_URI = "${DEBIAN_MIRROR}/main/a/apt/${BPN}_${PV}.tar.xz \
14 file://0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch \ 14 file://0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch \
15 file://0001-aptwebserver.cc-Include-array.patch \ 15 file://0001-aptwebserver.cc-Include-array.patch \
16 file://0001-Remove-using-std-binary_function.patch \ 16 file://0001-Remove-using-std-binary_function.patch \
17 file://0001-typecast-time_t-and-suseconds_t-from-std-chrono.patch \
18 file://0002-interactive-helper-Undefine-_FORTIFY_SOURCE.patch \
17 " 19 "
18 20
19SRC_URI:append:class-native = " \ 21SRC_URI:append:class-native = " \