meson: libfreedreno depends upon libdrm (for fence support)
[mesa.git] / bin / get-pick-list.sh
1 #!/bin/sh
2
3 # Script for generating a list of candidates for cherry-picking to a stable branch
4 #
5 # Usage examples:
6 #
7 # $ bin/get-pick-list.sh
8 # $ bin/get-pick-list.sh > picklist
9 # $ bin/get-pick-list.sh | tee picklist
10 #
11 # The output is as follows:
12 # [nomination_type] commit_sha commit summary
13
14 is_stable_nomination()
15 {
16 git show --summary "$1" | grep -q -i -o "CC:.*mesa-stable"
17 }
18
19 is_typod_nomination()
20 {
21 git show --summary "$1" | grep -q -i -o "CC:.*mesa-dev"
22 }
23
24 # Helper to handle various mistypos of the fixes tag.
25 # The tag string itself is passed as argument and normalised within.
26 is_sha_nomination()
27 {
28 fixes=`git show --pretty=medium -s $1 | tr -d "\n" | \
29 sed -e 's/'"$2"'/\nfixes:/Ig' | \
30 grep -Eo 'fixes:[a-f0-9]{8,40}'`
31
32 fixes_count=`echo "$fixes" | wc -l`
33 if test $fixes_count -eq 0; then
34 return 0
35 fi
36 while test $fixes_count -gt 0; do
37 # Treat only the current line
38 id=`echo "$fixes" | tail -n $fixes_count | head -n 1 | cut -d : -f 2`
39 fixes_count=$(($fixes_count-1))
40
41 # Bail out if we cannot find suitable id.
42 # Any specific validation the $id is valid and not some junk, is
43 # implied with the follow up code
44 if test "x$id" = x; then
45 continue
46 fi
47
48 #Check if the offending commit is in branch.
49
50 # Be that cherry-picked ...
51 # ... or landed before the branchpoint.
52 if grep -q ^$id already_picked ||
53 grep -q ^$id already_landed ; then
54 return 0
55 fi
56 done
57 return 1
58 }
59
60 is_fixes_nomination()
61 {
62 is_sha_nomination "$1" "fixes:[[:space:]]*"
63 if test $? -eq 0; then
64 return 0
65 fi
66 is_sha_nomination "$1" "fixes[[:space:]]\+"
67 }
68
69 is_brokenby_nomination()
70 {
71 is_sha_nomination "$1" "broken by"
72 }
73
74 is_revert_nomination()
75 {
76 is_sha_nomination "$1" "This reverts commit "
77 }
78
79 # Use the last branchpoint as our limit for the search
80 latest_branchpoint=`git merge-base origin/master HEAD`
81
82 # List all the commits between day 1 and the branch point...
83 git log --reverse --pretty=%H $latest_branchpoint > already_landed
84
85 # ... and the ones cherry-picked.
86 git log --reverse --pretty=medium --grep="cherry picked from commit" $latest_branchpoint..HEAD |\
87 grep "cherry picked from commit" |\
88 sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 's/)//' > already_picked
89
90 # Grep for potential candidates
91 git log --reverse --pretty=%H -i --grep='^CC:.*mesa-stable\|^CC:.*mesa-dev\|\<fixes\>\|\<broken by\>\|This reverts commit' $latest_branchpoint..origin/master |\
92 while read sha
93 do
94 # Check to see whether the patch is on the ignore list.
95 if test -f bin/.cherry-ignore; then
96 if grep -q ^$sha bin/.cherry-ignore ; then
97 continue
98 fi
99 fi
100
101 # Check to see if it has already been picked over.
102 if grep -q ^$sha already_picked ; then
103 continue
104 fi
105
106 if is_stable_nomination "$sha"; then
107 tag=stable
108 elif is_typod_nomination "$sha"; then
109 tag=typod
110 elif is_fixes_nomination "$sha"; then
111 tag=fixes
112 elif is_brokenby_nomination "$sha"; then
113 tag=brokenby
114 elif is_revert_nomination "$sha"; then
115 tag=revert
116 else
117 continue
118 fi
119
120 printf "[ %8s ] " "$tag"
121 git --no-pager show --summary --oneline $sha
122 done
123
124 rm -f already_picked
125 rm -f already_landed