[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducible coreboot/openwrt/netbsd: display sensible file sizes

Holger Levsen holger at moszumanska.debian.org
Sun Jul 5 23:04:13 UTC 2015


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 4c0c59b1e34d05de3b224a3d18d3a77dd6fc2dda
Author: Holger Levsen <holger at layer-acht.org>
Date:   Mon Jul 6 01:03:50 2015 +0200

    reproducible coreboot/openwrt/netbsd: display sensible file sizes
---
 bin/reproducible_common.sh   | 11 +++++++++++
 bin/reproducible_coreboot.sh |  8 ++++----
 bin/reproducible_netbsd.sh   |  8 ++++----
 bin/reproducible_openwrt.sh  | 13 ++++++-------
 4 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh
index 4b6fc2f..777cd63 100755
--- a/bin/reproducible_common.sh
+++ b/bin/reproducible_common.sh
@@ -411,3 +411,14 @@ call_debbindiff_on_any_file() {
 		echo $msg | tee -a $TMPDIR/$1/$2.html
 	fi
 }
+
+get_filesize() {
+		local BYTESIZE="$(du -h -b $1 | cut -f1)"
+		if [ $BYTESIZE -gt 1048576 ] ; then
+			SIZE="$(echo $BYTESIZE/1048576|bc)M"
+		elif [ $BYTESIZE -gt 1024 ] ; then
+			SIZE="$(echo $BYTESIZE/1024|bc)K"
+		else
+			SIZE="$(echo $BYTESIZE/1024|bc) bytes"
+		fi
+}
diff --git a/bin/reproducible_coreboot.sh b/bin/reproducible_coreboot.sh
index 3085453..c4f97b6 100755
--- a/bin/reproducible_coreboot.sh
+++ b/bin/reproducible_coreboot.sh
@@ -203,20 +203,20 @@ echo "       <ul>" > $ROMS_HTML
 BAD_ROMS=0
 GOOD_ROMS=0
 ALL_ROMS=0
+SIZE=""
 create_results_dirs
 cd $TMPDIR/b1
 for i in $(ls -1d *| sort -u) ; do
 	let ALL_ROMS+=1
 	if [ -f $i/coreboot.rom ] ; then
 		call_debbindiff $i
-		SIZE="$(du -h -b $i/coreboot.rom | cut -f1)"
-		SIZE="$(echo $SIZE/1024|bc)"
+		get_filesize $j
 		if [ -f $TMPDIR/$i.html ] ; then
 			mv $TMPDIR/$i.html $BASE/coreboot/dbd/$i.html
-			echo "         <li><a href=\"dbd/$i.html\"><img src=\"/userContent/static/weather-showers-scattered.png\" alt=\"unreproducible icon\" /> $i</a> (${SIZE}K) is unreproducible.</li>" >> $ROMS_HTML
+			echo "         <li><a href=\"dbd/$i.html\"><img src=\"/userContent/static/weather-showers-scattered.png\" alt=\"unreproducible icon\" /> $i</a> ($SIZE) is unreproducible.</li>" >> $ROMS_HTML
 		else
 			SHASUM=$(sha256sum $i/coreboot.rom|cut -d " " -f1)
-			echo "         <li><img src=\"/userContent/static/weather-clear.png\" alt=\"reproducible icon\" /> $i ($SHASUM, ${SIZE}K) is reproducible.</li>" >> $ROMS_HTML
+			echo "         <li><img src=\"/userContent/static/weather-clear.png\" alt=\"reproducible icon\" /> $i ($SHASUM, $SIZE) is reproducible.</li>" >> $ROMS_HTML
 			let GOOD_ROMS+=1
 			rm -f $BASE/coreboot/dbd/$i.html # cleanup from previous (unreproducible) tests - if needed
 		fi
diff --git a/bin/reproducible_netbsd.sh b/bin/reproducible_netbsd.sh
index 620ea09..5e3b2d3 100755
--- a/bin/reproducible_netbsd.sh
+++ b/bin/reproducible_netbsd.sh
@@ -114,6 +114,7 @@ echo "       <ul>" > $FILES_HTML
 BAD_FILES=0
 GOOD_FILES=0
 ALL_FILES=0
+SIZE=""
 create_results_dirs
 cd $TMPDIR/b1
 tree .
@@ -123,15 +124,14 @@ for i in * ; do
 	for j in $(find * -type f |sort -u ) ; do
 		let ALL_FILES+=1
 		call_debbindiff_on_any_file $i $j
-		SIZE="$(du -h -b $j | cut -f1)"
-		SIZE="$(echo $SIZE/1024|bc)"
+		get_filesize $j
 		if [ -f $TMPDIR/$i/$j.html ] ; then
 			mkdir -p $BASE/netbsd/dbd/$i/$(dirname $j)
 			mv $TMPDIR/$i/$j.html $BASE/netbsd/dbd/$i/$j.html
-			echo "         <tr><td><a href=\"dbd/$i/$j.html\"><img src=\"/userContent/static/weather-showers-scattered.png\" alt=\"unreproducible icon\" /> $j</a> (${SIZE}K) is unreproducible.</td></tr>" >> $FILES_HTML
+			echo "         <tr><td><a href=\"dbd/$i/$j.html\"><img src=\"/userContent/static/weather-showers-scattered.png\" alt=\"unreproducible icon\" /> $j</a> ($SIZE) is unreproducible.</td></tr>" >> $FILES_HTML
 		else
 			SHASUM=$(sha256sum $j|cut -d " " -f1)
-			echo "         <tr><td><img src=\"/userContent/static/weather-clear.png\" alt=\"reproducible icon\" /> $j ($SHASUM, ${SIZE}K) is reproducible.</td></tr>" >> $FILES_HTML
+			echo "         <tr><td><img src=\"/userContent/static/weather-clear.png\" alt=\"reproducible icon\" /> $j ($SHASUM, $SIZE) is reproducible.</td></tr>" >> $FILES_HTML
 			let GOOD_FILES+=1
 			rm -f $BASE/netbsd/dbd/$i/$j.html # cleanup from previous (unreproducible) tests - if needed
 		fi
diff --git a/bin/reproducible_openwrt.sh b/bin/reproducible_openwrt.sh
index cc94284..9c3c5bb 100755
--- a/bin/reproducible_openwrt.sh
+++ b/bin/reproducible_openwrt.sh
@@ -207,6 +207,7 @@ DBD_HTML=$(mktemp --tmpdir=$TMPDIR)
 # run debbindiff on the images
 GOOD_IMAGES=0
 ALL_IMAGES=0
+SIZE=""
 create_results_dirs
 cd $TMPDIR/b1
 tree .
@@ -216,15 +217,14 @@ for i in * ; do
 	for j in $(find * -name "*.bin" -o -name "*.squashfs" |sort -u ) ; do
 		let ALL_IMAGES+=1
 		call_debbindiff_on_any_file $i $j
-		SIZE="$(du -h -b $j | cut -f1)"
-		SIZE="$(echo $SIZE/1024|bc)"
+		get_filesize $j
 		if [ -f $TMPDIR/$i/$j.html ] ; then
 			mkdir -p $BASE/openwrt/dbd/$i
 			mv $TMPDIR/$i/$j.html $BASE/openwrt/dbd/$i/$j.html
 			echo "         <tr><td><a href=\"dbd/$i/$j.html\"><img src=\"/userContent/static/weather-showers-scattered.png\" alt=\"unreproducible icon\" /> $j</a> (${SIZE}K) is unreproducible.</td></tr>" >> $DBD_HTML
 		else
 			SHASUM=$(sha256sum $j|cut -d " " -f1)
-			echo "         <tr><td><img src=\"/userContent/static/weather-clear.png\" alt=\"reproducible icon\" /> $j ($SHASUM, ${SIZE}K) is reproducible.</td></tr>" >> $DBD_HTML
+			echo "         <tr><td><img src=\"/userContent/static/weather-clear.png\" alt=\"reproducible icon\" /> $j ($SHASUM, $SIZE) is reproducible.</td></tr>" >> $DBD_HTML
 			let GOOD_IMAGES+=1
 			rm -f $BASE/openwrt/dbd/$i/$j.html # cleanup from previous (unreproducible) tests - if needed
 		fi
@@ -244,15 +244,14 @@ for i in * ; do
 	for j in $(find * -name "*.ipk" |sort -u ) ; do
 		let ALL_PACKAGES+=1
 		call_debbindiff_on_any_file $i $j
-		SIZE="$(du -h -b $j | cut -f1)"
-		SIZE="$(echo $SIZE/1024|bc)"
+		get_filesize $j
 		if [ -f $TMPDIR/$i/$j.html ] ; then
 			mkdir -p $BASE/openwrt/dbd/$i/$(dirname $j)
 			mv $TMPDIR/$i/$j.html $BASE/openwrt/dbd/$i/$j.html
-			echo "         <tr><td><a href=\"dbd/$i/$j.html\"><img src=\"/userContent/static/weather-showers-scattered.png\" alt=\"unreproducible icon\" /> $j</a> (${SIZE}K) is unreproducible.</td></tr>" >> $DBD_HTML
+			echo "         <tr><td><a href=\"dbd/$i/$j.html\"><img src=\"/userContent/static/weather-showers-scattered.png\" alt=\"unreproducible icon\" /> $j</a> ($SIZE) is unreproducible.</td></tr>" >> $DBD_HTML
 		else
 			SHASUM=$(sha256sum $j|cut -d " " -f1)
-			echo "         <tr><td><img src=\"/userContent/static/weather-clear.png\" alt=\"reproducible icon\" /> $j ($SHASUM, ${SIZE}K) is reproducible.</td></tr>" >> $DBD_HTML
+			echo "         <tr><td><img src=\"/userContent/static/weather-clear.png\" alt=\"reproducible icon\" /> $j ($SHASUM, $SIZE) is reproducible.</td></tr>" >> $DBD_HTML
 			let GOOD_PACKAGES+=1
 			rm -f $BASE/openwrt/dbd/$i/$j.html # cleanup from previous (unreproducible) tests - if needed
 		fi

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list