diff options
-rwxr-xr-x | bin/reproducible_common.sh | 11 | ||||
-rwxr-xr-x | bin/reproducible_coreboot.sh | 8 | ||||
-rwxr-xr-x | bin/reproducible_netbsd.sh | 8 | ||||
-rwxr-xr-x | 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 4b6fc2f0..777cd63f 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 3085453a..c4f97b6f 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 620ea099..5e3b2d39 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 cc94284c..9c3c5bb5 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 |