summaryrefslogtreecommitdiffstats
path: root/hudson-builds/archive-verify-latest.sh
blob: a149ca82c8c5db14843db64b39acfba1e1c8019e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#! /bin/bash

if [ -z "$1" ] ; then
  archive=/srv/www/jogamp.org/deployment/jogamp-next
else
  archive=$1
fi

logfile=`basename $0 .sh`.log

rm -rf zips
mkdir zips
cd zips
for i in  $archive/*.zip ; do 
    bname=`basename $i .zip`
    unzip -q $i
    if [ -e $bname ] ; then
        cd $bname
        ls > ../$bname.lst
        cd ..
    else
        echo "Error: No folder $bname in $i"
    fi
done
cd ..

rm -rf plain
mkdir plain
cd plain
cp -a $archive/*.jar .
ls > ../plain.lst
cd ..

rm -rf dump
mkdir dump

echo "Verifying all files in $archive"
ls -la $archive
echo

function integrity_check() {
    cd dump
    for i in ../plain/*.jar ; do
        bname=`basename $i`
        echo -n "$bname integrity - "
        OK=0
        jar xvf $i >& $i.log && OK=1
        if [ $OK -eq 0 ] ; then
            echo ERROR
        else
            echo OK
            rm $i.log
        fi
    done
    echo
    cd ..
}

function identity_check() {
    mkdir plain/natives
    mv plain/*-natives-*jar plain/natives
    mkdir plain/demos
    mv plain/jogl-demos*jar plain/demos

    cd zips

    for i in ../plain/*.jar ; do
        bname=`basename $i`
        echo -n "$bname identity - "
        OK=0
        for j in `find . -name $bname` ; do 
            if cmp -s $i $j ; then
                OK=1
                echo -n "$j "
            fi
        done
        if [ $OK -eq 0 ] ; then
            echo "NONE"
            echo "Error: verbose comparison of $bname" 
            for j in `find . -name $bname` ; do 
                cmp $i $j
            done
        else
            echo
        fi
    done
    echo

    cd ..

    mv plain/natives/* plain/
    rm -rf plain/natives
    mv plain/demos/* plain/
    rm -rf plain/demos
}

integrity_check 2>&1 | tee $logfile
identity_check 2>&1 | tee $logfile