purple: add support for latest appstreamcli
[siplcs.git] / src / adium / check_release.sh
blob5b22a6ee4d9775a4a160cb193de7dcca91468dc8
1 #!/bin/bash
3 # Compare release contents with golden list to ensure release correctness
5 if [[ -z "$1" ]]; then
6 echo 1>&2 "usage: $0 <SIPEAdiumPlugin zip file>"
7 exit 1
8 fi
10 # examine release archive
11 echo "Checking release archive '$1'..."
12 files=$(set -o pipefail; unzip -l "$1" |
13 grep SIPEAdiumPlugin.AdiumLibpurplePlugin/ |
14 awk '{ print $4, $1 }' |
15 grep -v '/ 0')
16 if [[ $? -ne 0 ]]; then
17 echo 1>&2 "ERROR: can't analyze release archive '$1'!"
18 exit 1
21 # the following files *MUST* be in the release archive
22 declare -A golden_list
23 golden_list=(
24 [SIPEAdiumPlugin.AdiumLibpurplePlugin/Contents/Info.plist]=1
25 [SIPEAdiumPlugin.AdiumLibpurplePlugin/Contents/MacOS/SIPEAdiumPlugin]=1
26 [SIPEAdiumPlugin.AdiumLibpurplePlugin/Contents/Resources/English.lproj/DCPurpleSIPEJoinChatView.nib]=1
27 [SIPEAdiumPlugin.AdiumLibpurplePlugin/Contents/Resources/English.lproj/InfoPlist.strings]=1
28 [SIPEAdiumPlugin.AdiumLibpurplePlugin/Contents/Resources/ESSIPEAccountView.nib]=1
29 [SIPEAdiumPlugin.AdiumLibpurplePlugin/Contents/Resources/PurpleDefaultsSIPE.plist]=1
30 [SIPEAdiumPlugin.AdiumLibpurplePlugin/Contents/Resources/sipe.png]=1
32 new_files=()
34 # compare against golden list
35 # @TODO: is there a better way to feed in file list?
36 while read file size; do
37 if [[ -z "${golden_list[${file}]}" ]]; then
38 new_files+=( $file )
39 elif [[ "${size}" -eq 0 ]]; then
40 echo 1>&2 "ERROR: file '${file}' is empty!"
41 else
42 unset golden_list[${file}]
44 done <<EOF
45 ${files[@]}
46 EOF
48 # check for errors
49 status=0
50 if [[ -n "${new_files[@]}" ]]; then
51 echo 1>&2 "Release archive contains superfluous files:"
52 for file in "${new_files[@]}"; do
53 echo -e 1>&2 "\t${file}"
54 done
55 status=1
57 if [[ ${#golden_list[@]} -ne 0 ]]; then
58 echo 1>&2 "Release archive is missing the following files:"
59 for file in "${!golden_list[@]}"; do
60 echo -e 1>&2 "\t${file}"
61 done
62 status=1
64 if [[ $status -eq 0 ]]; then
65 echo "Release archive is OK!"
66 else
67 echo "Release archive is NOT OK!"
69 exit $status