On 21.06.19 00:06, Thomas Morley wrote:
Am Do., 20. Juni 2019 um 13:12 Uhr schrieb Thomas Morley
<thomasmorle...@gmail.com>:

Does it not work for subsequent builds of the same branch?
I think I've found a workaround.

Following CG, I'm already used to do some prepatory work while doing
subsequent gub-builds, i.e.:
rm -fr gub/uploads
rm -rf gub/target/*/*/*lilypond*
Yes. Gub might fail for subsequent builds, especially
if you do some unexpected things with git repositories.
A rebase is one of those things. it even might be necessary
to delete the file

./downloads/lilypond/git/refs/heads/localhost/lilypond.git/branchname

Attached find the bash script gubllt. It might be useful if you want to test
a new commit.

gubllt needs exactly four arguements:

   gubllt gub_directory lilypond_repository_directory testbase testobject


gub_directory is the directory of the gub installation to use.
lilypond_repository_directory is the directory of the lilypond repository to 
use.
testbase is the branch name or sha1 of the base version that shall be used as a 
testbase.
testobject is the branch name or sha1 of the lilypond version to test.

Examples:

   gubllt ~/gub ~/lily master testbranch

   gubllt ~/gub ~/lily master 4547102034c4862ec50ae22b477970f192ebb56a

   gubllt ~/gub ~/lily 0e1eeb7838eec112 4547102034c4862e


gubllt first builds a regression test archive for the lilypond version 
'testbase'.

After that a full gub build of lilypond version 'testobject' is executed.
You will find the result of the regression test in uploads/webtest/

gubllt allows to use relative paths for parameters 1 and 2.
gubllt gracefully handles SIGKILL / SIGTERM.

Attention: gubllt removes all old files in regtest/ and upload/, it also removes
./downloads/lilypond/git/refs/heads/localhost/lilypond.git/branchname
and target/*/*/*lilypond*

@James: I put you into cc as I thought you might be interested in the script.

Knut
#!/bin/bash

GITEXEC=`which git`
GITPID=0
TMPSRVDIR=""

# Trap SIGINT / SIGTERM
# errex is used as the general error exit
trap errex SIGINT SIGTERM
function errex {
  echo -e "\nERROR: Abnormal termination of gubllt script!"
  if [ $GITPID -ne 0 ]; then
    echo "... killing git daemon (ppid $GITPID)"
    kill -n 9 -- $(ps -o pid= --ppid $GITPID)
  fi
  if [ "x$TMPSRVDIR" != "x" ]; then
    if [ -d "$TMPSRVDIR" ]; then
      echo "... removing $TMPSRVDIR"
      rm -rf $TMPSRVDIR
    fi
  fi
  exit 255
}

# procFN function
# This function canonicalizes / simplifies path names given as argument 1
# - replace './' at the beginning of $1 with '$PWD/'
# - replace '../' at the beginning of $1 with '$PWD/../'
# - if there is no '/' at the beginning of $1, put '$PWD' in front of $1
# - replace each occurrence of '/something/../' with '/'
# - replace each occurrence of '/./' with '/'
procFN () {
  echo $1 | \
  sed -e "s|^./|$PWD/|" \
      -e  "s|^../|$PWD/../|" \
      -e  "s|\(^[^/]\)|$PWD/\1|" \
      -e ':loopA s|/[^/]*/../|/|; t loopA' \
      -e ':loopB s|/./|/|; t loopB'
}

echo "gubllt --- GUB Local Lilypond Tester"

# abort if not exactly 4 arguments are provided
if [ $# -ne 4 ]; then
  echo "ERROR: invalid number of command line arguments!"
  echo "USAGE: gubllt gub_directory lilypond_repository_directory testbase test"
  echo "       'testbase' and 'test' must be valid braches or commit names"
  echo "       in 'lilypond_repository_directory'"
  errex
fi

GUBDIR=`procFN $1`
LILYREPODIR=`procFN $2`
LILYTESTBASE=$3
LILYTESTVER=$4

echo "Trying to"
echo "  - build regression testbase for '$LILYTESTBASE' of local lilypond 
repository '$LILYREPODIR'"
echo "  - do a full build of lilypond version '$LILYTESTVER'"
echo "with GUB located in '$GUBDIR'"

# abort if a git-daemon is active
ps ax | grep git-daemon | grep -v grep | grep git-daemon
if [ $? -eq 0 ]; then
  echo "ERROR: A git-daemon is already running on this system!"
  errex
fi

# abort if GUBDIR parameter is invalid
if [ ! -f "$GUBDIR/bin/gub" ]; then
  echo "ERROR: gub_directory parameter '$GUBDIR' invalid!"
  errex
fi
mkdir -p $GUBDIR/regtests $GUBDIR/target $GUBDIR/uploads

# abort if LILYREPODIR parameter is invalid
if [ ! -f "$LILYREPODIR/lily/lilypond-version.cc" ]; then
  echo "ERROR: lilypond_repository_directory '$LILYREPODIR' invalid!"
  errex
fi

# create temporary branches
cd $LILYREPODIR
git branch -f tmp-gubllt-test $LILYTESTBASE
if [ $? -ne 0 ]; then
  echo "ERROR: could not create branch 'tmp-gubllt-test', maybe there is no 
branch/commit $LILYTESTBASE!"
  errex
fi

# create a temporary git server directory in GUBDIR, abort if this fails
TMPSRVDIR=$(mktemp -d -t -p $GUBDIR/ gubllt-XXXXXXXXXX)
if [ ! -d "$TMPSRVDIR" ]; then
  echo "ERROR: We failed to created the directory $TMPSRVDIR!"
  TMPSRVDIR=""
  errex
else
  echo "INFO:  Temporary git daemon directory is $TMPSRVDIR"
fi

# create the lilypong.git link in TMPSRVDIR
ln -s $LILYREPODIR $TMPSRVDIR/lilypond.git

# start git-daemon in the background
$GITEXEC daemon --log-destination=none --export-all --reuseaddr 
--base-path=$TMPSRVDIR/ $TMPSRVDIR &> /dev/null &
GITPID=$!
echo "INFO:  Started git daemon with PID $GITPID"

# wait until git-daemon starts to provide its service ... abort if this does 
not occur within a reasonable time
# it is assumed that every lilypond git repository has a valid branch master, 
so test for that.
i=0
while [ $i -le 10 ]
do
  ((i++))
  echo Waiting for git daemon ...
  TESTOUT=`git ls-remote git://localhost/lilypond.git master 2>&1 | grep -o 
refs/heads/master`
  if [ "$TESTOUT" == "refs/heads/master" ]; then
    break;
  fi
  if [ $i -eq 10 ]; then
    echo "ERROR: Git daemon timed out!"
    errex
  fi
  sleep 1
done

# try to build LILYTESTBASE regtest archive
cd  $GUBDIR
rm -rf regtests/* uploads/* target/*/*/*lilypond* 
./downloads/lilypond/git/refs/heads/localhost/lilypond.git/tmp-gubllt-test
bin/gub --platform=linux-64 
git://localhost/lilypond-test.git?branch=tmp-gubllt-test
TESTOUT=`ls uploads/lilypond*.*.*-*.test-output.tar.bz2`
if [ "x$TESTOUT" == "x" ]; then
  echo "ERROR: creating testbase regression test archive failed!"
  errex
fi

# now try a full gub build of LILYTESTVER
cd $LILYREPODIR
git branch -f tmp-gubllt-test $LILYTESTVER
if [ $? -ne 0 ]; then
  echo "ERROR: could not create branch 'tmp-gubllt-test', maybe there is no 
branch/commit $LILYTESTVER!"
  errex
fi
cd $GUBDIR
cp $TESTOUT regtests/lilypond-0.00.0-1.test-output.tar.bz2
touch regtests/ignore
rm -rf uploads/* target/*/*/*lilypond*
make LILYPOND_REPO_URL=git://localhost/lilypond.git 
LILYPOND_BRANCH=tmp-gubllt-test lilypond

# kill our git daemon and remove our temporary git server directory
kill -n 9 -- $(ps -o pid= --ppid $GITPID)
rm -rf $TMPSRVDIR
exit 0
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to