[codeface] [PATCH 3/9] Provision cppstats and srcML outside git tree

  • From: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
  • To: <codeface@xxxxxxxxxxxxx>
  • Date: Thu, 16 Jun 2016 22:46:28 +0200

Do not clutter the repository with temporary external data
when installing supplementary tools. Instead, use
proper random subdirectories in /tmp. See 105d5315c1 for
additional reasons.

Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
---
 integration-scripts/install_cppstats.sh | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/integration-scripts/install_cppstats.sh 
b/integration-scripts/install_cppstats.sh
index 7577924..c8f460e 100755
--- a/integration-scripts/install_cppstats.sh
+++ b/integration-scripts/install_cppstats.sh
@@ -1,23 +1,39 @@
-#!/bin/sh
+#!/bin/bash
+# NOTE: bash instead of sh is required for pushd/popd
 
 export CPPSTATS_VERSION=0.8.4
 
 echo "Providing cppstats $CPPSTATS_VERSION"
 
-mkdir -p vendor/
-cd vendor/
+pushd .
+TMPDIR=`mktemp -d` || exit 1
+cd ${TMPDIR}
 
-wget --quiet 
https://codeload.github.com/clhunsen/cppstats/tar.gz/v$CPPSTATS_VERSION -O ;
/tmp/cppstats.tar.gz
-tar -xvf /tmp/cppstats.tar.gz
+CPPSTATS_URL="https://codeload.github.com/clhunsen/cppstats/tar.gz/v${CPPSTATS_VERSION}";
+wget --quiet ${CPPSTATS_URL} -O ${TMPDIR}/cppstats.tar.gz
+if [ ! -e ${TMPDIR}/cppstats.tar.gz ]
+then
+    echo "Could not download cppstats from ${CPPSTATS_URL}"
+    exit 1
+fi
+tar -xvf cppstats.tar.gz
 export CPPSTATS=$PWD/cppstats-$CPPSTATS_VERSION/
 echo '#!/bin/bash' > $CPPSTATS/cppstats
 echo "cd $CPPSTATS" >> $CPPSTATS/cppstats
 echo "PYTHONPATH=\"\$PYTHONPATH:$CPPSTATS/lib\" ./cppstats.py \"\$@\"" >> 
$CPPSTATS/cppstats
 chmod +x $CPPSTATS/cppstats
-wget --quiet http://131.123.42.38/lmcrs/beta/srcML-Ubuntu12.04-64.tar.gz -O ;
/tmp/srcML.tar.gz
-tar -xvf /tmp/srcML.tar.gz
+
+echo "Providing srcML"
+SRCML_URL="http://131.123.42.38/lmcrs/beta/srcML-Ubuntu12.04-64.tar.gz";
+wget --quiet ${SRCML_URL} -O ${TMPDIR}/srcML.tar.gz
+if [ ! -e ${TMPDIR}/srcML.tar.gz ]
+then
+    echo "Could not download srcML from ${SRCML_URL}"
+    exit 1
+fi
+tar -xvf ${TMPDIR}/srcML.tar.gz
 cp -rf $PWD/srcML/* $CPPSTATS/lib/srcml/linux/
 
 sudo ln -sf $CPPSTATS/cppstats /usr/local/bin/cppstats
 
-cd ..
+popd
-- 
2.8.3


Other related posts:

  • » [codeface] [PATCH 3/9] Provision cppstats and srcML outside git tree - Wolfgang Mauerer