tools/update-packaging/test/diffmar.sh

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/update-packaging/test/diffmar.sh	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +#!/bin/bash
     1.5 +# Compares two mars
     1.6 +
     1.7 +marA="$1"
     1.8 +marB="$2"
     1.9 +testDir="$3"
    1.10 +workdir="/tmp/diffmar/$testDir"
    1.11 +fromdir="$workdir/0"
    1.12 +todir="$workdir/1"
    1.13 +
    1.14 +# On Windows, creation time can be off by a second or more between the files in
    1.15 +# the fromdir and todir due to them being extracted synchronously so use
    1.16 +# time-style and exclude seconds from the creation time.
    1.17 +lsargs="-algR"
    1.18 +unamestr=`uname`
    1.19 +if [ ! "$unamestr" = 'Darwin' ]; then
    1.20 +  unamestr=`uname -o`
    1.21 +  if [ "$unamestr" = 'Msys' -o "$unamestr" = "Cygwin" ]; then
    1.22 +     lsargs="-algR --time-style=+%Y-%m-%d-%H:%M"
    1.23 +  fi
    1.24 +fi
    1.25 +
    1.26 +rm -rf "$workdir"
    1.27 +mkdir -p "$fromdir"
    1.28 +mkdir -p "$todir"
    1.29 +
    1.30 +cp "$1" "$fromdir"
    1.31 +cp "$2" "$todir"
    1.32 +
    1.33 +cd "$fromdir"
    1.34 +mar -x "$1"
    1.35 +rm "$1"
    1.36 +mv updatev2.manifest updatev2.manifest.bz2
    1.37 +bzip2 -d updatev2.manifest.bz2
    1.38 +mv updatev3.manifest updatev3.manifest.bz2
    1.39 +bzip2 -d updatev3.manifest.bz2
    1.40 +ls $lsargs > files.txt
    1.41 +
    1.42 +cd "$todir"
    1.43 +mar -x "$2"
    1.44 +rm "$2"
    1.45 +mv updatev2.manifest updatev2.manifest.bz2
    1.46 +bzip2 -d updatev2.manifest.bz2
    1.47 +mv updatev3.manifest updatev3.manifest.bz2
    1.48 +bzip2 -d updatev3.manifest.bz2
    1.49 +ls $lsargs > files.txt
    1.50 +
    1.51 +echo "diffing $fromdir and $todir"
    1.52 +echo "on linux shell sort and python sort return different results"
    1.53 +echo "which can cause differences in the manifest files"
    1.54 +diff -ru "$fromdir" "$todir"

mercurial