package_trunk revision f9205242fea27450f6b17b1405ff4edeb779df46
#!/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
if [ -d $PWD/debian ]; then
echo Starting Hets debianize script
else
echo No \"debian\" folder found.
echo Bye.
exit
fi
#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_FOLDER=$PWD/hets-$HETS_FULL_VERSION
echo ::Using folder $HETS_FOLDER
#checking out latest Hets version
rm -rf $HETS_FOLDER
echo ::Checking out $HETS_REPO ...
svn -q export $HETS_REPO $HETS_FOLDER
echo ::Done
#checking out latest Hets-lib
echo ::Checking out $HETS_LIB_REPO ...
svn -q export $HETS_LIB_REPO $HETS_FOLDER/hets-lib
echo ::Done
#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 2>/dev/null
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
mkdir -p $HETS_FOLDER/hets-hollight-tools
cp $HETS_FOLDER/HolLight/OcamlTools/*.ml $HETS_FOLDER/hets-hollight-tools
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-$HETS_FULL_VERSION
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"