Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add script to compare git repository and tardist.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 30 Jan 2013 15:52:17 +0000 (16:52 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 30 Jan 2013 16:06:44 +0000 (17:06 +0100)
tools/check_dist_archive [new file with mode: 0755]
tools/check_dist_archive.exclude [new file with mode: 0644]

diff --git a/tools/check_dist_archive b/tools/check_dist_archive
new file mode 100755 (executable)
index 0000000..22c717b
--- /dev/null
@@ -0,0 +1,100 @@
+#!/bin/bash
+
+set -e
+
+if [ "$1" = "-batch" ]; then
+    shift
+    interactive=0
+elif [ -t 1 ]; then
+    interactive=1
+else
+    interactive=0
+fi
+
+if [ $# -lt 1 -o $# -gt 3 ]; then
+    cat <<EOF
+Usage: $0 [-batch] archive.tar.gz [git_url [git_branch]]
+EOF
+    exit 1
+fi
+
+archive=$1
+if [ ! -r "$archive" ]; then
+    printf 'File not found: %s\n' "$archive"
+    exit 1
+fi
+
+if [ $# -ge 2 ]; then
+    giturl=$2
+    gitbranch=${3:-master}
+else
+    giturl=$(git rev-parse --show-toplevel)
+    gitbranch=$(git branch | sed -n '/^\*/{s/^..//;p;}')
+fi
+
+tmpdir=$(mktemp -d)
+trap "rm -fr \"$tmpdir\"" EXIT
+
+arch_dir="$tmpdir/a"
+git_dir="$tmpdir/b"
+
+myname=$(type -p "$0")
+case "$myname" in
+    /*)
+        exclude="$myname.exclude"
+        ;;
+    *)
+        exclude="$PWD/$myname.exclude"
+        ;;
+esac
+
+if [ ! -r "$exclude" ]; then
+    printf 'File not found: %s\n' "$exclude"
+    exit 1
+fi
+
+echo "Exclude patterns extracted from file: $exclude"
+
+echo "Extracting archive: $archive -> $arch_dir"
+tar --directory "$tmpdir" \
+    --transform 's!^[^/]*!a!' \
+    --extract --gunzip --file "$archive"
+
+echo "Copying git repository: $giturl/$gitbranch -> $git_dir"
+git archive --format=tar --prefix="b/" --remote="$giturl" "$gitbranch" \
+    | tar --directory "$tmpdir" --extract --file -
+
+fa=from_tgz
+fb=from_git
+cd "$tmpdir"
+
+sed -n '/^-/{s/^- //;p;}' "$exclude" > ea
+sed -n '/^+/{s/^+ //;p;}' "$exclude" > eb
+
+find a -type f \
+    | sed 's!^a/!!' \
+    | grep -E -v -x -f ea \
+    | sort > "$fa"
+find b -type f \
+    | sed 's!^b/!!' \
+    | grep -E -v -x -f eb \
+    | sort > "$fb"
+
+diffcmd() {
+    diff -u "$fa" "$fb"
+}
+
+colordiff=$(type -p colordiff)
+colorless() {
+    if [ -n "$colordiff" ]; then
+        "$colordiff" | less -R -F
+    else
+        less -F
+    fi
+}
+
+if [ "$interactive" = "1" ]; then
+    diffcmd | colorless
+else
+    diffcmd
+fi
diff --git a/tools/check_dist_archive.exclude b/tools/check_dist_archive.exclude
new file mode 100644 (file)
index 0000000..8339ce8
--- /dev/null
@@ -0,0 +1,77 @@
+# Expected dfferences between git repository and tardists
+#
+# lines beginning with '#', and empty lines are ignored
+# lines beginning with '- ' are expected in archive only
+# lines beginning with '+ ' are expected in git only
+# each line is an extended regexp that should match full file names
+
+- Makefile
+- doc/html/.*
+
++ \.gitignore
++ README\.(coding|git)
++ mk_win-dist.sh
+
++ buildtools/(jenkins|pipol)/.*
+
++ contrib/.*
+
++ examples/msg/actions/NAS_LU_S_4/.*
++ examples/msg/chainsend/generate_deployment_file\.rb
++ examples/msg/chord/chord3\.xml
+
++ examples/smpi/MM/command_exemple
++ examples/smpi/MM/host
++ examples/smpi/NAS/.*
+
++ src/simix/README_attempt_without_stack
++ src/simix/simix_network\.tla
+
++ src/smpi/BUGS
++ src/smpi/fixsrc\.pl
++ src/smpi/myprintloc\.cocci
++ src/smpi/patch_source\.sh
++ src/smpi/replace_globals\.cocci
++ src/smpi/replace_static\.cocci
+
++ teshsuite/smpi/mpich-test/coll/bcast2\.f
++ teshsuite/smpi/mpich-test/coll/nbcoll\.c
++ teshsuite/smpi/mpich-test/coll/shortint\.c
++ teshsuite/smpi/mpich-test/coll/temprun
++ teshsuite/smpi/mpich-test/context/attrt\.c
++ teshsuite/smpi/mpich-test/context/commnames\.c
++ teshsuite/smpi/mpich-test/env/argstest\.c
++ teshsuite/smpi/mpich-test/env/cmdline\.c
++ teshsuite/smpi/mpich-test/env/errhand2\.c
++ teshsuite/smpi/mpich-test/env/hang\.c
++ teshsuite/smpi/mpich-test/pt2pt/fairness/README
++ teshsuite/smpi/mpich-test/pt2pt/fairness/fairness-euih\.c
++ teshsuite/smpi/mpich-test/pt2pt/fairness/fairness\.c
++ teshsuite/smpi/mpich-test/pt2pt/fairness/fairness2\.c
++ teshsuite/smpi/mpich-test/pt2pt/fairness/fairness2m\.c
++ teshsuite/smpi/mpich-test/pt2pt/fairness/fairnessm\.c
++ teshsuite/smpi/mpich-test/pt2pt/isndrcv2\.c
++ teshsuite/smpi/mpich-test/pt2pt/mpitest\.h
++ teshsuite/smpi/mpich-test/pt2pt/systest\.c
++ teshsuite/smpi/mpich-test/pt2pt/systest1\.c
++ teshsuite/smpi/mpich-test/pt2pt/testhetero
++ teshsuite/smpi/mpich-test/topol/cart\.c
++ teshsuite/smpi/mpich-test/topol/cart1f\.f
++ teshsuite/smpi/mpich-test/topol/cart2\.c
++ teshsuite/smpi/mpich-test/topol/cart2f\.f
++ teshsuite/smpi/mpich-test/topol/cartc\.f90
++ teshsuite/smpi/mpich-test/topol/cartf\.f
++ teshsuite/smpi/mpich-test/topol/cartf\.std
++ teshsuite/smpi/mpich-test/topol/cartmap\.c
++ teshsuite/smpi/mpich-test/topol/cartmap\.std
++ teshsuite/smpi/mpich-test/topol/cartorder\.c
++ teshsuite/smpi/mpich-test/topol/dims\.c
++ teshsuite/smpi/mpich-test/topol/graphtest\.c
++ teshsuite/smpi/mpich-test/topol/graphtest\.std
++ teshsuite/smpi/mpich-test/topol/test\.c
++ teshsuite/smpi/mpich-test/topol/test\.h
++ teshsuite/smpi/mpich-test/topol/twod\.f
++ teshsuite/smpi/mpich-test/topol/twod2\.f
+
++ tools/check_dist_archive
++ tools/check_dist_archive\.exclude