2013-09-10 23:15:28 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
host="gmqcc.qc.to"
|
2013-09-11 21:09:03 +00:00
|
|
|
location="$host/files"
|
|
|
|
list="$location/files"
|
|
|
|
hashes="$location/hashes"
|
|
|
|
options="$location/options"
|
2013-09-10 23:15:28 +00:00
|
|
|
|
|
|
|
#download required things
|
|
|
|
download_list=$(wget -qO- ${list})
|
|
|
|
download_hashes=$(wget -qO- ${hashes})
|
2013-09-11 21:09:03 +00:00
|
|
|
download_options=$(wget -qO- ${options})
|
2013-09-10 23:15:28 +00:00
|
|
|
|
|
|
|
download() {
|
2013-09-25 09:14:59 +00:00
|
|
|
local old="$PWD"
|
|
|
|
cd ~/.gmqcc/testsuite
|
2013-09-10 23:15:28 +00:00
|
|
|
echo "$download_list" | while read -r line
|
|
|
|
do
|
|
|
|
echo "downloading $line ..."
|
|
|
|
wget -q "${location}/$line"
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "$download_hashes" > ~/.gmqcc/testsuite/hashes
|
2013-09-11 21:09:03 +00:00
|
|
|
echo "$download_options" > ~/.gmqcc/testsuite/options
|
|
|
|
|
2013-09-25 09:14:59 +00:00
|
|
|
cd "$old"
|
2013-09-10 23:15:28 +00:00
|
|
|
}
|
|
|
|
|
2013-09-11 21:09:03 +00:00
|
|
|
if [ -z "$download_list" -o -z "$download_hashes" -o -z "$download_options" ]; then
|
2013-09-10 23:15:28 +00:00
|
|
|
echo "failed to download required information to check projects."
|
|
|
|
|
|
|
|
if [ "$(ping -q -c1 "${host}")" ]; then
|
|
|
|
echo "host ${host} seems to be up but missing required files."
|
|
|
|
echo "please file bug report at: github.com/graphitemaster/gmqcc"
|
|
|
|
else
|
|
|
|
echo "host ${host} seems to be down, please try again later."
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "aborting"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# we have existing contents around
|
2013-09-11 21:09:03 +00:00
|
|
|
if [ -f ~/.gmqcc/testsuite/hashes -a -f ~/.gmqcc/testsuite/options ]; then
|
2013-09-10 23:15:28 +00:00
|
|
|
echo "$download_hashes" > /tmp/gmqcc_download_hashes
|
2013-09-11 21:09:03 +00:00
|
|
|
echo "$download_options" > /tmp/gmqcc_download_options
|
|
|
|
|
2013-09-25 07:52:48 +00:00
|
|
|
diff -u ~/.gmqcc/testsuite/hashes /tmp/gmqcc_download_hashes > /dev/null
|
2013-09-11 21:09:03 +00:00
|
|
|
check_hash=$?
|
2013-09-25 07:52:48 +00:00
|
|
|
diff -u ~/.gmqcc/testsuite/options /tmp/gmqcc_download_options > /dev/null
|
2013-09-11 21:09:03 +00:00
|
|
|
check_opts=$?
|
|
|
|
|
|
|
|
if [ $check_hash -ne 0 -o $check_opts -ne 0 ]; then
|
2013-09-10 23:15:28 +00:00
|
|
|
echo "consistency errors in hashes (possible update), obtaining fresh contents"
|
|
|
|
rm -rf ~/.gmqcc/testsuite/projects
|
|
|
|
rm ~/.gmqcc/testsuite/*.zip
|
|
|
|
|
|
|
|
download
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# do we even have the directory
|
|
|
|
echo "preparing project testsuite for the first time"
|
|
|
|
if [ ! -d ~/.gmqcc/testsuite ]; then
|
|
|
|
mkdir -p ~/.gmqcc/testsuite
|
|
|
|
fi
|
|
|
|
|
|
|
|
download
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d ~/.gmqcc/testsuite/projects ]; then
|
|
|
|
mkdir -p ~/.gmqcc/testsuite/projects
|
2013-09-25 09:16:15 +00:00
|
|
|
old="$PWD"
|
2013-09-25 09:14:59 +00:00
|
|
|
cd ~/.gmqcc/testsuite/projects
|
2013-10-11 13:53:53 +00:00
|
|
|
echo "$(ls ../ | grep -v '^hashes$' | grep -v '^projects$' | grep -v '^options$')" | while read -r line
|
2013-09-10 23:15:28 +00:00
|
|
|
do
|
|
|
|
echo "extracting project $line"
|
|
|
|
mkdir "$(echo "$line" | sed 's/\(.*\)\..*/\1/')"
|
|
|
|
unzip -qq "../$line" -d $(echo "$line" | sed 's/\(.*\)\..*/\1/')
|
|
|
|
done
|
2013-09-25 09:14:59 +00:00
|
|
|
cd "$old"
|
2013-09-10 23:15:28 +00:00
|
|
|
else
|
|
|
|
echo "previous state exists, using it"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# compile projects in those directories
|
2013-09-11 20:48:01 +00:00
|
|
|
gmqcc_bin="gmqcc"
|
|
|
|
env -i type gmqcc 1>/dev/null 2>&1 || {
|
|
|
|
if [ -f ../gmqcc ]; then
|
2013-09-11 21:09:03 +00:00
|
|
|
echo "previous build of gmqcc exists, using it"
|
2013-09-11 20:48:01 +00:00
|
|
|
gmqcc_bin="$(pwd)/../gmqcc"
|
2013-09-11 20:50:33 +00:00
|
|
|
elif [ -f ./gmqcc ]; then
|
2013-09-11 21:09:03 +00:00
|
|
|
echo "previous build of gmqcc exists, using it"
|
2013-09-11 20:50:33 +00:00
|
|
|
gmqcc_bin="$(pwd)/gmqcc"
|
2013-09-11 20:48:01 +00:00
|
|
|
else
|
2013-09-11 21:09:03 +00:00
|
|
|
echo "gmqcc not installed and previous build doesn't exist"
|
2013-09-11 20:48:01 +00:00
|
|
|
echo "please run make, or make install"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-09-25 09:14:59 +00:00
|
|
|
end_dir="$PWD"
|
|
|
|
cd ~/.gmqcc/testsuite/projects
|
|
|
|
start="$PWD"
|
2013-09-25 09:16:15 +00:00
|
|
|
find . -maxdepth 1 -mindepth 1 -type d | while read -r line
|
2013-09-10 23:15:28 +00:00
|
|
|
do
|
2013-09-25 09:16:15 +00:00
|
|
|
line="${line#./}"
|
2013-09-11 20:38:18 +00:00
|
|
|
echo -n "compiling $line... "
|
2013-09-25 09:14:59 +00:00
|
|
|
cd "${start}/${line}"
|
2013-09-25 07:52:48 +00:00
|
|
|
|
|
|
|
# does the project have multiple subprojects?
|
|
|
|
if [ -f dirs ]; then
|
2013-09-25 08:23:06 +00:00
|
|
|
echo ""
|
2013-09-25 07:52:48 +00:00
|
|
|
cat dirs | while read -r dir
|
|
|
|
do
|
|
|
|
# change to subproject
|
2013-09-25 08:23:06 +00:00
|
|
|
echo -n " compiling $dir... "
|
2013-09-25 09:16:15 +00:00
|
|
|
old="$PWD"
|
2013-09-25 09:14:59 +00:00
|
|
|
cd "$dir"
|
2013-10-06 03:36:48 +00:00
|
|
|
cmd="$(cat ../../../options | grep "$line:" | awk '{print substr($0, index($0, $2))}')"
|
|
|
|
"$gmqcc_bin" $cmd > /dev/null 2>&1
|
2013-09-25 07:52:48 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
2013-09-25 08:23:06 +00:00
|
|
|
echo "error"
|
|
|
|
else
|
|
|
|
echo "success"
|
2013-09-25 07:52:48 +00:00
|
|
|
fi
|
2013-09-25 09:14:59 +00:00
|
|
|
cd "$old"
|
2013-09-25 07:52:48 +00:00
|
|
|
done
|
|
|
|
# nope only one project
|
|
|
|
else
|
2013-10-06 03:36:48 +00:00
|
|
|
cmd="$(cat ../../options | grep "$line:" | awk '{print substr($0, index($0, $2))}')"
|
|
|
|
"$gmqcc_bin" $cmd > /dev/null 2>&1
|
2013-09-25 07:52:48 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
2013-09-25 08:23:06 +00:00
|
|
|
echo "error"
|
|
|
|
else
|
|
|
|
echo "success"
|
2013-09-25 07:52:48 +00:00
|
|
|
fi
|
|
|
|
fi
|
2013-09-10 23:15:28 +00:00
|
|
|
done
|
2013-09-25 07:52:48 +00:00
|
|
|
|
2013-09-25 09:14:59 +00:00
|
|
|
cd "$end_dir"
|