Commit ed475b50 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[CHANGE] - improved elease scripts

parent 58a43e8d
...@@ -142,7 +142,7 @@ chroot_do() ...@@ -142,7 +142,7 @@ chroot_do()
echo "* Executing \"$*\"." echo "* Executing \"$*\"."
chroot $CHROOTDIR $* chroot $CHROOTDIR $*
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo " * Failed to chroot. Does the chroot envirnoment exist?" echo " * Error occured in chroot. Does the chroot envirnoment exist? Problem with the executed command?"
chroot_umount chroot_umount
exit 1 exit 1
fi fi
......
...@@ -124,7 +124,44 @@ Builder_TGZ() ...@@ -124,7 +124,44 @@ Builder_TGZ()
{ {
# apply builder # apply builder
echo "Not yet implemented!" echo "Not yet implemented!"
exit 1 exit 0
}
#########################################################################################################
# Create a simple source tgz
#
# Precondition: the same as CreateWorkingDir
# Postcondition: working directory is PWD
Builder_SRC()
{
source $CONFIG_FILE
# some paths
BUILDER_SRC_UPSTREAM_SRC_DIR=OpenWalnut-$VERSION
BUILDER_SRC_UPSTREAM_SRC_TAR=openwalnut_$VERSION.tar.gz
# create some place to work in
CreateWorkingDir "src" "$BUILDER_SRC_UPSTREAM_SRC_DIR" ""
if [ $? -ne 0 ]; then
echo " * Failed to create working diretory."
exit 1
fi
# simply tar the stuff
echo "* Create source tar \"$BUILDER_SRC_UPSTREAM_SRC_TAR\"."
tar cfz $BUILDER_SRC_UPSTREAM_SRC_TAR $BUILDER_SRC_UPSTREAM_SRC_DIR
if [ $? -ne 0 ]; then
echo " * Failed to create tar archive."
exit 1
fi
# copy archive to release dir
echo "* Copy files to release dir \"$RELEASE_DIR\"."
cp $BUILDER_SRC_UPSTREAM_SRC_TAR ../$RELEASE_DIR
if [ $? -ne 0 ]; then
echo " * Failed to copy to release dir."
exit 1
fi
} }
######################################################################################################### #########################################################################################################
...@@ -141,7 +178,8 @@ Builder_DEB() ...@@ -141,7 +178,8 @@ Builder_DEB()
# this and have special requirements on them (like debuild) # this and have special requirements on them (like debuild)
BUILDER_DEB_UPSTREAM_SRC_DIR=OpenWalnut-$VERSION BUILDER_DEB_UPSTREAM_SRC_DIR=OpenWalnut-$VERSION
# Debuild requires a different upstream tar name ... # Debuild requires a different upstream tar name ...
BUILDER_DEB_UPSTREAM_SRC_TAR=openwalnut_$VERSION.orig.tar.gz BUILDER_DEB_UPSTREAM_SRC_BASENAME=openwalnut_$VERSION
BUILDER_DEB_UPSTREAM_SRC_TAR=$BUILDER_DEB_UPSTREAM_SRC_BASENAME.orig.tar.gz
# create some place to work in # create some place to work in
CreateWorkingDir "deb" "$BUILDER_DEB_UPSTREAM_SRC_DIR" "src/modules/data/ext/nifti src/modules/data/ext/biosig" CreateWorkingDir "deb" "$BUILDER_DEB_UPSTREAM_SRC_DIR" "src/modules/data/ext/nifti src/modules/data/ext/biosig"
...@@ -182,7 +220,16 @@ Builder_DEB() ...@@ -182,7 +220,16 @@ Builder_DEB()
# get back to working dir # get back to working dir
cd .. cd ..
echo "* Created source and binary package in \"`pwd`\"." # copy archive to release dir
echo "* Copy files to release dir \"$RELEASE_DIR\"."
cp $BUILDER_DEB_UPSTREAM_SRC_TAR *.changes *.dsc *.debian.tar.gz ../$RELEASE_DIR
if [ $? -ne 0 ]; then
echo " * Failed to copy to release dir."
exit 1
fi
# hint
echo "* Please do not forget to sign the package."
} }
######################################################################################################### #########################################################################################################
......
#!/bin/sh #!/bin/bash
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# #
...@@ -28,28 +28,39 @@ ...@@ -28,28 +28,39 @@
# Release Configuration Variables # Release Configuration Variables
############################################################################################################# #############################################################################################################
# Which version?
VERSION_BASE=1.2.5
# Should the package number contain the HG revision?
VERSION_INCLUDE_HG=0
# Where to grab the sources? # Where to grab the sources?
REPO="ssh://openwalnut.com//srv/hg/ow" REPO="ssh://openwalnut.com//srv/hg/ow"
VERSION_BASE=1.2.5
REPO_BRANCH="OpenWalnut_$VERSION_BASE" REPO_BRANCH="OpenWalnut_$VERSION_BASE"
# Which packages to build # Which packages to build
PACKAGES="deb src tgz" PACKAGES="deb src tgz"
# Define which chroot/distribution to use for build the packages # Define which chroot/distribution to use for build the packages
# NOTE: supported are "sid wheezy squeeze lucid maverick natty"
# As we only need a source DEB, we do not build the deb for all supported distributions. The NeuroDebian project is doing this. # As we only need a source DEB, we do not build the deb for all supported distributions. The NeuroDebian project is doing this.
# DISTRIBUTIONS_DEB="sid wheezy squeeze lucid maverick natty" # DISTRIBUTIONS_DEB="sid wheezy squeeze lucid maverick natty"
DISTRIBUTIONS_DEB="sid" DISTRIBUTIONS_DEB="sid"
# use these distributions to build binary tgz # use these distributions to build binary tgz
DISTRIBUTIONS_TGZ="sid wheezy squeeze lucid maverick natty" #DISTRIBUTIONS_TGZ="sid wheezy squeeze lucid maverick natty"
# I am not sure whether this is useful? The binary would depend on a very specific boost version ... maybe we fix this by providing the boost libs too?
DISTRIBUTIONS_TGZ=""
# Architectures to build for # Architectures to build for
# NOTE: we need the debsrc package. # NOTE: we need the debsrc package.
ARCHITECTURES_DEB="amd64" ARCHITECTURES_DEB="amd64"
# Build binary tgz for 386 and amd64 # Build binary tgz for 386 and amd64
ARCHITECTURES_TGZ="i368 amd64" ARCHITECTURES_TGZ="amd64 i386"
# where to put the created stuff?
RELEASE_DIR="OpenWalnut-Release"
############################################################################################################# #############################################################################################################
# Internal Variables # Internal Variables
...@@ -86,16 +97,28 @@ Bootstrap() ...@@ -86,16 +97,28 @@ Bootstrap()
echo "* Cloning OpenWalnut repository \"$REPO\"." echo "* Cloning OpenWalnut repository \"$REPO\"."
hg clone --branch $REPO_BRANCH "$REPO" "$CHECKOUT_DIR" hg clone --branch $REPO_BRANCH "$REPO" "$CHECKOUT_DIR"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo " * cloning failed. Wrong repository?." echo " * Cloning failed. Wrong repository?"
exit 1
fi
echo "* Creating release directory \"$RELEASE_DIR\"."
mkdir -p $RELEASE_DIR
if [ $? -ne 0 ]; then
echo " * Creating release directory failed."
exit 1 exit 1
fi fi
# write config file # write config file
echo "SRC_DIR=$CHECKOUT_DIR" > $CONFIG_FILE echo "SRC_DIR=$CHECKOUT_DIR" > $CONFIG_FILE
echo "RELEASE_DIR=$RELEASE_DIR" >> $CONFIG_FILE
# The version. You can use shell commands to evaluate this. The command is # The version. You can use shell commands to evaluate this. The command is
# called inside the working dir of owpack script. # called inside the working dir of owpack script.
echo "VERSION=$VERSION_BASE+hg`cd $CHECKOUT_DIR;hg parents --template "{rev}"`" >> $CONFIG_FILE
echo "VERSION_BASE=$VERSION_BASE" >> $CONFIG_FILE echo "VERSION_BASE=$VERSION_BASE" >> $CONFIG_FILE
if [ $VERSION_INCLUDE_HG -ne 0 ]; then
echo "VERSION=$VERSION_BASE+hg`cd $CHECKOUT_DIR;hg parents --template "{rev}"`" >> $CONFIG_FILE
else
echo "VERSION=$VERSION_BASE" >> $CONFIG_FILE
fi
# get the latest scripts # get the latest scripts
cp $CHECKOUT_DIR/tools/release/owpack . cp $CHECKOUT_DIR/tools/release/owpack .
...@@ -104,7 +127,7 @@ Bootstrap() ...@@ -104,7 +127,7 @@ Bootstrap()
} }
######################################################################################################### #########################################################################################################
# Cleanup any mess. Remove checkout dir and config file. # Cleanup any mess. Remove build stuff but keeps config and checkout (and scripts), like after bootstrap.
CleanUp() CleanUp()
{ {
echo "* Removing logs." echo "* Removing logs."
...@@ -116,6 +139,16 @@ CleanUp() ...@@ -116,6 +139,16 @@ CleanUp()
echo "* Removing buildfiles." echo "* Removing buildfiles."
sudo ./owpack clean || exit $? sudo ./owpack clean || exit $?
echo "* Removing packages."
rm -rf $RELEASE_DIR/*
}
#########################################################################################################
# Complete cleanup. Removes everything created.
Purge()
{
CleanUp
echo "* Removing checkout." echo "* Removing checkout."
rm -rf $CHECKOUT_DIR rm -rf $CHECKOUT_DIR
...@@ -126,6 +159,9 @@ CleanUp() ...@@ -126,6 +159,9 @@ CleanUp()
echo "* Removing config." echo "* Removing config."
rm -f $CONFIG_FILE rm -f $CONFIG_FILE
echo "* Removing releases."
rm -rf $RELEASE_DIR
} }
######################################################################################################### #########################################################################################################
...@@ -164,7 +200,7 @@ BuildAll() ...@@ -164,7 +200,7 @@ BuildAll()
;; ;;
esac esac
# as this cannot be paralellized, we need to do a first run to check and create the chroots if needed # build package for each of its distributions and architectures
for distri in $PkgDistributions for distri in $PkgDistributions
do do
for arch in $PkgArchitectures for arch in $PkgArchitectures
...@@ -172,29 +208,22 @@ BuildAll() ...@@ -172,29 +208,22 @@ BuildAll()
LOGFILE=$0-$pack-$distri-$arch.log LOGFILE=$0-$pack-$distri-$arch.log
echo "LOG created by $0 on `date`" > $LOGFILE echo "LOG created by $0 on `date`" > $LOGFILE
echo "* Building $pack for \"$distri-$arch\". Log: $LOGFILE" | tee -a $MAINLOGFILE
# check for chroot existence # check for chroot existence
sudo ./owbuildchroot $arch $distri check >> $MAINLOGFILE echo "* Check build chroot for $pack-$distri-$arch." | tee -a $MAINLOGFILE
sudo ./owbuildchroot $arch $distri check &>> $MAINLOGFILE
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo " * Build chroot not found. Creating." | tee -a $MAINLOGFILE echo " * Build chroot not found. Creating." | tee -a $MAINLOGFILE
# sudo ./owbuildchroot $arch $distri create >> $MAINLOGFILE sudo ./owbuildchroot $arch $distri create &>> $MAINLOGFILE
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo " * Error. Build chroot not found." | tee -a $MAINLOGFILE echo " * Error. Build chroot not found." | tee -a $MAINLOGFILE
# do not be very tolerant. A missing chroot is a fatal error # do not be very tolerant. A missing chroot is a fatal error
exit 1 exit 1
fi fi
fi fi
done
done
# this can be done in parallel
for distri in $PkgDistributions
do
for arch in $PkgArchitectures
do
# do # do
# sudo ./owbuildchroot $arch $distri run /build/owpack $pack $distri-$arch /build >> $LOGFILE echo "* Building $pack for \"$distri-$arch\". Log: $LOGFILE" | tee -a $MAINLOGFILE
sudo ./owbuildchroot $arch $distri run /build/owpack $pack $distri-$arch /build &>> $LOGFILE
# for later error reporting # for later error reporting
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
...@@ -224,7 +253,8 @@ UsageExit() ...@@ -224,7 +253,8 @@ UsageExit()
echo "" echo ""
echo "Usage: $0 {bootstrap|clean}" echo "Usage: $0 {bootstrap|clean}"
echo " COMMANDS:" echo " COMMANDS:"
echo " clean: removes created build sub-directories." echo " clean: removes created build sub-directories and logs but keeps bootstrap status."
echo " purge: like clean but also removes checkouts and scripts."
echo " bootstrap: gets a fresh copy of OpenWalnut." echo " bootstrap: gets a fresh copy of OpenWalnut."
echo " bootstrap: gets a fresh copy of OpenWalnut." echo " bootstrap: gets a fresh copy of OpenWalnut."
echo " do: does the actual building." echo " do: does the actual building."
...@@ -240,6 +270,9 @@ case "$1" in ...@@ -240,6 +270,9 @@ case "$1" in
clean) clean)
CleanUp CleanUp
;; ;;
purge)
Purge
;;
bootstrap) bootstrap)
Bootstrap || Exit $? Bootstrap || Exit $?
;; ;;
......
Markdown is supported
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