Skip to contentSkip to conversation

buildhistory.bbclass: Break up the find to catch failures

RFC PATCH In review Mark Hatle 2 participants 2 messages Feb 9, 2016 – Feb 10, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Mark Hatle

author
#1 lore raw

RFC PATCH 1/1 buildhistory.bbclass: Break up the find to catch failures

If for some reason the 'find' operation were to fail, the buildhistory would not fail, but instead store invalid history!

[YOCTO #9031]

Note this fixes the symptom, but not the cause of 9031. That is a separate issue, see the defect for more details on the work being done to resolve the cause of the failure.

---
 meta/classes/buildhistory.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
meta/classes/buildhistory.bbclass +4 -2
index 5e2581f..189881e 100644
@@ -439,10 +439,12 @@ buildhistory_list_files() {
 	# List the files in the specified directory, but exclude date/time etc.
 	# This awk script is somewhat messy, but handles where the size is not printed for device files under pseudo
 	if [ "$3" = "fakeroot" ] ; then
-		( cd $1 && ${FAKEROOTENV} ${FAKEROOTCMD} find . ! -path . -printf "%M %-10u %-10g %10s %p -> %l\n" | sort -k5 | sed 's/ * -> $//' > $2 )
+		( cd $1 && ${FAKEROOTENV} ${FAKEROOTCMD} find . ! -path . -printf "%M %-10u %-10g %10s %p -> %l\n" > $2.tmp )
 	else
-		( cd $1 && find . ! -path . -printf "%M %-10u %-10g %10s %p -> %l\n" | sort -k5 | sed 's/ * -> $//' > $2 )
+		( cd $1 && find . ! -path . -printf "%M %-10u %-10g %10s %p -> %l\n" > $2.tmp )
 	fi
+	cat $2.tmp | sort -k5 | sed 's/ * -> $//' > $2
+	rm $2.tmp
 }
 
 buildhistory_list_pkg_files() {
Signature · 1 line
2.5.0
Acked-by on v1 1/1
#2 lore raw
Quoted 23 lines · On Tue, 09 Feb 2016 09:34:41 Mark Hatle wrote:

If for some reason the 'find' operation were to fail, the buildhistory would not fail, but instead store invalid history!

[YOCTO #9031]

Note this fixes the symptom, but not the cause of 9031. That is a separate issue, see the defect for more details on the work being done to resolve the cause of the failure.

---
 meta/classes/buildhistory.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/meta/classes/buildhistory.bbclass index 5e2581f..189881e 100644

meta/classes/buildhistory.bbclass +0 -0
@@ -439,10 +439,12 @@ buildhistory_list_files() {
 	# List the files in the specified directory, but exclude date/time etc.
 	# This awk script is somewhat messy, but handles where the size is not

printed for device files under pseudo if [ "$3" = "fakeroot" ] ; then

meta/classes/buildhistory.bbclass +0 -1
-		( cd $1 && ${FAKEROOTENV} ${FAKEROOTCMD} find . ! -path . -printf "%M
Quoted 1 line

%-10u %-10g %10s %p -> %l\n" | sort -k5 | sed 's/ * -> $//' > $2 ) + (

cd

meta/classes/buildhistory.bbclass

Quoted 3 lines

$1 && ${FAKEROOTENV} ${FAKEROOTCMD} find . ! -path . -printf "%M %-10u %-10g %10s %p -> %l\n" > $2.tmp ) else

meta/classes/buildhistory.bbclass +0 -1
-		( cd $1 && find . ! -path . -printf "%M %-10u %-10g %10s %p -> %l\n" 

|

Quoted 1 line

sort -k5 | sed 's/ * -> $//' > $2 ) + ( cd $1 && find . ! -path . -

printf

meta/classes/buildhistory.bbclass buildhistory_list_files() { · line 450

Quoted 6 lines

"%M %-10u %-10g %10s %p -> %l\n" > $2.tmp ) fi

meta/classes/buildhistory.bbclass +2 -0
+	cat $2.tmp | sort -k5 | sed 's/ * -> $//' > $2
+	rm $2.tmp
 }
 
 buildhistory_list_pkg_files() {

Would that such contortions weren't necessary, but silently getting bad data is worse.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre