summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rpm
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2016-02-14 20:52:49 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-15 16:28:45 +0000
commite8b0da157f102349d1ace9da6193320fc9cd16d4 (patch)
tree74e2b99a87347d84437c8abb9c1468ff41546909 /meta/recipes-devtools/rpm
parent48144e05280e6a23f159c6c93fb9338f54d84c47 (diff)
downloadpoky-e8b0da157f102349d1ace9da6193320fc9cd16d4.tar.gz
rpm: Fix build with musl
(From OE-Core rev: d0fc6e8593b951163d48665f41d6ef1eb74b8926) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/rpm')
-rw-r--r--meta/recipes-devtools/rpm/rpm/0001-rpm-Fix-build-on-musl.patch162
-rw-r--r--meta/recipes-devtools/rpm/rpm_5.4.14.bb5
2 files changed, 166 insertions, 1 deletions
diff --git a/meta/recipes-devtools/rpm/rpm/0001-rpm-Fix-build-on-musl.patch b/meta/recipes-devtools/rpm/rpm/0001-rpm-Fix-build-on-musl.patch
new file mode 100644
index 0000000000..763dc57652
--- /dev/null
+++ b/meta/recipes-devtools/rpm/rpm/0001-rpm-Fix-build-on-musl.patch
@@ -0,0 +1,162 @@
1From 0af17c2ae86c1e8e42b96f6dface08f535bb55ad Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 14 Feb 2016 08:33:24 +0000
4Subject: [PATCH] rpm: Fix build on musl
5
6Provide alternatives to assumptions about glibc
7on linux
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11Upstream-Status: Pending
12
13 rpmio/fts.c | 4 ++++
14 rpmqv.c | 6 +++++-
15 system.h | 2 +-
16 tools/debugedit.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
17 tools/rpmfind.c | 6 +++---
18 5 files changed, 60 insertions(+), 5 deletions(-)
19
20diff --git a/rpmio/fts.c b/rpmio/fts.c
21index 2d7594c..b7aa9b8 100644
22--- a/rpmio/fts.c
23+++ b/rpmio/fts.c
24@@ -124,6 +124,10 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
25 # define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
26 #endif
27
28+#ifndef _STAT_VER
29+# define _STAT_VER 0
30+#endif
31+
32 #if !defined(_D_EXACT_NAMLEN)
33 # define _D_EXACT_NAMLEN(d) (strlen((d)->d_name))
34 #endif
35diff --git a/rpmqv.c b/rpmqv.c
36index 14c73e2..b2d3e24 100644
37--- a/rpmqv.c
38+++ b/rpmqv.c
39@@ -523,7 +523,11 @@ int main(int argc, const char ** argv)
40 (void) initproctitle(argc, (char **)argv, environ);
41 #endif
42 #endif
43-
44+ /* XXX glibc churn sanity */
45+ if (__progname == NULL) {
46+ if ((__progname = strrchr(argv[0], '/')) != NULL) __progname++;
47+ else __progname = argv[0];
48+ }
49 /* Set the major mode based on argv[0] */
50 /*@-nullpass@*/
51 #ifdef IAM_RPMBT
52diff --git a/system.h b/system.h
53index 72851c0..05f7553 100644
54--- a/system.h
55+++ b/system.h
56@@ -791,5 +791,5 @@ static inline const char *rcsid(const char *p) { \
57 * Permit ar(1) payloads. Disabled while rpmio/iosm.c is under development.
58 */
59 #undef SUPPORT_AR_PAYLOADS
60-
61 #endif /* H_SYSTEM */
62+const char *program_name;
63diff --git a/tools/debugedit.c b/tools/debugedit.c
64index 29e8ee9..b2a8918 100644
65--- a/tools/debugedit.c
66+++ b/tools/debugedit.c
67@@ -23,7 +23,12 @@
68 #include <byteswap.h>
69 #include <endian.h>
70 #include <errno.h>
71+#ifdef __GLIBC__
72 #include <error.h>
73+#else
74+#include <stdarg.h>
75+void error(int, int, const char *, ...);
76+#endif
77 #include <limits.h>
78 #include <string.h>
79 #include <stdlib.h>
80@@ -1531,6 +1536,48 @@ handle_build_id (DSO *dso, Elf_Data *build_id,
81 puts (hex);
82 }
83 }
84+#ifndef __GLIBC__
85+extern char *__progname;
86+
87+void (*error_print_progname)(void) = 0;
88+unsigned int error_message_count = 0;
89+int error_one_per_line = 0;
90+
91+static void eprint(int status, int e, const char *file, unsigned int line, const char *fmt, va_list ap)
92+{
93+ if (file && error_one_per_line) {
94+ static const char *oldfile;
95+ static unsigned int oldline;
96+ if (line == oldline && strcmp(file, oldfile) == 0)
97+ return;
98+ oldfile = file;
99+ oldline = line;
100+ }
101+ if (error_print_progname)
102+ error_print_progname();
103+ else
104+ fprintf(stderr, "%s: ", __progname);
105+ if (file)
106+ fprintf(stderr, "%s:%u: ", file, line);
107+ vfprintf(stderr, fmt, ap);
108+ if (e)
109+ fprintf(stderr, ": %s", strerror(e));
110+ putc('\n', stderr);
111+ fflush(stderr);
112+ error_message_count++;
113+ if (status)
114+ exit(status);
115+}
116+
117+void error(int status, int e, const char *fmt, ...)
118+{
119+ va_list ap;
120+ va_start(ap,fmt);
121+ eprint(status, e, 0, 0, fmt, ap);
122+ va_end(ap);
123+}
124+
125+#endif
126
127 /* It avoided the segment fault while file's bss offset have a large number.
128 See https://bugzilla.redhat.com/show_bug.cgi?id=1019707
129diff --git a/tools/rpmfind.c b/tools/rpmfind.c
130index 816aeef..327fab0 100644
131--- a/tools/rpmfind.c
132+++ b/tools/rpmfind.c
133@@ -1174,7 +1174,7 @@ find_parsenum(PLAN *plan, const char *option, char *vp, char *endch)
134 * and endchar points to the beginning of the string we know we have
135 * a syntax error.
136 */
137-#if defined(__sun)
138+#if defined(__sun) || !defined(__GLIBC_)
139 value = strtoll(str, &endchar, 10);
140 #else
141 value = strtoq(str, &endchar, 10);
142@@ -1214,7 +1214,7 @@ find_parsetime(PLAN *plan, const char *option, char *vp)
143 break;
144 }
145
146-#if defined(__sun)
147+#if defined(__sun) || !defined(__GLIBC_)
148 value = strtoll(str, &unit, 10);
149 #else
150 value = strtoq(str, &unit, 10);
151@@ -1252,7 +1252,7 @@ find_parsetime(PLAN *plan, const char *option, char *vp)
152 str = unit + 1;
153 if (*str == '\0') /* EOS */
154 break;
155-#if defined(__sun)
156+#if defined(__sun) || !defined(__GLIBC_)
157 value = strtoll(str, &unit, 10);
158 #else
159 value = strtoq(str, &unit, 10);
160--
1612.7.1
162
diff --git a/meta/recipes-devtools/rpm/rpm_5.4.14.bb b/meta/recipes-devtools/rpm/rpm_5.4.14.bb
index 24aaf655df..261b280c31 100644
--- a/meta/recipes-devtools/rpm/rpm_5.4.14.bb
+++ b/meta/recipes-devtools/rpm/rpm_5.4.14.bb
@@ -103,8 +103,11 @@ SRC_URI = "http://www.rpm5.org/files/rpm/rpm-5.4/rpm-5.4.14-0.20131024.src.rpm;e
103 file://0001-define-EM_AARCH64.patch \ 103 file://0001-define-EM_AARCH64.patch \
104 file://rpm-rpmfc.c-fix-for-N32-MIPS64.patch \ 104 file://rpm-rpmfc.c-fix-for-N32-MIPS64.patch \
105 file://rpm-lib-transaction.c-fix-file-conflicts-for-mips64-N32.patch \ 105 file://rpm-lib-transaction.c-fix-file-conflicts-for-mips64-N32.patch \
106 " 106"
107 107
108SRC_URI_append_libc-musl = "\
109 file://0001-rpm-Fix-build-on-musl.patch \
110"
108# Uncomment the following line to enable platform score debugging 111# Uncomment the following line to enable platform score debugging
109# This is useful when identifying issues with Smart being unable 112# This is useful when identifying issues with Smart being unable
110# to process certain package feeds. 113# to process certain package feeds.