package_trunk revision 747d06d91101c433c8432437147db244267d2d8f
#!/bin/sh -e
#
# Auto building script
# for the Hets repository
#
# c.prodescu@jacobs-university.de
#
# Dependencies: hets-core dependencies, devscripts, subversion, ant,
# openjdk-6-jdk
#
# VARIABLES
HETS_VERSION=0.98
HETS_REPO=https://svn-agbkb.informatik.uni-bremen.de/Hets/trunk
HETS_LIB_REPO=https://svn-agbkb.informatik.uni-bremen.de/Hets-lib/trunk
export_repo()
{
REPO="$1"
REPO_FOLDER="$2"
FOLDER="$3"
echo ::Checking out $REPO ...
if [ -d $REPO_FOLDER ]; then
svn update -q $REPO_FOLDER || { rm -rf $REPO_FOLDER && svn checkout -q --force $REPO $REPO_FOLDER; }
else
svn checkout -q $REPO $REPO_FOLDER
fi
echo ::Exporting $REPO ...
svn -q --force export $REPO_FOLDER $FOLDER
echo ::Done
}
installed() {
which $1 1> /dev/null || { echo "$1 not installed
Bye." && exit; }
}
if [ -d $PWD/debian ]; then
echo Starting Hets debianize script
else
echo No \"debian\" folder found.
echo Bye.
exit
fi
installed svn
installed ant
dpkg -s "openjdk-6-jdk" 1>/dev/null 2>/dev/null || { echo "Package openjdk-6-jre not installed
Bye." && exit; }
#Macro handling
DIRNAME="`dirname "$0"`"
PWD="`cd "$DIRNAME" && pwd`"
#getting revision number
HETS_REVISION=`svn info $HETS_REPO | tail -n6 | head -n1 | awk '{ print $2 }'`
echo ::Revision detected: $HETS_REVISION
#setting full version
HETS_FULL_VERSION="$HETS_VERSION"r"$HETS_REVISION"
#setting folder name
HETS_REPO_FOLDER=$PWD/hets-svn
HETS_FOLDER=$PWD/hets
HETS_LIB_REPO_FOLDER=$PWD/hets-lib-svn
echo ::Using folder $HETS_FOLDER
export_repo "$HETS_REPO" "$HETS_REPO_FOLDER" "$HETS_FOLDER"
export_repo "$HETS_LIB_REPO" "$HETS_LIB_REPO_FOLDER" "$HETS_FOLDER/hets-lib"
#checking out Hets-owl-tools and compiling jar files
HETS_OWL_TOOLS_FOLDER=$HETS_FOLDER/hets-owl-tools
echo ::Compiling Hets OWL Tools
cd $HETS_FOLDER
make initialize_java 1>/dev/null || { echo Building Hets OWL Tools failed && echo Bye. && exit; }
cd ..
mkdir -p $HETS_FOLDER/hets-owl-tools
cd $HETS_FOLDER/OWL2
cp -r tests OWL*.jar $HETS_FOLDER/hets-owl-tools
cd ../..
mkdir -p $HETS_FOLDER/hets-owl-tools/lib
cp $HETS_FOLDER/OWL2/lib/*.jar $HETS_FOLDER/hets-owl-tools/lib
echo ::Done
#copying OntoDMU and AProVE to hets-owl-tools
cp $HETS_FOLDER/CASL/Termination/AProVE.jar $HETS_FOLDER/hets-owl-tools
cp $HETS_FOLDER/DMU/OntoDMU.jar $HETS_FOLDER/hets-owl-tools
#cleaning the svn/cvs folders
echo ::Clearing svn/cvs folders
cd $HETS_FOLDER
make distclean 1>/dev/null 2>/dev/null
rm OWL2/java -rf
rm programatica
rm -rf GMP Search mini Lottery
cd ..
tar -xf programatica.tar.gz -C $HETS_FOLDER
echo ::Done
#creating orig.tar.gz
echo ::Creating orig.tar.gz archive
tar -czf hets_$HETS_FULL_VERSION.orig.tar.gz hets
echo ::Done
#detecting distributions for which to build
echo "::Detecting distroseries"
DISTROS=$PWD/debian/*
COUNT=`echo $DISTROS | wc -w`
echo " $COUNT distributions found"
count=0
for DIST in $DISTROS
do
rm -rf $HETS_FOLDER
# incrementing count
count="`expr $count + 1`"
# Packaging for each distroseries
echo "::Packaging for `basename $DIST` distroseries ($count/$COUNT)"
# Unpacking orig.tar.gz archive
tar -xf hets_$HETS_FULL_VERSION.orig.tar.gz
# Copying debian folder
echo ::Creating debian folder and changelog
cp -rf $DIST $HETS_FOLDER/debian
rm -rf $HETS_FOLDER/debian/.svn
# Creating the changelog
echo "hets ($HETS_FULL_VERSION-1ubuntu$count) `basename $DIST`; urgency=low" > .changelog
echo >> .changelog
echo " * Initial release, automatically generated." >> .changelog
echo >> .changelog
echo " -- `cat changelog_name` <`cat changelog_email`> `date -R`" >> .changelog
#merging changelogs
mv .changelog $HETS_FOLDER/debian/changelog
echo ::Done
echo ::Starting package building and signing;
cd $HETS_FOLDER;
debuild -S -sa
echo ::Done
cd ..
echo ::Uploading package...
dput ppa:hets/hets hets_"$HETS_FULL_VERSION"-1ubuntu"$count"_source.changes
echo ::Done
done
#done
echo "::All $COUNT package(s) uploaded successfully"