summaryrefslogtreecommitdiff
path: root/media/libstagefright/checkout.sh
blob: 42dfb87fd0bb9e6a9cfc483babf8265acb6f1fd7 (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
#!/bin/bash -e
set -o pipefail
abort () {
    errcode=$?
    echo "Error: That didn't work..."
    exit $errcode
}
trap abort ERR

cd `dirname "$0"`

SITE=https://android.googlesource.com/platform
for TAGFILE in `find patches -name \*.tag` 
do
    REPO=${TAGFILE:8:-4}
    DEST=android/${REPO}
    if [[ ! -e ${DEST} ]]
    then
        mkdir -p `dirname ${DEST}`
        echo Cloning from ${SITE}/${REPO}
        git clone ${SITE}/${REPO} ${DEST}
    fi

    rm -fR ${REPO}
    TAG=`cat $TAGFILE`
    (cd $DEST && git reset --hard 2>&1 && git checkout ${TAG} 2>&1) > /dev/null
done

FILES=`python files.py`
HEADERS=`cat additional_headers`
for FILE in $FILES $HEADERS frameworks/av/media/libstagefright/include/AMRExtractor.h
do
    echo Copying ${FILE}
    mkdir -p `dirname ${FILE}`
    cp android/${FILE} ${FILE}
done

for PATCH in `find patches -name \*.patch` 
do
    REPO=${PATCH:8:-6}
    echo Patching repo ${REPO}
    for FILE in `grep -- '--- a/' ${PATCH} | colrm 1 6`
    do
        if [[ ! -e ${FILE} ]]
        then
            echo Copying ${REPO}/${FILE}
            mkdir -p `dirname ${REPO}/${FILE}`
            cp android/${REPO}/${FILE} ${REPO}/${FILE}
        fi
    done
    (cd ${REPO} && patch -p1 || true) < $PATCH
done