[tor-commits] [orbot/master] add script to compare APKs for the reproducible process

n8fr8 at torproject.org n8fr8 at torproject.org
Thu Jun 25 14:59:58 UTC 2015


commit 2372b186c6d5dbeff78d3341824c0fa44b424ba1
Author: Hans-Christoph Steiner <hans at eds.org>
Date:   Thu Jun 4 17:58:53 2015 -0400

    add script to compare APKs for the reproducible process
---
 compare-to-official-release |   62 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/compare-to-official-release b/compare-to-official-release
new file mode 100755
index 0000000..8e3a300
--- /dev/null
+++ b/compare-to-official-release
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+if [ $# -ne 2 ]; then
+    echo "Usage: $0 /path/to/Orbot-v15.0.1.apk /another/Orbot-v15.0.1.apk"
+    exit 1
+fi
+
+set -e
+set -x
+
+test -e "$1"
+test -e "$2"
+
+tmpdir=`mktemp -d /tmp/.compare-apks.XXXXXXXXXX`
+apk1=$(basename $1)
+apk2=$(basename $2)
+sourcedir1=$(cd `dirname $1` && pwd)
+sourcedir2=$(cd `dirname $2` && pwd)
+apkname1=`echo $apk1 | sed 's,\.apk$,,'`
+apkname2=`echo $apk2 | sed 's,\.apk$,,'`
+dir1=$tmpdir/`echo $(dirname $1) | sed 's,[/ ],_,g'`-$apkname1
+dir2=$tmpdir/`echo $(dirname $2) | sed 's,[/ ],_,g'`-$apkname2
+
+mkdir -p $dir1/zip
+cd $dir1/zip
+unzip "$sourcedir1/$apk1"
+cd ..
+apktool d --no-res --no-src "$sourcedir1/$apk1"
+mv "$apkname1" apktool
+# strip the full path to the zip for the comparison
+unzip -l "$sourcedir1/$apk1" | sed 's,^\(Archive:\s\s*\)/.*/,\1,' > $dir1/unzip-l.txt
+unzip -lv "$sourcedir1/$apk1" | sed 's,^\(Archive:\s\s*\)/.*/,\1,' > $dir1/unzip-lv.txt
+zipinfo -lv "$sourcedir1/$apk1" | sed 's,^\(Archive:\s\s*\)/.*/,\1,' > $dir1/zipinfo-lv.txt
+xxd "$sourcedir1/$apk1" > $dir1/xxd
+for f in $dir1/zip/assets/*/*; do
+    xxd $f > $dir1/xxd-$(basename $f)
+done
+
+mkdir -p $dir2/zip
+cd $dir2/zip
+unzip "$sourcedir2/$apk2"
+cd ..
+apktool d --no-res --no-src "$sourcedir2/$apk2"
+mv "$apkname2" apktool
+# strip the full path to the zip for the comparison
+unzip -l "$sourcedir2/$apk2" | sed 's,^\(Archive:\s\s*\)/.*/,\1,' > $dir2/unzip-l.txt
+unzip -lv "$sourcedir2/$apk2" | sed 's,^\(Archive:\s\s*\)/.*/,\1,' > $dir2/unzip-lv.txt
+zipinfo -lv "$sourcedir2/$apk2" | sed 's,^\(Archive:\s\s*\)/.*/,\1,' > $dir2/zipinfo-lv.txt
+xxd "$sourcedir2/$apk2" > $dir2/xxd
+for f in $dir2/zip/assets/*/*; do
+    xxd $f > $dir2/xxd-$(basename $f)
+done
+
+if which meld > /dev/null; then
+    meld $dir1 $dir2
+elif which opendiff > /dev/null; then
+    opendiff $dir1 $dir2
+else
+    echo "ERROR: meld or opendiff required for the comparison!"
+fi
+
+rm -rf $dir1 $dir2





More information about the tor-commits mailing list