blob: eff61a5eb51eb243e0cb3095a4865b9d1575867f (
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
#!/bin/bash
function show_error_msg()
{
echo "*** ERROR *** $? line $1 $0 did not complete successfully!"
echo "$ERROR_HELP"
}
ERROR_HELP=""
# Print an Error message if `set -eE` causes the script to exit due to a failed command
trap 'show_error_msg $LINENO' ERR
source dom/media/webrtc/third_party_build/use_config_env.sh
echo "MOZ_LIBWEBRTC_SRC: $MOZ_LIBWEBRTC_SRC"
# After this point:
# * eE: All commands should succeed.
# * u: All variables should be defined before use.
# * o pipefail: All stages of all pipes should succeed.
set -eEuo pipefail
CURRENT_DIR=`pwd`
cd $MOZ_LIBWEBRTC_SRC
MANUAL_INTERVENTION_COMMIT_FILE="$TMP_DIR/manual_commits.txt"
rm -f $MANUAL_INTERVENTION_COMMIT_FILE
# Find the common commit between our previous work branch and trunk
CURRENT_RELEASE_BASE=`git merge-base branch-heads/$MOZ_PRIOR_UPSTREAM_BRANCH_HEAD_NUM master`
# Write no-op files for the cherry-picked release branch commits. For more
# details on what this is doing, see make_upstream_revert_noop.sh.
COMMITS=`git log -r $CURRENT_RELEASE_BASE..branch-heads/$MOZ_PRIOR_UPSTREAM_BRANCH_HEAD_NUM --format='%h'`
for commit in $COMMITS; do
echo "Processing release branch commit $commit for no-op handling"
# Don't process the commit if the commit message is missing the customary
# line that shows which upstream commit is being cherry-picked.
CNT=`git show $commit | grep "cherry picked from commit" | wc -l | tr -d " " || true`
if [ $CNT != 1 ]; then
# record the commit to list at the end of this script as
# 'needing intervention'
echo " no cherry-pick info found, skipping commit $commit"
echo "$commit" >> $MANUAL_INTERVENTION_COMMIT_FILE
continue
fi
CHERRY_PICK_COMMIT=`git show $commit | grep "cherry picked from commit" | tr -d "()" | awk '{ print $5; }'`
SHORT_SHA=`git show --name-only $CHERRY_PICK_COMMIT --format='%h' | head -1`
echo " commit $commit cherry-picks $SHORT_SHA"
echo "We already cherry-picked this when we vendored $commit." \
> $STATE_DIR/$SHORT_SHA.no-op-cherry-pick-msg
done
# This section checks for commits that may have been cherry-picked in more
# than one release branch.
TARGET_RELEASE_BASE=`git merge-base $MOZ_TARGET_UPSTREAM_BRANCH_HEAD master`
NEW_COMMITS=`git log -r $TARGET_RELEASE_BASE..$MOZ_TARGET_UPSTREAM_BRANCH_HEAD --format='%h'`
# Convert the files that we've already generated for no-op detection into
# something that we can use as a regular expression for searching.
KNOWN_NO_OP_COMMITS=`cd $STATE_DIR ; \
ls *.no-op-cherry-pick-msg \
| sed 's/\.no-op-cherry-pick-msg//' \
| paste -sd '|' /dev/stdin`
for commit in $NEW_COMMITS; do
echo "Processing next release branch commit $commit for no-op handling"
# Don't process the commit if the commit message is missing the customary
# line that shows which upstream commit is being cherry-picked.
CNT=`git show $commit | grep "cherry picked from commit" | wc -l | tr -d " " || true`
if [ $CNT != 1 ]; then
# record the commit to list at the end of this script as
# 'needing intervention'
echo " no cherry-pick info found, skipping commit $commit"
echo "$commit" >> $MANUAL_INTERVENTION_COMMIT_FILE
continue
fi
CHERRY_PICK_COMMIT=`git show $commit | grep "cherry picked from commit" | tr -d "()" | awk '{ print $5; }'`
SHORT_SHA=`git show --name-only $CHERRY_PICK_COMMIT --format='%h' | head -1`
# The trick here is that we only want to include no-op processing for the
# commits that appear both here _and_ in the previous release's cherry-pick
# commits. We check the known list of no-op commits to see if it was
# cherry picked in the previous release branch and then create another
# file for the new release branch commit that will ultimately be a no-op.
if [[ "$SHORT_SHA" =~ ^($KNOWN_NO_OP_COMMITS)$ ]]; then
echo " commit $commit cherry-picks $SHORT_SHA"
cp $STATE_DIR/$SHORT_SHA.no-op-cherry-pick-msg $STATE_DIR/$commit.no-op-cherry-pick-msg
fi
done
if [ ! -f $MANUAL_INTERVENTION_COMMIT_FILE ]; then
echo "No commits require manual intervention"
exit
fi
echo $"
Each of the following commits requires manual intervention to
verify the source of the cherry-pick or there may be errors
reported during the fast-forward processing. Without this
intervention, the common symptom is that the vendored commit
file count (0) will not match the upstream commit file count.
"
for commit in `cat $MANUAL_INTERVENTION_COMMIT_FILE`; do
SUMMARY=`git show --oneline --name-only $commit | head -1`
echo " '$SUMMARY'"
done
echo $"
To manually create the no-op tracking files needed,
run the following command for each commit in question:
( export UPSTREAM_COMMIT=\"{sha-of-upstream-commit}\" ; \\
export PICKED_COMMIT=\"{sha-of-already-used-commit}\" ; \\
echo \"We already cherry-picked this when we vendored \$PICKED_COMMIT.\" \\
> $STATE_DIR/\$UPSTREAM_COMMIT.no-op-cherry-pick-msg )
"
|