aboutsummaryrefslogtreecommitdiff
path: root/utils/br-reproduce-build
blob: c0dc5309dde04b794cf12b506a23dfab6ce8d62b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash

# A directory that contains an existing Git repository of
# Buildroot. The script will git clone from it instead of git cloning
# from the official repo, in order to reduce the clone time.
BASE_GIT="${BASE_GIT:-/home/test/buildroot/}"

# Location where the output directories will be created. One
# subdirectory, named after the build ID will be created for each
# build.
OUTPUT_DIR="${OUTPUT_DIR:-$(pwd)}"

if [ $# -ne 1 ] ; then
    echo "Usage: $0 buildid" ;
    echo "  buildid is the SHA1 of the build result, as found on http://autobuild.buildroot.net"
    exit 1 ;
fi

BUILD_ID=$1

BUILD_DIR=${OUTPUT_DIR}/${BUILD_ID}

mkdir -p ${BUILD_DIR}
if [ $? -ne 0 ] ; then
    echo "Cannot create output directory"
    exit 1
fi

wget -O ${BUILD_DIR}/config http://autobuild.buildroot.org/results/${BUILD_ID}/config
if [ $? -ne 0 ] ; then
    echo "Cannot get configuration for build ${BUILD_ID}"
    rm -f ${BUILD_DIR}
    exit 1
fi

wget -O ${BUILD_DIR}/gitid http://autobuild.buildroot.org/results/${BUILD_ID}/gitid

cd ${BUILD_DIR}
git clone ${BASE_GIT}
if [ $? -ne 0 ] ; then
    echo "Cannot clone Buildroot Git repository"
    rm -rf ${BUILD_DIR}
    exit 1
fi

cd buildroot

git remote set-url origin git://git.busybox.net/buildroot

git pull
if [ $? -ne 0 ] ; then
    echo "Cannot pull Buildroot Git repository"
    rm -rf ${BUILD_DIR}
    exit 1
fi

git checkout $(cat ../gitid)
if [ $? -ne 0 ] ; then
    echo "Cannot checkout commit " $(cat ../gitid)
    rm -rf ${BUILD_DIR}
    exit 1
fi

mkdir ../output
cp ${BUILD_DIR}/config ../output/.config
make 2>&1 O=../output | tee logfile