Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "André Draszik" <git@andred.net>
To: openembedded-core@lists.openembedded.org
Subject: [DONT-MERGE] sstate: add hack to detect sstate archive compression failures
Date: Mon, 12 Nov 2018 12:56:53 +0000	[thread overview]
Message-ID: <20181112125653.21157-2-git@andred.net> (raw)
In-Reply-To: <20181112125653.21157-1-git@andred.net>

From: André Draszik <andre.draszik@jci.com>

Signed-off-by: André Draszik <andre.draszik@jci.com>
---
 meta/classes/sstate.bbclass | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index efb0096c70..b0ba07cacb 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -731,6 +731,8 @@ sstate_create_package () {
 
 	# Need to handle empty directories
 	if [ "$(ls -A)" ]; then
+	    ctr=0
+	    while [ $ctr -lt 2 ] ; do
 		set +e
 		tar $OPT -f $TFILE *
 		ret=$?
@@ -738,6 +740,33 @@ sstate_create_package () {
 			exit 1
 		fi
 		set -e
+
+		TDIR=`mktemp -d ${SSTATE_PKG}.extracted.XXXXXXXX`
+		tar -C $TDIR -xzf $TFILE
+		export TFILE
+		find $TDIR -type f -exec sh -ceu '
+			for c in "$@" ; do
+				if stat "$c" | grep -v "Size: 0" | grep -q "Blocks: 0" ; then
+					echo File $c in archive $TFILE is broken
+					echo "$TFILE -> $c" >> "$TFILE.broken"
+				fi
+			done
+		' _ '{}' +
+		rm -rf $TDIR
+		if [ ! -s "$TFILE.broken" ] ; then
+			if [ $ctr -ne 0 ] ; then
+				bbwarn "$TFILE created successfully on attempt # $ctr"
+			fi
+			break
+		fi
+		bbwarn "$TFILE is broken, retrying"
+		bbwarn "`cat $TFILE.broken`"
+		rm $TFILE.broken
+		ctr=$(expr $ctr + 1)
+	    done
+	    if [ $ctr -ge 2 ] ; then
+		bbfatal "Could not compress sstate"
+	    fi
 	else
 		tar $OPT --file=$TFILE --files-from=/dev/null
 	fi
-- 
2.19.1



  reply	other threads:[~2018-11-12 12:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-30 15:45 broken sstate archives André Draszik
2018-10-30 16:49 ` Richard Purdie
2018-11-01 12:22   ` André Draszik
2018-11-01 13:07     ` richard.purdie
2018-11-12 12:56 ` André Draszik
2018-11-12 12:56   ` André Draszik [this message]
2018-11-12 14:07   ` richard.purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181112125653.21157-2-git@andred.net \
    --to=git@andred.net \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox