Skip to content

Instantly share code, notes, and snippets.

@mazurov
Created February 3, 2012 09:25
Show Gist options
  • Save mazurov/1729230 to your computer and use it in GitHub Desktop.
Save mazurov/1729230 to your computer and use it in GitHub Desktop.
Get all packages
#!/bin/bash
if [ $# -lt 2 ] ; then
echo Usage: $(basename $0) project version
exit 1
fi
project=$1
PROJECT=$(echo $1 | tr a-z A-Z)
version=$2
projects=$(cd $LHCBRELEASES/$PROJECT/${PROJECT}_$version; cmt show projects | sed 's/(in.*//' | grep -v LCGCMT | awk '{if ($2) {print $2}}')
echo 'export CMTPROJECTPATH=$(PWD):$(LHCBPROJECTPATH)' > Makefile
echo 'all:' >> Makefile
for pv in $projects ; do
p=$(echo $pv | cut -d_ -f1)
v=$(echo $pv | cut -d_ -f2)
if [ ! -e $p/$pv ] ; then
echo Checking out $p $v
getpack -Pr --batch $p $v
fi
if grep -q ^${pv}: Makefile ; then
# echo ${pv} already inserted
true
else
echo "" >> Makefile
echo ${pv}: $(awk '/^use/{print $3}' $p/$pv/cmt/project.cmt | grep -v LCGCMT ) >> Makefile
#echo $'\tcd '$p/$pv' ; cmt show projects' >> Makefile
echo $'\t${MAKE} -C '$p/$pv >> Makefile
echo all: ${pv} >> Makefile
fi
done
echo "Now run make -j (with the right arguments)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment