[oe-commits] Otavio Salvador : buildhistory.bbclass: Improve robustness in image file listing

git at git.openembedded.org git at git.openembedded.org
Sun Feb 2 11:26:01 UTC 2014


Module: openembedded-core.git
Branch: master-next
Commit: b09e24449c1c9ae335732dd070eacf66777556a1
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=b09e24449c1c9ae335732dd070eacf66777556a1

Author: Otavio Salvador <otavio at ossystems.com.br>
Date:   Thu Jan 23 10:11:05 2014 -0200

buildhistory.bbclass: Improve robustness in image file listing

The filenames sometimes may have strange names. With the 'awk' script
it handled a limited number of spaces in the filename and a package
installing a file named "test file with spaces" would have its name
truncated.

This patch uses the find's printf formating to simplify the code and
properly handle this case. From a testing image, the only diff produced
is:

,----[ files-in-image.txt diff ]
| --rwxr-xr-x root       root                0 ./usr/bin/test\ file\ with\
| +-rwxr-xr-x root       root                0 ./usr/bin/test file with spaces
`----

The options used are available since findutils 4.2.5, released in 19
Nov 2004, making it available in all supported host distributions.

Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/classes/buildhistory.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index e9a9c3b..545a42f 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -385,7 +385,7 @@ buildhistory_get_sdk_installed() {
 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
-	( cd $1 && find . -ls | awk '{ if ( $7 ~ /[0-9]/ ) printf "%s %10-s %10-s %10s %s %s %s\n", $3, $5, $6, $7, $11, $12, $13 ; else printf "%s %10-s %10-s %10s %s %s %s\n", $3, $5, $6, 0, $10, $11, $12 }' | sort -k5 | sed 's/ *$//' > $2 )
+	( cd $1 && find . -printf "%M %-10u %-10g %10s %p -> %l\n" | sort -k5 | sed 's/ * -> $//' > $2 )
 }
 
 



More information about the Openembedded-commits mailing list