Re: obscure platform autobuilders
2008/10/1 Jeff King <peff@peff.net>:
Show 8 quoted lines
> On Mon, Sep 29, 2008 at 08:51:29AM +0100, Mike Ralphson wrote:
>> Feel free to push changes to gitbuild.sh, including getting rid of
>> anything which looks environment-specific.
>
> I actually went a step further and revamped the architecture a bit.
> Check out the "platform" branch in gitbuild.git. My goal was to try to
> include more information in the gitbuild repository about exactly what
> goes into the test setup for each platform.
> I'm currently building, testing, and pushing FreeBSD 6.1 and Solaris 2.8
> with it (you can see the copious tests I am skipping in
> jk/solaris/config).
My googling led me to think that INTERNAL_QSORT would be a good idea on at least some versions of Solaris... it may depend on the fs though.
> If you like this approach, please go ahead and add an "mr/aix" profile
> with your setup. See the README for details, and let me know if you have
> questions. The script is a mish-mash of yours, mine, and some extra
> rewrites. I wouldn't be surprised if it needs a tweak or two. :)
How about this - let me know if ok, and I'll push it.
diff --git a/README b/README
index 184de11..e91037f 100644
--- a/README
+++ b/README
@@ -10,7 +10,8 @@ several files:
- 'config', a shell script sourced by the build script to override any
variables. See below for more information.
- - 'branches', a list of branches, one per line, to build and test
+ - 'branches', a list of branches, one per line, to build and test.
+ Lines starting with # are treated as comments
- 'gitconfig'; if this file exists, it will be used as the .git/config
of the built and tested repository. This file should define a remote
@@ -18,7 +19,16 @@ several files:
should be published (i.e., repo.or.cz:/srv/git/git/gitbuild.git).
- 'config.mak'; if this file exists, it will be used as the config.mak
- file for building git
+ file for building git. If it is not present, but there is a
+ config.mak file in your project directory, it is copied here to
+ prevent it being removed by 'git clean'
+
+ - 'catch', a shell script sourced by the build script if an error
+ occurs. It is passed the failing command-line in its arguments
+
+ - 'finally', a shell script sourced by the build script at the end
+ of the process. It is passed the exit code of build.sh as its
+ argument
The convention for platform directory names is "$initials/$platform". A
build should be initiated from the platform directory. E.g., by putting
@@ -42,6 +52,9 @@ the variables are:
- make; the command to invoke make. If not set, defaults to "gmake".
+ - project; the path to the directory to build in. If not set, defaults
+ to ./project relative to the starting directory
+
- path_build; the PATH to use while building git. If not set, the
PATH is left alone.
@@ -52,8 +65,8 @@ Invoking build.sh
=================
Generally build.sh is invoked without any options, which means it should
-build all branches one after the other. However, it can be invoked with
-a branch name to build and test just a single branch.
+build all specified branches one after the other. However, it can be
+invoked with a branch name to build and test just a single branch.
The 'project' directory need not be set up beforehand. If it does not
exist, it will be created as an empty git repository automatically. As
diff --git a/build.sh b/build.sh
index b318af2..0967ff3 100755
--- a/build.sh
+++ b/build.sh
@@ -9,6 +9,7 @@ root=$PWD
initials=`dirname $PWD 2>/dev/null`; initials=`basename $initials 2>/dev/null`
name=`basename $PWD 2>/dev/null`
make=gmake
+project=project
. ./config
name=`echo $name | sed 's/[^A-Za-z0-9.-]/-/g'`
@@ -19,6 +20,8 @@ try() {
0) ;;
*) echo >&2 "build failed: $*"
cat >&2 "$log"
+ test -f $root/catch && . $root/catch $*
+ test -f $root/finally && . $root/finally 1
exit 1
;;
esac
@@ -36,6 +39,7 @@ build_branch() {
rm -f "$log"
try git checkout -f -q $branch
+ test -f config.mak && test ! -f $root/config.mak && try cp config.mak $root/
try git clean -d -f -q -x
test -f $root/config.mak && try cp $root/config.mak config.mak
@@ -59,22 +63,23 @@ build_branch() {
log=$root/log.build
rm -f "$log"
-if ! test -d project; then
- try mkdir project
- try cd project
+if ! test -d $project; then
+ try mkdir $project
+ try cd $project
try git init
else
- try cd project
+ try cd $project
fi
test -f $root/gitconfig && try cp $root/gitconfig .git/config
try git remote update
if test -z "$1"; then
- for i in `cat "$root/branches"`; do
+ for i in `cat "$root/branches" | grep -v '^#'`; do
build_branch $i || exit 1
done
else
build_branch $1
fi
+test -f $root/finally && . $root/finally 0
exit 0