tools/update-packaging/test/diffmar.sh

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rwxr-xr-x

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 #!/bin/bash
michael@0 2 # Compares two mars
michael@0 3
michael@0 4 marA="$1"
michael@0 5 marB="$2"
michael@0 6 testDir="$3"
michael@0 7 workdir="/tmp/diffmar/$testDir"
michael@0 8 fromdir="$workdir/0"
michael@0 9 todir="$workdir/1"
michael@0 10
michael@0 11 # On Windows, creation time can be off by a second or more between the files in
michael@0 12 # the fromdir and todir due to them being extracted synchronously so use
michael@0 13 # time-style and exclude seconds from the creation time.
michael@0 14 lsargs="-algR"
michael@0 15 unamestr=`uname`
michael@0 16 if [ ! "$unamestr" = 'Darwin' ]; then
michael@0 17 unamestr=`uname -o`
michael@0 18 if [ "$unamestr" = 'Msys' -o "$unamestr" = "Cygwin" ]; then
michael@0 19 lsargs="-algR --time-style=+%Y-%m-%d-%H:%M"
michael@0 20 fi
michael@0 21 fi
michael@0 22
michael@0 23 rm -rf "$workdir"
michael@0 24 mkdir -p "$fromdir"
michael@0 25 mkdir -p "$todir"
michael@0 26
michael@0 27 cp "$1" "$fromdir"
michael@0 28 cp "$2" "$todir"
michael@0 29
michael@0 30 cd "$fromdir"
michael@0 31 mar -x "$1"
michael@0 32 rm "$1"
michael@0 33 mv updatev2.manifest updatev2.manifest.bz2
michael@0 34 bzip2 -d updatev2.manifest.bz2
michael@0 35 mv updatev3.manifest updatev3.manifest.bz2
michael@0 36 bzip2 -d updatev3.manifest.bz2
michael@0 37 ls $lsargs > files.txt
michael@0 38
michael@0 39 cd "$todir"
michael@0 40 mar -x "$2"
michael@0 41 rm "$2"
michael@0 42 mv updatev2.manifest updatev2.manifest.bz2
michael@0 43 bzip2 -d updatev2.manifest.bz2
michael@0 44 mv updatev3.manifest updatev3.manifest.bz2
michael@0 45 bzip2 -d updatev3.manifest.bz2
michael@0 46 ls $lsargs > files.txt
michael@0 47
michael@0 48 echo "diffing $fromdir and $todir"
michael@0 49 echo "on linux shell sort and python sort return different results"
michael@0 50 echo "which can cause differences in the manifest files"
michael@0 51 diff -ru "$fromdir" "$todir"

mercurial