]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
pigz: Add debug for autobuilder errors
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 27 Jun 2019 11:16:21 +0000 (12:16 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 28 Jun 2019 12:36:52 +0000 (13:36 +0100)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/package.bbclass
meta/recipes-extended/pigz/pigz/debug.patch [new file with mode: 0644]
meta/recipes-extended/pigz/pigz_2.4.bb

index cd223a121e432e098fd922c1be5e7194db860415..70babb3812c2e0570ae5a5ed18463418451d8d33 100644 (file)
@@ -237,7 +237,7 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
     d.setVar('PACKAGES', ' '.join(packages))
     return list(split_packages)
 
-PACKAGE_DEPENDS += "file-native"
+PACKAGE_DEPENDS += "file-native pigz-native"
 
 python () {
     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 (file)
index 0000000..83ab84b
--- /dev/null
@@ -0,0 +1,190 @@
+Index: pigz-2.4/pigz.c
+===================================================================
+--- pigz-2.4.orig/pigz.c
++++ pigz-2.4/pigz.c
+@@ -4293,8 +4293,8 @@ local int option(char *arg) {
+ #ifndef NOTHREAD
+ // handle error received from yarn function
+-local void cut_yarn(int err) {
+-    throw(err, err == ENOMEM ? "not enough memory" : "internal threads error");
++local void cut_yarn(int err, int loc) {
++    throw(err, err == ENOMEM ? "not enough memory (%d, %d)" : "internal threads error (%d, %d)", err, loc);
+ }
+ #endif
+Index: pigz-2.4/yarn.c
+===================================================================
+--- pigz-2.4.orig/yarn.c
++++ pigz-2.4/yarn.c
+@@ -50,14 +50,14 @@
+ /* error handling external globals, resettable by application */
+ char *yarn_prefix = "yarn";
+-void (*yarn_abort)(int) = NULL;
++void (*yarn_abort)(int, int) = NULL;
+ /* immediately exit -- use for errors that shouldn't ever happen */
+-local void fail(int err)
++local void fail(int err, int loc)
+ {
+     if (yarn_abort != NULL)
+-        yarn_abort(err);
++        yarn_abort(err, loc);
+     fprintf(stderr, "%s: %s (%d) -- aborting\n", yarn_prefix,
+             err == ENOMEM ? "out of memory" : "internal pthread error", err);
+     exit(err == ENOMEM || err == EAGAIN ? err : EINVAL);
+@@ -83,7 +83,7 @@ local void *my_malloc(size_t size)
+     void *block;
+     if ((block = my_malloc_f(size)) == NULL)
+-        fail(ENOMEM);
++        fail(ENOMEM, 1);
+     return block;
+ }
+@@ -103,7 +103,7 @@ lock *new_lock(long initial)
+     bolt = my_malloc(sizeof(struct lock_s));
+     if ((ret = pthread_mutex_init(&(bolt->mutex), NULL)) ||
+         (ret = pthread_cond_init(&(bolt->cond), NULL)))
+-        fail(ret);
++        fail(ret, 2);
+     bolt->value = initial;
+     return bolt;
+ }
+@@ -113,7 +113,7 @@ void possess(lock *bolt)
+     int ret;
+     if ((ret = pthread_mutex_lock(&(bolt->mutex))) != 0)
+-        fail(ret);
++        fail(ret, 3);
+ }
+ void release(lock *bolt)
+@@ -121,7 +121,7 @@ void release(lock *bolt)
+     int ret;
+     if ((ret = pthread_mutex_unlock(&(bolt->mutex))) != 0)
+-        fail(ret);
++        fail(ret, 4);
+ }
+ void twist(lock *bolt, enum twist_op op, long val)
+@@ -134,7 +134,7 @@ void twist(lock *bolt, enum twist_op op,
+         bolt->value += val;
+     if ((ret = pthread_cond_broadcast(&(bolt->cond))) ||
+         (ret = pthread_mutex_unlock(&(bolt->mutex))))
+-        fail(ret);
++        fail(ret, 5);
+ }
+ #define until(a) while(!(a))
+@@ -147,22 +147,22 @@ void wait_for(lock *bolt, enum wait_op o
+     case TO_BE:
+         until (bolt->value == val)
+             if ((ret = pthread_cond_wait(&(bolt->cond), &(bolt->mutex))) != 0)
+-                fail(ret);
++                fail(ret, 6);
+         break;
+     case NOT_TO_BE:
+         until (bolt->value != val)
+             if ((ret = pthread_cond_wait(&(bolt->cond), &(bolt->mutex))) != 0)
+-                fail(ret);
++                fail(ret, 7);
+         break;
+     case TO_BE_MORE_THAN:
+         until (bolt->value > val)
+             if ((ret = pthread_cond_wait(&(bolt->cond), &(bolt->mutex))) != 0)
+-                fail(ret);
++                fail(ret, 8);
+         break;
+     case TO_BE_LESS_THAN:
+         until (bolt->value < val)
+             if ((ret = pthread_cond_wait(&(bolt->cond), &(bolt->mutex))) != 0)
+-                fail(ret);
++                fail(ret, 9);
+     }
+ }
+@@ -179,7 +179,7 @@ void free_lock(lock *bolt)
+         return;
+     if ((ret = pthread_cond_destroy(&(bolt->cond))) ||
+         (ret = pthread_mutex_destroy(&(bolt->mutex))))
+-        fail(ret);
++        fail(ret, 10);
+     my_free(bolt);
+ }
+@@ -224,7 +224,7 @@ local void reenter(void *dummy)
+         prior = &(match->next);
+     }
+     if (match == NULL)
+-        fail(EINVAL);
++        fail(EINVAL, 11);
+     /* mark this thread as done and move it to the head of the list */
+     match->done = 1;
+@@ -287,7 +287,7 @@ thread *launch(void (*probe)(void *), vo
+         (ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE)) ||
+         (ret = pthread_create(&(th->id), &attr, ignition, capsule)) ||
+         (ret = pthread_attr_destroy(&attr)))
+-        fail(ret);
++        fail(ret, 12);
+     /* put the thread in the threads list for join_all() */
+     th->done = 0;
+@@ -304,7 +304,7 @@ void join(thread *ally)
+     /* wait for thread to exit and return its resources */
+     if ((ret = pthread_join(ally->id, NULL)) != 0)
+-        fail(ret);
++        fail(ret, 13);
+     /* find the thread in the threads list */
+     possess(&(threads_lock));
+@@ -315,7 +315,7 @@ void join(thread *ally)
+         prior = &(match->next);
+     }
+     if (match == NULL)
+-        fail(EINVAL);
++        fail(EINVAL, 14);
+     /* remove thread from list and update exited count, free thread */
+     if (match->done)
+@@ -351,12 +351,12 @@ int join_all(void)
+             prior = &(match->next);
+         }
+         if (match == NULL)
+-            fail(EINVAL);
++            fail(EINVAL, 15);
+         /* join the thread (will be almost immediate), remove from the threads
+            list, update the reenter count, and free the thread */
+         if ((ret = pthread_join(match->id, NULL)) != 0)
+-            fail(ret);
++            fail(ret, 16);
+         threads_lock.value--;
+         *prior = match->next;
+         my_free(match);
+@@ -375,6 +375,6 @@ void destruct(thread *off_course)
+     int ret;
+     if ((ret = pthread_cancel(off_course->id)) != 0)
+-        fail(ret);
++        fail(ret, 17);
+     join(off_course);
+ }
+Index: pigz-2.4/yarn.h
+===================================================================
+--- pigz-2.4.orig/yarn.h
++++ pigz-2.4/yarn.h
+@@ -110,7 +110,7 @@
+  */
+ extern char *yarn_prefix;
+-extern void (*yarn_abort)(int);
++extern void (*yarn_abort)(int, int);
+ void yarn_mem(void *(*)(size_t), void (*)(void *));
index 8c65ec34f065a70b8e6c420bfffae2657fe40823..7bb5b64c6b760afc93c0191a43409bb005fd4998 100644 (file)
@@ -8,7 +8,7 @@ SECTION = "console/utils"
 LICENSE = "Zlib & Apache-2.0"
 LIC_FILES_CHKSUM = "file://pigz.c;md5=9ae6dee8ceba9610596ed0ada493d142;beginline=7;endline=21"
 
-SRC_URI = "http://zlib.net/${BPN}/fossils/${BP}.tar.gz"
+SRC_URI = "http://zlib.net/${BPN}/fossils/${BP}.tar.gz file://debug.patch"
 SRC_URI[md5sum] = "def2f6e19d9d8231445adc1349d346df"
 SRC_URI[sha256sum] = "a4f816222a7b4269bd232680590b579ccc72591f1bb5adafcd7208ca77e14f73"
 PROVIDES_class-native += "gzip-native"