← Back to team overview

kicad-developers team mailing list archive

Re: SVN snapshots

 

Hi Philip,

for now the script is a 'blind and deaf slave' - see attachment.
I want to test every step in it so the result of the script will be 
either succesful upload of both linux and source snapshots or email with 
errors to see what went wrong.

Thank you for your interest.
Milan

Philip Pemberton napsal(a):
> Milan Horák wrote:
>> In future I intend to automatize all of these and let it work alone. I 
>> hope I'll soon figure out, how to croscompile for Windows on Linux 
>> machine, to be able to make it all by meas of bash script.
> 
> MinGW has a Linux port available, in addition to the Windows version: 
> <http://www.mingw.org/>
> 
>> And about bash script; can anyone please help me with it? I need to test 
>> every operation's exit code and progress script according to this exit 
>> code. There must be the way, but I don't see it :-(
> 
> $? will get you the return code of the last command that was executed.. I'd 
> encapsulate the check into a function, then call that function from elsewhere 
> in the script.
> 
> For parsing the output of e.g. make or gcc, grep, sed, awk, cut, head andtail 
> are your friends :)
> 
> Can you be a bit more specific about what exactly you want the script to do, 
> e.g. sample input/output?
> 
 --------------060800060309020600070305 Content-Type: text/plain;
name="kicad-nightly"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="kicad-nightly"

#!/bin/bash
# Kicad automatic nightbuild script
# Version 1.1
# Creation date 2008-03-05
# win32 binary build will be available with CMake 2.8

project_name="kicad"
main_svn_directory="$HOME/svn"
build_dir_linux="$HOME/Development/Kicad/linux"
build_dir_win32="$HOME/Development/Kicad/win32"
additional_files="$HOME/Development/Kicad/readme"
build_dir_source="$HOME/Development/Kicad/source"
bindir_list=( cvpcb eeschema gerbview kicad pcbnew )
remote_svn_url="https://kicad.svn.sourceforge.net/svnroot/kicad/trunk/kicad";

# Change directory to svn root
cd $main_svn_directory
# Checkout current source
echo "Checking out repository..."
wait
# tail-sed-sed-sed formula extracts version number from svn checkout output
version=`svn checkout $remote_svn_url $project_name | tail -n 1 | sed 's/[a-zA-Z ]//g' | sed 's/\.//g'`
wait
echo "Version is -"$version"-"
# Wait for checkout to end
wait
# Change directory to project directory
cd $project_name
# If build directory exists, delete it
echo "Creating build directory..."
if [ -d build ]
then rm -rf ./build
fi
# Create build directory
mkdir build
cd build
# Do a cmake .
echo "Processing cmake..."
cmake ..
# Wait for it to end
wait
# Do make
echo "Processing make..."
make
# Wait for it to end
wait
# If exists directory with linux binaries remove it
echo "Creating directory for linux binary..."
if [ -d $build_dir_linux ]
then rm -rf $build_dir_linux
fi
mkdir $build_dir_linux
# If exists directory with win32 binaries remove it
echo "Creating directory for win32 binary..."
if [ -d $build_dir_win32 ]
then rm -rf $build_dir_win32
fi
mkdir $build_dir_win32
# If exists directory with sources remove it
echo "Creating directory for source..."
if [ -d $build_dir_source ]
then rm -rf $build_dir_source
fi
# Copy each compiled linux binary to linux build directory
echo "Processing linux binaries..."
for bindir in ${bindir_list[@]}
do
cd $bindir
cp $bindir $build_dir_linux
cd ..
done
echo "Creating nightbuild package..."
cp $additional_files/* $build_dir_linux
cd $build_dir_linux
tar cvjf kicad-`date +%Y%m%d`-r$version-linux.tar.bz2 *
# Export current source to temporary directory
svn export $main_svn_directory/$project_name $build_dir_source
cd $build_dir_source
# Make source package
tar cvjf kicad-`date +%Y%m%d`-r$version-source.tar.bz2 *
# Putting files to sourceforge ftp
# First linux build
echo "Putting linux build to beischer.com..."
cd $build_dir_linux
scp kicad-`date +%Y%m%d`-r$version-linux.tar.bz2 milan@...:kicad/nightly
# Then source package
echo "Putting source package to beischer.com..."
cd $build_dir_source
scp kicad-`date +%Y%m%d`-r$version-source.tar.bz2 milan@...:kicad/source
# And send messages
echo "Sending messages about new release..."
echo "Kicad nightly notification ($version)." > svn-update-mail
cat svn-update-mail | mail -s "Kicad - "$version darkstar@...
 --------------060800060309020600070305--




References