summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRandy MacLeod <Randy.MacLeod@windriver.com>2019-02-01 16:16:28 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-02-05 00:26:04 +0000
commitd55fdec53cdf6aa2b84db5498f5d60f5effac95f (patch)
tree0af8406f552205bb43fe70c724ee9421b4b8ea8f
parent963ab2c49bd776793d4648e57188e3083ef4103a (diff)
downloadpoky-d55fdec53cdf6aa2b84db5498f5d60f5effac95f.tar.gz
libsolv: Drop now uneeded musl patch
Drop the musl specific fopencookie patches since musl added support for fopencookie in: 06184334 implement the fopencookie extension to stdio in December 2017 so it has been in musl since v1.1.19. There was no change in libsolv's configure log when building with musl and these patches dropped. (From OE-Core rev: 8eeb5bae02331cec3bea98adef784357c6e3c910) Signed-off-by: Randy MacLeod <Randy.MacLeod@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch251
-rw-r--r--meta/recipes-extended/libsolv/libsolv/0002-Fixes-to-internal-fopencookie-implementation.patch105
-rw-r--r--meta/recipes-extended/libsolv/libsolv_0.7.3.bb3
3 files changed, 0 insertions, 359 deletions
diff --git a/meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch b/meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch
deleted file mode 100644
index e5cb60dd56..0000000000
--- a/meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch
+++ /dev/null
@@ -1,251 +0,0 @@
1From 47c6f1b4332a9e4935c48cca826786a6b8fe6f59 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Neal=20Gompa=20=28=E3=83=8B=E3=83=BC=E3=83=AB=E3=83=BB?=
3 =?UTF-8?q?=E3=82=B3=E3=82=99=E3=83=B3=E3=83=8F=E3=82=9A=29?=
4 <ngompa13@gmail.com>
5Date: Wed, 11 Nov 2015 20:32:17 -0500
6Subject: [PATCH 1/2] Add fallback fopencookie() implementation
7
8In environments where neither fopencookie() nor funopen()
9are implemented, we need to provide a suitable implementation
10of fopencookie() that we can use.
11
12Alex Kanavin: rebased CMakeLists.txt change to apply to latest upstream code.
13
14Upstream-Status: Denied [https://github.com/openSUSE/libsolv/pull/112]
15Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
16
17---
18 ext/CMakeLists.txt | 7 ++
19 ext/solv_xfopen.c | 10 +--
20 ext/solv_xfopen_fallback_fopencookie.c | 123 +++++++++++++++++++++++++++++++++
21 ext/solv_xfopen_fallback_fopencookie.h | 28 ++++++++
22 4 files changed, 164 insertions(+), 4 deletions(-)
23 create mode 100644 ext/solv_xfopen_fallback_fopencookie.c
24 create mode 100644 ext/solv_xfopen_fallback_fopencookie.h
25
26diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt
27index b8917a2..fac6c32 100644
28--- a/ext/CMakeLists.txt
29+++ b/ext/CMakeLists.txt
30@@ -4,6 +4,13 @@ SET (libsolvext_SRCS
31 SET (libsolvext_HEADERS
32 tools_util.h solv_xfopen.h testcase.h)
33
34+IF (NOT HAVE_FOPENCOOKIE AND NOT HAVE_FUNOPEN)
35+ SET (libsolvext_SRCS ${libsolvext_SRCS}
36+ solv_xfopen_fallback_fopencookie.c)
37+ SET (libsolvext_HEADERS ${libsolvext_HEADERS}
38+ solv_xfopen_fallback_fopencookie.h)
39+ENDIF (NOT HAVE_FOPENCOOKIE AND NOT HAVE_FUNOPEN)
40+
41 IF (ENABLE_RPMDB OR ENABLE_RPMPKG)
42 SET (libsolvext_SRCS ${libsolvext_SRCS}
43 pool_fileconflicts.c repo_rpmdb.c)
44diff --git a/ext/solv_xfopen.c b/ext/solv_xfopen.c
45index 2c64bb6..eb3a3ad 100644
46--- a/ext/solv_xfopen.c
47+++ b/ext/solv_xfopen.c
48@@ -12,6 +12,10 @@
49 #include <string.h>
50 #include <fcntl.h>
51
52+#if !defined(HAVE_FUNOPEN) && !defined(HAVE_FOPENCOOKIE)
53+#include "solv_xfopen_fallback_fopencookie.h"
54+#endif
55+
56 #include "solv_xfopen.h"
57 #include "util.h"
58
59@@ -21,7 +25,7 @@ static FILE *cookieopen(void *cookie, const char *mode,
60 ssize_t (*cwrite)(void *, const char *, size_t),
61 int (*cclose)(void *))
62 {
63-#ifdef HAVE_FUNOPEN
64+#if defined(HAVE_FUNOPEN) && !defined(HAVE_FOPENCOOKIE)
65 if (!cookie)
66 return 0;
67 return funopen(cookie,
68@@ -30,7 +34,7 @@ static FILE *cookieopen(void *cookie, const char *mode,
69 (fpos_t (*)(void *, fpos_t, int))NULL, /* seekfn */
70 cclose
71 );
72-#elif defined(HAVE_FOPENCOOKIE)
73+#else
74 cookie_io_functions_t cio;
75
76 if (!cookie)
77@@ -42,8 +46,6 @@ static FILE *cookieopen(void *cookie, const char *mode,
78 cio.write = cwrite;
79 cio.close = cclose;
80 return fopencookie(cookie, *mode == 'w' ? "w" : "r", cio);
81-#else
82-# error Need to implement custom I/O
83 #endif
84 }
85
86diff --git a/ext/solv_xfopen_fallback_fopencookie.c b/ext/solv_xfopen_fallback_fopencookie.c
87new file mode 100644
88index 0000000..0ce2571
89--- /dev/null
90+++ b/ext/solv_xfopen_fallback_fopencookie.c
91@@ -0,0 +1,123 @@
92+/*
93+ * Provides a very limited fopencookie() for environments with a libc
94+ * that lacks it.
95+ *
96+ * Author: zhasha
97+ * Modified for libsolv by Neal Gompa
98+ *
99+ * This program is licensed under the BSD license, read LICENSE.BSD
100+ * for further information.
101+ *
102+ */
103+
104+#define _LARGEFILE64_SOURCE 1
105+#include <pthread.h>
106+#include <stdio.h>
107+#include <stdlib.h>
108+#include <unistd.h>
109+#include <fcntl.h>
110+#include <sys/types.h>
111+#include <errno.h>
112+#include "solv_xfopen_fallback_fopencookie.h"
113+
114+extern int pipe2(int[2], int);
115+
116+struct ctx {
117+ int fd;
118+ void *cookie;
119+ struct cookie_io_functions_t io;
120+ char buf[1024];
121+};
122+
123+static void *proxy(void *arg)
124+{
125+ struct ctx *ctx = arg;
126+ ssize_t r;
127+ size_t n;
128+
129+ pthread_detach(pthread_self());
130+
131+ while (1) {
132+ r = ctx->io.read ?
133+ (ctx->io.read)(ctx->cookie, ctx->buf, sizeof(ctx->buf)) :
134+ read(ctx->fd, ctx->buf, sizeof(ctx->buf));
135+ if (r < 0) {
136+ if (errno != EINTR) { break; }
137+ continue;
138+ }
139+ if (r == 0) { break; }
140+
141+ while (n > 0) {
142+ r = ctx->io.write ?
143+ (ctx->io.write)(ctx->cookie, ctx->buf + ((size_t)r - n), n) :
144+ write(ctx->fd, ctx->buf + ((size_t)r - n), n);
145+ if (r < 0) {
146+ if (errno != EINTR) { break; }
147+ continue;
148+ }
149+ if (r == 0) { break; }
150+
151+ n -= (size_t)r;
152+ }
153+ if (n > 0) { break; }
154+ }
155+
156+ if (ctx->io.close) { (ctx->io.close)(ctx->cookie); }
157+ close(ctx->fd);
158+ return NULL;
159+}
160+
161+FILE *fopencookie(void *cookie, const char *mode, struct cookie_io_functions_t io)
162+{
163+ struct ctx *ctx = NULL;
164+ int rd = 0, wr = 0;
165+ int p[2] = { -1, -1 };
166+ FILE *f = NULL;
167+ pthread_t dummy;
168+
169+ switch (mode[0]) {
170+ case 'a':
171+ case 'r': rd = 1; break;
172+ case 'w': wr = 1; break;
173+ default:
174+ errno = EINVAL;
175+ return NULL;
176+ }
177+ switch (mode[1]) {
178+ case '\0': break;
179+ case '+':
180+ if (mode[2] == '\0') {
181+ errno = ENOTSUP;
182+ return NULL;
183+ }
184+ default:
185+ errno = EINVAL;
186+ return NULL;
187+ }
188+ if (io.seek) {
189+ errno = ENOTSUP;
190+ return NULL;
191+ }
192+
193+ ctx = malloc(sizeof(*ctx));
194+ if (!ctx) { return NULL; }
195+ if (pipe2(p, O_CLOEXEC) != 0) { goto err; }
196+ if ((f = fdopen(p[wr], mode)) == NULL) { goto err; }
197+ p[wr] = -1;
198+ ctx->fd = p[rd];
199+ ctx->cookie = cookie;
200+ ctx->io.read = rd ? io.read : NULL;
201+ ctx->io.write = wr ? io.write : NULL;
202+ ctx->io.seek = NULL;
203+ ctx->io.close = io.close;
204+ if (pthread_create(&dummy, NULL, proxy, ctx) != 0) { goto err; }
205+
206+ return f;
207+
208+err:
209+ if (p[0] >= 0) { close(p[0]); }
210+ if (p[1] >= 0) { close(p[1]); }
211+ if (f) { fclose(f); }
212+ free(ctx);
213+ return NULL;
214+}
215diff --git a/ext/solv_xfopen_fallback_fopencookie.h b/ext/solv_xfopen_fallback_fopencookie.h
216new file mode 100644
217index 0000000..6a7bfee
218--- /dev/null
219+++ b/ext/solv_xfopen_fallback_fopencookie.h
220@@ -0,0 +1,28 @@
221+/*
222+ * Provides a very limited fopencookie() for environments with a libc
223+ * that lacks it.
224+ *
225+ * Author: zhasha
226+ * Modified for libsolv by Neal Gompa
227+ *
228+ * This program is licensed under the BSD license, read LICENSE.BSD
229+ * for further information.
230+ *
231+ */
232+
233+#ifndef SOLV_XFOPEN_FALLBACK_FOPENCOOKIE_H
234+#define SOLV_XFOPEN_FALLBACK_FOPENCOOKIE_H
235+
236+#include <stdio.h>
237+#include <stdint.h>
238+
239+typedef struct cookie_io_functions_t {
240+ ssize_t (*read)(void *, char *, size_t);
241+ ssize_t (*write)(void *, const char *, size_t);
242+ int (*seek)(void *, off64_t, int);
243+ int (*close)(void *);
244+} cookie_io_functions_t;
245+
246+FILE *fopencookie(void *cookie, const char *mode, struct cookie_io_functions_t io);
247+
248+#endif
249--
2502.4.0
251
diff --git a/meta/recipes-extended/libsolv/libsolv/0002-Fixes-to-internal-fopencookie-implementation.patch b/meta/recipes-extended/libsolv/libsolv/0002-Fixes-to-internal-fopencookie-implementation.patch
deleted file mode 100644
index 93b8cc9c18..0000000000
--- a/meta/recipes-extended/libsolv/libsolv/0002-Fixes-to-internal-fopencookie-implementation.patch
+++ /dev/null
@@ -1,105 +0,0 @@
1From 84e12bf7ece49073c559dfd58005132a6099a964 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Neal=20Gompa=20=28=E3=83=8B=E3=83=BC=E3=83=AB=E3=83=BB?=
3 =?UTF-8?q?=E3=82=B3=E3=82=99=E3=83=B3=E3=83=8F=E3=82=9A=29?=
4 <ngompa13@gmail.com>
5Date: Mon, 23 Nov 2015 18:19:41 -0500
6Subject: [PATCH 2/2] Fixes to internal fopencookie() implementation
7
8Credits to the fixes go to nsz on #musl on Freenode,
9who gloriously fixed the implementation such that
10the tests all pass.
11
12Upstream-Status: Denied [https://github.com/openSUSE/libsolv/pull/112]
13Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
14
15---
16 ext/solv_xfopen_fallback_fopencookie.c | 19 ++++++++++---------
17 ext/solv_xfopen_fallback_fopencookie.h | 10 +++++-----
18 2 files changed, 15 insertions(+), 14 deletions(-)
19
20diff --git a/ext/solv_xfopen_fallback_fopencookie.c b/ext/solv_xfopen_fallback_fopencookie.c
21index 0ce2571..89426a9 100644
22--- a/ext/solv_xfopen_fallback_fopencookie.c
23+++ b/ext/solv_xfopen_fallback_fopencookie.c
24@@ -1,10 +1,10 @@
25-/*
26+/*
27 * Provides a very limited fopencookie() for environments with a libc
28 * that lacks it.
29- *
30- * Author: zhasha
31+ *
32+ * Authors: zhasha & nsz
33 * Modified for libsolv by Neal Gompa
34- *
35+ *
36 * This program is licensed under the BSD license, read LICENSE.BSD
37 * for further information.
38 *
39@@ -33,7 +33,7 @@ static void *proxy(void *arg)
40 {
41 struct ctx *ctx = arg;
42 ssize_t r;
43- size_t n;
44+ size_t n, k;
45
46 pthread_detach(pthread_self());
47
48@@ -47,17 +47,18 @@ static void *proxy(void *arg)
49 }
50 if (r == 0) { break; }
51
52+ n = r, k = 0;
53 while (n > 0) {
54 r = ctx->io.write ?
55- (ctx->io.write)(ctx->cookie, ctx->buf + ((size_t)r - n), n) :
56- write(ctx->fd, ctx->buf + ((size_t)r - n), n);
57+ (ctx->io.write)(ctx->cookie, ctx->buf + k, n) :
58+ write(ctx->fd, ctx->buf + k, n);
59 if (r < 0) {
60 if (errno != EINTR) { break; }
61 continue;
62 }
63 if (r == 0) { break; }
64
65- n -= (size_t)r;
66+ n -= r, k += r;
67 }
68 if (n > 0) { break; }
69 }
70@@ -77,8 +78,8 @@ FILE *fopencookie(void *cookie, const char *mode, struct cookie_io_functions_t i
71
72 switch (mode[0]) {
73 case 'a':
74- case 'r': rd = 1; break;
75 case 'w': wr = 1; break;
76+ case 'r': rd = 1; break;
77 default:
78 errno = EINVAL;
79 return NULL;
80diff --git a/ext/solv_xfopen_fallback_fopencookie.h b/ext/solv_xfopen_fallback_fopencookie.h
81index 6a7bfee..7223e3f 100644
82--- a/ext/solv_xfopen_fallback_fopencookie.h
83+++ b/ext/solv_xfopen_fallback_fopencookie.h
84@@ -1,13 +1,13 @@
85-/*
86+/*
87 * Provides a very limited fopencookie() for environments with a libc
88 * that lacks it.
89- *
90- * Author: zhasha
91+ *
92+ * Authors: zhasha & nsz
93 * Modified for libsolv by Neal Gompa
94- *
95+ *
96 * This program is licensed under the BSD license, read LICENSE.BSD
97 * for further information.
98- *
99+ *
100 */
101
102 #ifndef SOLV_XFOPEN_FALLBACK_FOPENCOOKIE_H
103--
1042.4.0
105
diff --git a/meta/recipes-extended/libsolv/libsolv_0.7.3.bb b/meta/recipes-extended/libsolv/libsolv_0.7.3.bb
index 7321d63374..44757ac54f 100644
--- a/meta/recipes-extended/libsolv/libsolv_0.7.3.bb
+++ b/meta/recipes-extended/libsolv/libsolv_0.7.3.bb
@@ -8,9 +8,6 @@ LIC_FILES_CHKSUM = "file://LICENSE.BSD;md5=62272bd11c97396d4aaf1c41bc11f7d8"
8DEPENDS = "expat zlib" 8DEPENDS = "expat zlib"
9 9
10SRC_URI = "git://github.com/openSUSE/libsolv.git" 10SRC_URI = "git://github.com/openSUSE/libsolv.git"
11SRC_URI_append_libc-musl = " file://0001-Add-fallback-fopencookie-implementation.patch \
12 file://0002-Fixes-to-internal-fopencookie-implementation.patch \
13 "
14 11
15SRCREV = "dc7d0f1c3113f2c8217563166906bef3eb5d1ee1" 12SRCREV = "dc7d0f1c3113f2c8217563166906bef3eb5d1ee1"
16UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)" 13UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)"