summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/apt
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2021-03-20 14:49:55 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-03-23 22:51:25 +0000
commitad43cc66d21d0623d49b193b44e8d3837cc2fe02 (patch)
tree63b6fbfcc9d6b16c8da5005a08a315342e670d1e /meta/recipes-devtools/apt
parent94fa96262a5868c615ccf407bd0c4c40ca9c8cae (diff)
downloadpoky-ad43cc66d21d0623d49b193b44e8d3837cc2fe02.tar.gz
apt: Support old resolver as fallback
Not all C libraries implement the new resolver APIs e.g. musl, therefore keep the old interfaces around and choose using __RES version macro which is meant for this kind of work. (From OE-Core rev: 7450cae1d886abe0d6c7b738a9001579c2b530e0) Signed-off-by: Khem Raj <raj.khem@gmail.com> Cc: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/apt')
-rw-r--r--meta/recipes-devtools/apt/apt/0001-srvrec-Keep-support-for-older-resolver.patch44
-rw-r--r--meta/recipes-devtools/apt/apt_2.2.2.bb3
2 files changed, 46 insertions, 1 deletions
diff --git a/meta/recipes-devtools/apt/apt/0001-srvrec-Keep-support-for-older-resolver.patch b/meta/recipes-devtools/apt/apt/0001-srvrec-Keep-support-for-older-resolver.patch
new file mode 100644
index 0000000000..94d67a87ac
--- /dev/null
+++ b/meta/recipes-devtools/apt/apt/0001-srvrec-Keep-support-for-older-resolver.patch
@@ -0,0 +1,44 @@
1From f98c12b9f04ef3a9daec822c210044095b41a0ac Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 20 Mar 2021 12:33:34 -0700
4Subject: [PATCH] srvrec: Keep support for older resolver
5
6Some C libraries e.g. musl do not implement the new res_n* APIs
7therefore keep the old implementation as fallback and check __RES
8version macro to determine the API level
9
10Upstream-Status: Submitted [https://github.com/Debian/apt/pull/129]
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12Cc: Julian Andres Klode <julian.klode@canonical.com>
13---
14 apt-pkg/contrib/srvrec.cc | 7 +++++++
15 1 file changed, 7 insertions(+)
16
17diff --git a/apt-pkg/contrib/srvrec.cc b/apt-pkg/contrib/srvrec.cc
18index 4ca208273..3eb5f1d4c 100644
19--- a/apt-pkg/contrib/srvrec.cc
20+++ b/apt-pkg/contrib/srvrec.cc
21@@ -62,6 +62,7 @@ bool GetSrvRecords(std::string name, std::vector<SrvRec> &Result)
22 unsigned char answer[PACKETSZ];
23 int answer_len, compressed_name_len;
24 int answer_count;
25+#if __RES >= 19991006
26 struct __res_state res;
27
28 if (res_ninit(&res) != 0)
29@@ -71,6 +72,12 @@ bool GetSrvRecords(std::string name, std::vector<SrvRec> &Result)
30 std::shared_ptr<void> guard(&res, res_nclose);
31
32 answer_len = res_nquery(&res, name.c_str(), C_IN, T_SRV, answer, sizeof(answer));
33+#else
34+ if (res_init() != 0)
35+ return _error->Errno("res_init", "Failed to init resolver");
36+
37+ answer_len = res_query(name.c_str(), C_IN, T_SRV, answer, sizeof(answer));
38+#endif //__RES >= 19991006
39 if (answer_len == -1)
40 return false;
41 if (answer_len < (int)sizeof(HEADER))
42--
432.31.0
44
diff --git a/meta/recipes-devtools/apt/apt_2.2.2.bb b/meta/recipes-devtools/apt/apt_2.2.2.bb
index b838495da8..7ee661d4c8 100644
--- a/meta/recipes-devtools/apt/apt_2.2.2.bb
+++ b/meta/recipes-devtools/apt/apt_2.2.2.bb
@@ -10,8 +10,9 @@ SRC_URI = "${DEBIAN_MIRROR}/main/a/apt/${BPN}_${PV}.tar.xz \
10 file://0001-Disable-documentation-directory-altogether.patch \ 10 file://0001-Disable-documentation-directory-altogether.patch \
11 file://0001-Fix-musl-build.patch \ 11 file://0001-Fix-musl-build.patch \
12 file://0001-CMakeLists.txt-avoid-changing-install-paths-based-on.patch \ 12 file://0001-CMakeLists.txt-avoid-changing-install-paths-based-on.patch \
13 file://0001-srvrec-Keep-support-for-older-resolver.patch \
13 " 14 "
14 15
15SRC_URI_append_class-native = " \ 16SRC_URI_append_class-native = " \
16 file://0001-Do-not-init-tables-from-dpkg-configuration.patch \ 17 file://0001-Do-not-init-tables-from-dpkg-configuration.patch \
17 file://0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch \ 18 file://0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch \