summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-27 12:16:21 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-30 22:40:52 +0100
commit267b2f26e59b313b1999bccfe4f259d11005f8a8 (patch)
tree8ecd4284313c5fecd09a91519b227db7d1350d8c
parentdcce395782ae9adf9554892f1e5cba01f15320b1 (diff)
downloadpoky-267b2f26e59b313b1999bccfe4f259d11005f8a8.tar.gz
pigz: Add debug for autobuilder errors
(From OE-Core rev: b08976456c8ab7f29efd83644ce42746c0d6501b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/package.bbclass2
-rw-r--r--meta/recipes-extended/pigz/pigz/debug.patch190
-rw-r--r--meta/recipes-extended/pigz/pigz_2.4.bb2
3 files changed, 192 insertions, 2 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index cd223a121e..70babb3812 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -237,7 +237,7 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
237 d.setVar('PACKAGES', ' '.join(packages)) 237 d.setVar('PACKAGES', ' '.join(packages))
238 return list(split_packages) 238 return list(split_packages)
239 239
240PACKAGE_DEPENDS += "file-native" 240PACKAGE_DEPENDS += "file-native pigz-native"
241 241
242python () { 242python () {
243 if d.getVar('PACKAGES') != '': 243 if d.getVar('PACKAGES') != '':
diff --git a/meta/recipes-extended/pigz/pigz/debug.patch b/meta/recipes-extended/pigz/pigz/debug.patch
new file mode 100644
index 0000000000..83ab84bab0
--- /dev/null
+++ b/meta/recipes-extended/pigz/pigz/debug.patch
@@ -0,0 +1,190 @@
1Index: pigz-2.4/pigz.c
2===================================================================
3--- pigz-2.4.orig/pigz.c
4+++ pigz-2.4/pigz.c
5@@ -4293,8 +4293,8 @@ local int option(char *arg) {
6
7 #ifndef NOTHREAD
8 // handle error received from yarn function
9-local void cut_yarn(int err) {
10- throw(err, err == ENOMEM ? "not enough memory" : "internal threads error");
11+local void cut_yarn(int err, int loc) {
12+ throw(err, err == ENOMEM ? "not enough memory (%d, %d)" : "internal threads error (%d, %d)", err, loc);
13 }
14 #endif
15
16Index: pigz-2.4/yarn.c
17===================================================================
18--- pigz-2.4.orig/yarn.c
19+++ pigz-2.4/yarn.c
20@@ -50,14 +50,14 @@
21
22 /* error handling external globals, resettable by application */
23 char *yarn_prefix = "yarn";
24-void (*yarn_abort)(int) = NULL;
25+void (*yarn_abort)(int, int) = NULL;
26
27
28 /* immediately exit -- use for errors that shouldn't ever happen */
29-local void fail(int err)
30+local void fail(int err, int loc)
31 {
32 if (yarn_abort != NULL)
33- yarn_abort(err);
34+ yarn_abort(err, loc);
35 fprintf(stderr, "%s: %s (%d) -- aborting\n", yarn_prefix,
36 err == ENOMEM ? "out of memory" : "internal pthread error", err);
37 exit(err == ENOMEM || err == EAGAIN ? err : EINVAL);
38@@ -83,7 +83,7 @@ local void *my_malloc(size_t size)
39 void *block;
40
41 if ((block = my_malloc_f(size)) == NULL)
42- fail(ENOMEM);
43+ fail(ENOMEM, 1);
44 return block;
45 }
46
47@@ -103,7 +103,7 @@ lock *new_lock(long initial)
48 bolt = my_malloc(sizeof(struct lock_s));
49 if ((ret = pthread_mutex_init(&(bolt->mutex), NULL)) ||
50 (ret = pthread_cond_init(&(bolt->cond), NULL)))
51- fail(ret);
52+ fail(ret, 2);
53 bolt->value = initial;
54 return bolt;
55 }
56@@ -113,7 +113,7 @@ void possess(lock *bolt)
57 int ret;
58
59 if ((ret = pthread_mutex_lock(&(bolt->mutex))) != 0)
60- fail(ret);
61+ fail(ret, 3);
62 }
63
64 void release(lock *bolt)
65@@ -121,7 +121,7 @@ void release(lock *bolt)
66 int ret;
67
68 if ((ret = pthread_mutex_unlock(&(bolt->mutex))) != 0)
69- fail(ret);
70+ fail(ret, 4);
71 }
72
73 void twist(lock *bolt, enum twist_op op, long val)
74@@ -134,7 +134,7 @@ void twist(lock *bolt, enum twist_op op,
75 bolt->value += val;
76 if ((ret = pthread_cond_broadcast(&(bolt->cond))) ||
77 (ret = pthread_mutex_unlock(&(bolt->mutex))))
78- fail(ret);
79+ fail(ret, 5);
80 }
81
82 #define until(a) while(!(a))
83@@ -147,22 +147,22 @@ void wait_for(lock *bolt, enum wait_op o
84 case TO_BE:
85 until (bolt->value == val)
86 if ((ret = pthread_cond_wait(&(bolt->cond), &(bolt->mutex))) != 0)
87- fail(ret);
88+ fail(ret, 6);
89 break;
90 case NOT_TO_BE:
91 until (bolt->value != val)
92 if ((ret = pthread_cond_wait(&(bolt->cond), &(bolt->mutex))) != 0)
93- fail(ret);
94+ fail(ret, 7);
95 break;
96 case TO_BE_MORE_THAN:
97 until (bolt->value > val)
98 if ((ret = pthread_cond_wait(&(bolt->cond), &(bolt->mutex))) != 0)
99- fail(ret);
100+ fail(ret, 8);
101 break;
102 case TO_BE_LESS_THAN:
103 until (bolt->value < val)
104 if ((ret = pthread_cond_wait(&(bolt->cond), &(bolt->mutex))) != 0)
105- fail(ret);
106+ fail(ret, 9);
107 }
108 }
109
110@@ -179,7 +179,7 @@ void free_lock(lock *bolt)
111 return;
112 if ((ret = pthread_cond_destroy(&(bolt->cond))) ||
113 (ret = pthread_mutex_destroy(&(bolt->mutex))))
114- fail(ret);
115+ fail(ret, 10);
116 my_free(bolt);
117 }
118
119@@ -224,7 +224,7 @@ local void reenter(void *dummy)
120 prior = &(match->next);
121 }
122 if (match == NULL)
123- fail(EINVAL);
124+ fail(EINVAL, 11);
125
126 /* mark this thread as done and move it to the head of the list */
127 match->done = 1;
128@@ -287,7 +287,7 @@ thread *launch(void (*probe)(void *), vo
129 (ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE)) ||
130 (ret = pthread_create(&(th->id), &attr, ignition, capsule)) ||
131 (ret = pthread_attr_destroy(&attr)))
132- fail(ret);
133+ fail(ret, 12);
134
135 /* put the thread in the threads list for join_all() */
136 th->done = 0;
137@@ -304,7 +304,7 @@ void join(thread *ally)
138
139 /* wait for thread to exit and return its resources */
140 if ((ret = pthread_join(ally->id, NULL)) != 0)
141- fail(ret);
142+ fail(ret, 13);
143
144 /* find the thread in the threads list */
145 possess(&(threads_lock));
146@@ -315,7 +315,7 @@ void join(thread *ally)
147 prior = &(match->next);
148 }
149 if (match == NULL)
150- fail(EINVAL);
151+ fail(EINVAL, 14);
152
153 /* remove thread from list and update exited count, free thread */
154 if (match->done)
155@@ -351,12 +351,12 @@ int join_all(void)
156 prior = &(match->next);
157 }
158 if (match == NULL)
159- fail(EINVAL);
160+ fail(EINVAL, 15);
161
162 /* join the thread (will be almost immediate), remove from the threads
163 list, update the reenter count, and free the thread */
164 if ((ret = pthread_join(match->id, NULL)) != 0)
165- fail(ret);
166+ fail(ret, 16);
167 threads_lock.value--;
168 *prior = match->next;
169 my_free(match);
170@@ -375,6 +375,6 @@ void destruct(thread *off_course)
171 int ret;
172
173 if ((ret = pthread_cancel(off_course->id)) != 0)
174- fail(ret);
175+ fail(ret, 17);
176 join(off_course);
177 }
178Index: pigz-2.4/yarn.h
179===================================================================
180--- pigz-2.4.orig/yarn.h
181+++ pigz-2.4/yarn.h
182@@ -110,7 +110,7 @@
183 */
184
185 extern char *yarn_prefix;
186-extern void (*yarn_abort)(int);
187+extern void (*yarn_abort)(int, int);
188
189 void yarn_mem(void *(*)(size_t), void (*)(void *));
190
diff --git a/meta/recipes-extended/pigz/pigz_2.4.bb b/meta/recipes-extended/pigz/pigz_2.4.bb
index 8c65ec34f0..7bb5b64c6b 100644
--- a/meta/recipes-extended/pigz/pigz_2.4.bb
+++ b/meta/recipes-extended/pigz/pigz_2.4.bb
@@ -8,7 +8,7 @@ SECTION = "console/utils"
8LICENSE = "Zlib & Apache-2.0" 8LICENSE = "Zlib & Apache-2.0"
9LIC_FILES_CHKSUM = "file://pigz.c;md5=9ae6dee8ceba9610596ed0ada493d142;beginline=7;endline=21" 9LIC_FILES_CHKSUM = "file://pigz.c;md5=9ae6dee8ceba9610596ed0ada493d142;beginline=7;endline=21"
10 10
11SRC_URI = "http://zlib.net/${BPN}/fossils/${BP}.tar.gz" 11SRC_URI = "http://zlib.net/${BPN}/fossils/${BP}.tar.gz file://debug.patch"
12SRC_URI[md5sum] = "def2f6e19d9d8231445adc1349d346df" 12SRC_URI[md5sum] = "def2f6e19d9d8231445adc1349d346df"
13SRC_URI[sha256sum] = "a4f816222a7b4269bd232680590b579ccc72591f1bb5adafcd7208ca77e14f73" 13SRC_URI[sha256sum] = "a4f816222a7b4269bd232680590b579ccc72591f1bb5adafcd7208ca77e14f73"
14PROVIDES_class-native += "gzip-native" 14PROVIDES_class-native += "gzip-native"