incubator-cassandra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Connolly <stephen.alan.conno...@gmail.com>
Subject Re: Handy script to check the contents of jar files to see if the classes are the same despite being different compilers
Date Tue, 21 Dec 2010 22:47:02 GMT
Can be helpful with CASSANDRA-1888

On 21 December 2010 22:41, Stephen Connolly <stephen.alan.connolly@gmail.com
> wrote:

> #!/bin/bash
>
> if [ $# != 2 ] ; then
>   echo "Syntax: $0 name1.jar name2.jar"
>   exit
> fi
>
> if diff $1 $2 ; then
>   echo Files are identical
>   exit 0
> fi
>
> work=$(mktemp -d)
>
> mkdir -p "$work/a"
> mkdir -p "$work/b"
>
> cwd="$(pwd)"
>
> cd "$work/a"
> unzip "$cwd/$1" | sort > "$work/a.list"
> cd "$work/b"
> unzip "$cwd/$2" | sort > "$work/b.list"
> cd "$work"
>
> if ! diff a.list b.list > diff.list ; then echo "Contents"; echo =====; cat
> diff.list; echo ""; echo "Contents are different" > summary; fi
>
> for class in $(find a -name \*.class | sed -e
> "s:^\\a/::;s:\\.class$::;s:/:.:g"); do javap -c -classpath a $class >
> a.javap; javap -c -classpath b $class > b.javap; if ! diff a.javap b.javap >
> diff.javap ; then echo $class; echo =====; cat diff.javap; echo ""; echo
> $class >> summary; fi; done
>
> if [ -f summary ]; then
> echo "Summary"
> echo "======="
> cat summary
> else
>   echo "File contents are identical"
> fi
>
> cd "$cwd"
> rm -rf "$work"
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message