Commit 4f667155 authored by Simon Brass's avatar Simon Brass
Browse files

[NAG] download official NAG compiler

parents
#!/bin/bash -v
FILE_SUFFIX=tbz
NAG_MAJOR=6
NAG_MINOR=00
#SERVER="http://monet.nag.co.uk/compiler/r${NAG_MAJOR}${NAG_MINOR}download/"
SERVER="nag.co.uk/downloads/"
SERVER_IMPL="impl/"
SERVER_PAGE="npdownloads.asp"
rm -f index.html *.tgz
wget ${SERVER}${SERVER_PAGE} -O index.html
ELF32_FILE=`cat index.html | grep -o -E "np.*rh90.tgz"`
ELF64_FILE=`cat index.html | grep -o -E "np.*amd64.tgz"`
MACHO64_FILE=`cat index.html | grep -o -E "np.*macx64.dmg"`
UNPACK_DIR=
function download_arch {
local ARCH=$1
local FILE=$2
echo "wget -q ${SERVER}${SERVER_IMPL}${FILE}"
wget -q ${SERVER}${SERVER_IMPL}${FILE}
}
function unpack_arch {
local ARCH=$1
local FILE=$2
UNPACK_DIR=`tar -tf ${FILE} 2>/dev/null | grep -e '/$' -m 1`
rm -rf $UNPACK_DIR
tar xf $FILE
}
function install_arch {
local ARCH=$1
local FILE=$2
local OLD_REVISION=""
local LATEST_VERSION=nagfor-${NAG_MAJOR}.${NAG_MINOR}-LATEST
local FULL_VERSION=nagfor-${NAG_MAJOR}.${NAG_MINOR}-$REVISION
local NAG_DEST_BASE=NAG_${ARCH}_$REVISION
local NAG_DEST=$WORKSPACE/$NAG_DEST_BASE
local JENKINS_OPT=/var/lib/jenkins/slave/opt
local NAG_PREFIX=$JENKINS_OPT/$FULL_VERSION
local NAG_LATEST=$JENKINS_OPT/$LATEST_VERSION
echo checking for new $ARCH revision...
if [ -d "$NAG_LATEST" ]
then
OLD_REVISION=`ls -la $NAG_LATEST | awk '{print $NF}' | cut -d "-" -f 3`
else
OLD_REVISION=1000
fi
echo FILE=$FILE
cd $UNPACK_DIR
local REVISION=`bin/nagfor 2>&1 | grep -o -E "([0-9]{4})"`
echo REVISION=$REVISION
echo OLD_REVISION=$OLD_REVISION
if [ "$OLD_REVISION" -lt "$REVISION" ]
then
echo "$NAG_PREFIX/bin
$NAG_PREFIX/lib
$NAG_PREFIX/man/man1
1
$NAG_PREFIX/man/man3
3
jenkins
jenkins
"| ${WORKSPACE}/nagfor-install.sh
cd ..
# cp nag.licence $NAG_PREFIX/lib
rm -rf ${NAG_DEST_BASE}
rm -rf $UNPACK_DIR
echo $REVISION > NAG_${ARCH}_REVISION
ln -sfn $NAG_PREFIX $NAG_LATEST
else
echo $ARCH revision $REVISION is up to date.
fi
echo ...done
}
download_arch ELF64 $ELF64_FILE
unpack_arch ELF64 $ELF64_FILE
install_arch ELF64 $ELF64_FILE
ELF64_REVISION=`echo $ELF64_FILE | grep -o -E "_[1234567890]+\." | grep -o -E "[1234567890]+"`
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment