Roland McGrath 11487c5
#!/bin/sh
2ade70c
# Script helps download the build logs for the current tree.
2ade70c
# The downloaded logs will be saved in a logs/ within the
2ade70c
# tree.
2ade70c
2ade70c
BASEDIR="$(dirname "$(cd $(dirname $BASH_SOURCE[0]) && pwd)")"
2ade70c
pushd $BASEDIR > /dev/null
Roland McGrath 11487c5
Dave Jones f29a760
VER=$(fedpkg verrel)
Roland McGrath 11487c5
ver=$(echo $VER | sed -e 's/-/ /g' | awk '{print $2}')
Roland McGrath 11487c5
rev=$(echo $VER | sed -e 's/-/ /g' | awk '{print $3}')
Roland McGrath 11487c5
2ade70c
# keep logs in one place. If logs directory does not exist, make it.
2ade70c
if [ -d "$BASEDIR/logs" ]; then
2ade70c
  DIR="$BASEDIR/logs"
Roland McGrath 11487c5
else
2ade70c
  mkdir "$BASEDIR/logs"
2ade70c
  DIR="$BASEDIR/logs"
Roland McGrath 11487c5
fi
Roland McGrath 11487c5
2ade70c
# Common architectures that have build logs.
2ade70c
ARCHS[0]=i686
2ade70c
ARCHS[1]=x86_64
2ade70c
ARCHS[2]=noarch
2ade70c
ARCHS[3]=armv7hl
Roland McGrath 11487c5
2ade70c
for arch in ${ARCHS[@]}; do
2ade70c
    URL=http://kojipkgs.fedoraproject.org/packages/kernel/$ver/$rev/data/logs/$arch/build.log
2ade70c
    # Only download logs if exist
2ade70c
    wget --spider -q $URL
2ade70c
    if [ $? -eq 0 ]; then
2ade70c
	wget -O $DIR/build-$VER-$arch.log $URL
2ade70c
    fi
2ade70c
done
2ade70c
popd > /dev/null