forked from sonyxperiadev/repo_update
-
Notifications
You must be signed in to change notification settings - Fork 0
/
repo_update.sh
executable file
·84 lines (67 loc) · 2.33 KB
/
repo_update.sh
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
# exit script immediately if a command fails or a variable is unset
set -eu
# Some people require insecure proxies
HTTP=https
if [ "${INSECURE_PROXY:-}" = "TRUE" ]; then
HTTP=http
fi
ANDROOT=$PWD
pushd() {
command pushd "$@" > /dev/null
}
popd() {
command popd > /dev/null
}
enter_aosp_dir() {
[ -z "$1" ] && (echo "ERROR: enter_aosp_dir must be called with at least a path! (and optionally an alternative fetch path)"; exit 1)
[ "$ANDROOT" != "$PWD" ] && echo "WARNING: enter_aosp_dir was not called from $ANDROOT. Please fix the script to call popd after every block of patches!"
LINK="$HTTP://android.googlesource.com/platform/${2:-$1}"
echo "Entering $1"
pushd "$ANDROOT/$1"
}
apply_gerrit_cl_commit() {
local _ref=$1
local _commit=$2
local _fetched
# Check whether the commit is already stored
if [ -z "$(git rev-parse --quiet --verify "$_commit^{commit}")" ]
# If not, fetch the ref from $LINK
then
git fetch "$LINK" "$_ref"
_fetched=$(git rev-parse FETCH_HEAD)
if [ "$_fetched" != "$_commit" ]
then
echo "$(pwd): WARNING:"
echo -e "\tFetched commit is not \"$_commit\""
echo -e "\tPlease update the commit hash for $_ref to \"$_fetched\""
fi
_commit=$_fetched
fi
git cherry-pick "$_commit"
}
if [ "${SKIP_SYNC:-}" != "TRUE" ]; then
pushd "$ANDROOT/.repo/local_manifests"
git pull
popd
repo sync -j8 --current-branch --no-tags
fi
enter_aosp_dir bionic
# Add inaddr.h header file
# Change-Id: Iad92c39fb729538cf51bf9d9037b15515104b453
apply_gerrit_cl_commit refs/changes/84/1582884/1 5efdad358c77795bef6c011d87625b0a46b0bd0d
popd
enter_aosp_dir hardware/interfaces
# [android10-dev] thermal: Init module to NULL
# Change-Id: I250006ba6fe9d91e765dde1e4534d5d87aaab879
apply_gerrit_cl_commit refs/changes/90/1320090/1 3861f7958bec14685cde5b8fee4e590cece76d68
popd
enter_aosp_dir frameworks/base
# Fix bug Device that can't support adoptable storage cannot read the sdcard.
# Change-Id: I7afe5078650fe646e79fced7456f90d4af8a449a
apply_gerrit_cl_commit refs/changes/48/1295748/1 6ec651f12a9b67a9d2e41c2fe4d9a71c29d1cf34
popd
# because "set -e" is used above, when we get to this point, we know
# all patches were applied successfully.
echo "+++ all patches applied successfully! +++"
set +eu