~jibel/+junk/lo-bibisect

« back to all changes in this revision

Viewing changes to lo-build

  • Committer: Jean-Baptiste Lallement
  • Date: 2013-01-25 13:11:44 UTC
  • Revision ID: jean-baptiste.lallement@ubuntu.com-20130125131144-c9c8c5ab518c74vk
init

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -eux
 
2
 
 
3
#####
 
4
# Move the following variables to configuration file
 
5
GITDIR=$(readlink -f ../../core/)
 
6
PASS_INC=32
 
7
FAIL_INC=10
 
8
STARTAT=1
 
9
FROM=libreoffice-4-0-branch-point
 
10
TO=master
 
11
BASEDIR=/tmp/lo
 
12
BUILDSCRIPT=$(dirname $(readlink -f $0))/build.sh
 
13
#####
 
14
 
 
15
ARCHIVEDIR=$BASEDIR/archive
 
16
ARTIFACTSDIR=$BASEDIR/artifacts
 
17
BINREPODIR=$BASEDIR/binrepo
 
18
BUILDDIR=$BASEDIR/builddir
 
19
MILESTONEDIR=$BASEDIR/milestone
 
20
SOURCEDIR=$BASEDIR/source
 
21
TARFILESDIR=$BASEDIR/tarfiles
 
22
 
 
23
 
 
24
init() {
 
25
    mkdir -p $BASEDIR
 
26
    mkdir -p $ARCHIVEDIR
 
27
    mkdir -p $ARTIFACTSDIR
 
28
    mkdir -p $BINREPODIR
 
29
    mkdir -p $BUILDDIR
 
30
    mkdir -p $MILESTONEDIR
 
31
    mkdir -p $SOURCEDIR
 
32
    mkdir -p $TARFILESDIR
 
33
 
 
34
    if [ ! -f $BASEDIR/.init ]; then
 
35
        git init $BINREPODIR
 
36
        git --git-dir=${BINREPODIR}/.git commit --allow-empty -m 'root'
 
37
        git --git-dir=${GITDIR}/.git branch failures
 
38
        touch ${BASEDIR}/.init
 
39
    fi
 
40
}
 
41
 
 
42
commit_artifacts() {
 
43
    cd $BINREPODIR
 
44
    git checkout -f $1
 
45
    cd $ARTIFACTSDIR
 
46
    git --git-dir=${BINREPODIR}/.git --work-tree=${ARTIFACTSDIR} add -A
 
47
    git --git-dir=${BINREPODIR}/.git --work-tree=${ARTIFACTSDIR} commit -F ${ARTIFACTSDIR}/commitmsg
 
48
    git --git-dir=${BINREPODIR}/.git tag source-hash-$2
 
49
}
 
50
 
 
51
build_milestone() {
 
52
    commit=$1
 
53
    echo "Building $commit"
 
54
    rm -Rf $BUILDDIR $ARTIFACTSDIR
 
55
    git clone -n $GITDIR $BUILDDIR
 
56
    mkdir -p $ARTIFACTSDIR
 
57
    cd $BUILDDIR
 
58
    git checkout $commit
 
59
 
 
60
    echo "Calling build script"
 
61
    $BUILDSCRIPT $BUILDDIR $ARTIFACTSDIR
 
62
    ret=$?
 
63
 
 
64
    if [ $ret -eq 0 ]; then
 
65
        commit_artifacts master $commit success
 
66
    else
 
67
        commit_artifacts failures $commit failed
 
68
    fi
 
69
 
 
70
    echo $commit >> $BUILDLIST
 
71
 
 
72
    return $ret
 
73
}
 
74
 
 
75
init
 
76
 
 
77
BUILDLIST=$BASEDIR/buildlist
 
78
 
 
79
NEXT=1
 
80
if [ -f $BUILDLIST ];then
 
81
    FROM=$(tail -1 $BUILDLIST)
 
82
    STARTAT=0
 
83
    NEXT=$PASS_INC
 
84
fi
 
85
 
 
86
#COMMITS=$(git --git-dir=${GITDIR}/.git rev-list --reverse ${FROM}..${TO} | awk "NR == $STARTAT || NR % $INCREMENT == 0")
 
87
#
 
88
#for commit in $COMMITS; do
 
89
#    echo "Checking $commit"
 
90
#    if ! grep -q $commit $BUILDLIST; then
 
91
#        build_milestone $commit
 
92
#    fi
 
93
#done
 
94
 
 
95
ROW=0
 
96
git --git-dir=${GITDIR}/.git rev-list --reverse ${FROM}..${TO} | while read commit; do
 
97
    ROW=$((ROW + 1))
 
98
    if ! grep -q $commit $BUILDLIST; then
 
99
        if [ $ROW -eq $NEXT ]; then
 
100
            build_milestone $commit
 
101
            if [ $? -eq 0 ]; then
 
102
                NEXT=$((NEXT + PASS_INC))
 
103
            else
 
104
                NEXT=$((NEXT + FAIL_INC))
 
105
            fi
 
106
        fi
 
107
    fi
 
108
done