summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/guilt/files/guilt.patch
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2013-08-23 14:08:17 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-26 11:29:45 +0100
commitbfba97076555f1e708b4fef08fdcfa43f35d2fcb (patch)
tree76c0c0a4a43a2b46642f7ceaa35cc04de2f9bbcb /meta/recipes-devtools/guilt/files/guilt.patch
parent3b2b4eef0fd06099342fcc2dfa35ecf37840c090 (diff)
downloadpoky-bfba97076555f1e708b4fef08fdcfa43f35d2fcb.tar.gz
guilt: update to latest git version
Uprev guilt to the latest guilt version from its upstream repository. As part of the uprev all of the previous changes required for the yocto kernel tools to use git to manipulate series files have been dropped. These changes were specific to circumventing parts of guilt's internal santiy checking to allow specific Yocto kernel manipluation of sub-series files. Since the kernel tools no longer need guilt, we can use an up to date and nearly pure upstream version of guilt. (From OE-Core rev: 595c4469adc36d88ba2403915fc6c1d355014a58) Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/guilt/files/guilt.patch')
-rw-r--r--meta/recipes-devtools/guilt/files/guilt.patch319
1 files changed, 0 insertions, 319 deletions
diff --git a/meta/recipes-devtools/guilt/files/guilt.patch b/meta/recipes-devtools/guilt/files/guilt.patch
deleted file mode 100644
index 8e5b61edc5..0000000000
--- a/meta/recipes-devtools/guilt/files/guilt.patch
+++ /dev/null
@@ -1,319 +0,0 @@
1guilt: enhanced patch queue management
2
3guilt prefers to track the status and series of patches
4under .git/patches. But this location doesn't allow the
5status of a quilt queue to be committed to a secondary
6repository and later restored.
7
8This change does three things:
9
10 - allows GUILT_BASE to be changed (with a default to "wrs")
11 - allows shadow tracking of the patches (for rebase)
12 - enhances the header detection and creation of patches
13 as they are pushed onto the tree.
14
15Upstream-Status: Inappropriate [oe-specific]
16
17Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
18
19---
20 guilt | 183 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------
21 1 file changed, 159 insertions(+), 24 deletions(-)
22
23--- a/guilt
24+++ b/guilt
25@@ -153,14 +153,16 @@ get_branch()
26
27 verify_branch()
28 {
29- [ ! -d "$GIT_DIR/patches" ] &&
30+ [ ! -d "$GUILT_DIR" ] &&
31 die "Patches directory doesn't exist, try guilt-init"
32- [ ! -d "$GIT_DIR/patches/$branch" ] &&
33+ [ ! -d "$GUILT_DIR/$branch" ] &&
34 die "Branch $branch is not initialized, try guilt-init"
35- [ ! -f "$GIT_DIR/patches/$branch/series" ] &&
36+ [ ! -f "$GUILT_DIR/$branch/series" ] &&
37 die "Branch $branch does not have a series file"
38- [ ! -f "$GIT_DIR/patches/$branch/status" ] &&
39+ [ ! -f "$GUILT_DIR/$branch/status" ] &&
40 die "Branch $branch does not have a status file"
41+ [ -f "$GUILT_DIR/$branch/applied" ] &&
42+ die "Warning: Branch $branch has 'applied' file - guilt is not compatible with stgit"
43 [ -f "$GIT_DIR/patches/$branch/applied" ] &&
44 die "Warning: Branch $branch has 'applied' file - guilt is not compatible with stgit"
45 }
46@@ -339,6 +341,17 @@ BEGIN{}
47 '
48 }
49
50+# usage: do_get_only_patch patchfile
51+# similar to do_get_patch except everything leading up to
52+# the first diff line and after the last chunk are removed
53+do_get_only_patch()
54+{
55+ cat "$1" | awk '
56+BEGIN{}
57+/^(diff )/,/^(-- |END{})/
58+' | sed '/^-- *$/D'
59+}
60+
61 # usage: do_get_header patchfile
62 do_get_header()
63 {
64@@ -352,8 +365,13 @@ do_get_header()
65 BEGIN{skip=0}
66 /^Subject:/ && (NR==1){print substr($0, 10); next}
67 /^From:/{skip=1; next}
68+/^Author:/{skip=1; next}
69+/^Date:/{skip=1; next}
70+/^commit/{skip=1; next}
71 /^[ \t\f\n\r\v]*$/ && (skip==1){skip=0; next}
72 /^(diff |---$|--- )/{exit}
73+/^diff --git/{exit}
74+/^Index: /{exit}
75 {print $0}
76 END{}
77 '
78@@ -415,6 +433,15 @@ series_insert_patch()
79 mv "$series.tmp" "$series"
80 }
81
82+series_append_patch()
83+{
84+ # unlike series_insert_patch, which inserts the passed
85+ # patch after the current top patch, this function always
86+ # appends the patch to the series
87+
88+ echo $1 >> "$series"
89+}
90+
91 # usage: series_remove_patch <patchname>
92 series_remove_patch()
93 {
94@@ -473,8 +500,7 @@ remove_patch_refs()
95 # usage: pop_many_patches <commitish> <number of patches>
96 pop_many_patches()
97 {
98- assert_head_check
99-
100+ head_check "`tail -1 < "$applied" | cut -d: -f 1`"
101 (
102 cd_to_toplevel
103
104@@ -508,50 +534,149 @@ remove_ref()
105 )
106 }
107
108+prep_patch()
109+{
110+ patch=$1;
111+ tgt=$2;
112+
113+ if test -f $patch; then
114+ case $patch in
115+ *.gz) gzip -dc $patch > $tgt ;;
116+ *.bz2) bzip2 -dc $patch > $tgt ;;
117+ *) cp $patch $tgt ;;
118+ esac;
119+ fi;
120+}
121+
122 # usage: commit patchname parent
123 commit()
124 {
125 (
126 TMP_MSG=`get_tmp_file msg`
127+ TMP_PATCH=`get_tmp_file patch`
128+ TMP_PATCH_OUT=`get_tmp_file patch_out`
129+ TMP_INFO=`get_tmp_file info`
130
131 p="$GUILT_DIR/$branch/$1"
132 pname="$1"
133+ prep_patch "$p" "$TMP_PATCH"
134+ p=$TMP_PATCH
135+
136 cd_to_toplevel
137
138 git diff-files --name-only | (while read n; do git update-index "$n" ; done)
139
140+ # borrowed from git-am
141+ header_type=git
142+ git mailinfo "$TMP_MSG" "$TMP_PATCH_OUT" \
143+ <"$p" >"$TMP_INFO";
144+
145+ # skip pine's internal folder data
146+ grep '^Author: Mail System Internal Data$' \
147+ <"$TMP_INFO" >/dev/null
148+
149+ git stripspace < "$TMP_MSG" > "$TMP_MSG.clean"
150+ mv "$TMP_MSG.clean" "$TMP_MSG"
151+ git stripspace < "$TMP_INFO" > "$TMP_INFO.clean"
152+ mv "$TMP_INFO.clean" "$TMP_INFO"
153+
154+ # If mailinfo couldn't get something , try another way
155 # grab a commit message out of the patch
156- do_get_header "$p" > "$TMP_MSG"
157+ if [ ! -s "$TMP_MSG" ] || [ ! -s "$TMP_INFO" ]; then
158+ do_get_header "$p" > "$TMP_MSG"
159+ header_type=guilt
160+ fi
161
162- # make a default commit message if patch doesn't contain one
163- [ ! -s "$TMP_MSG" ] && echo "patch $pname" > "$TMP_MSG"
164+ # last try: make a default commit message if patch doesn't contain one
165+ [ ! -s "$TMP_MSG" ] && echo "auto_msg: patch $pname" > "$TMP_MSG"
166
167- # extract a From line from the patch header, and set
168- # GIT_AUTHOR_{NAME,EMAIL}
169- author_str=`sed -n -e '/^From:/ { s/^From: //; p; q; }; /^(diff |---$|--- )/ q' "$p"`
170- if [ ! -z "$author_str" ]; then
171+
172+ if [ "$header_type" = "guilt" ]; then
173+
174+ # extract a From line from the patch header, and set
175+ # GIT_AUTHOR_{NAME,EMAIL}
176+ author_str=`sed -n -e '/^From:/ { s/^From: //; p; q }; /^(diff |---)/ q' "$p"`
177+ if [ ! -z "$author_str" ]; then
178 GIT_AUTHOR_NAME=`echo $author_str | sed -e 's/ *<.*$//'`
179 export GIT_AUTHOR_NAME="${GIT_AUTHOR_NAME:-" "}"
180 export GIT_AUTHOR_EMAIL="`echo $author_str | sed -e 's/[^<]*//'`"
181- fi
182+ fi
183+
184+
185+ # check in the patch for a subject
186+ SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$p")"
187+ if [ -z "$SUBJECT" ]; then
188+ # if we can't find a subject in the patch, then let's construct
189+ # one from the header of the patch itself
190+ SUBJECT=`cat "$TMP_MSG" | head -n 1`
191+ if [ ${#SUBJECT} -gt 60 ]; then
192+ SUBJECT=${SUBJECT: -60}
193+ fi
194+ fi
195+
196+ if [ -z "$SUBJECT" ]; then
197+ # if we are *still* without a subject, then just use
198+ # the patch name
199+ SUBJECT=`echo $1 | sed 's%^patch *%%'`
200+
201+ if [ ${#SUBJECT} -gt 60 ]; then
202+ SUBJECT=${SUBJECT: -60}
203+ fi
204+ fi
205
206- # must strip nano-second part otherwise git gets very
207- # confused, and makes up strange timestamps from the past
208- # (chances are it decides to interpret it as a unix
209- # timestamp).
210- export GIT_AUTHOR_DATE="`stat -c %y "$p" | sed -e '
211+ SUBJECT=`echo $SUBJECT | sed s'%^ *%%'`
212+
213+ if [ ! -z "$SUBJECT" ]; then
214+ echo "$SUBJECT" >> $TMP_MSG.subject
215+ echo "" >> $TMP_MSG.subject
216+ cat "$TMP_MSG" >> $TMP_MSG.subject
217+ mv "$TMP_MSG.subject" "$TMP_MSG"
218+ fi
219+
220+ # must strip nano-second part otherwise git gets very
221+ # confused, and makes up strange timestamps from the past
222+ # (chances are it decides to interpret it as a unix
223+ # timestamp).
224+ export GIT_AUTHOR_DATE="`stat -c %y "$p" | sed -e '\
225 s/^\([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\) \([0-9]\{2\}\):\([0-9]\{2\}\):\([0-9]\{2\}\)\.[0-9]* \(.*\)$/\1-\2-\3 \4:\5:\6 \7/'`"
226- export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
227+ export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
228+ else
229+ # using git headers, closely related to git-am
230+
231+ GIT_AUTHOR_NAME="$(sed -n '/^Author/ s/Author: //p' "$TMP_INFO")"
232+ GIT_AUTHOR_EMAIL="$(sed -n '/^Email/ s/Email: //p' "$TMP_INFO")"
233+ GIT_AUTHOR_DATE="$(sed -n '/^Date/ s/Date: //p' "$TMP_INFO")"
234+ if test -z "$GIT_AUTHOR_EMAIL"
235+ then
236+ echo "Warning: patch does not have a valid e-mail address."
237+ GIT_AUTHOR_EMAIL=$GIT_AUTHOR_NAME
238+ fi
239+
240+ SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$TMP_INFO")"
241+ if [ ! -z "$SUBJECT" ]; then
242+ echo "$SUBJECT" >> $TMP_MSG.subject
243+ echo "" >> $TMP_MSG.subject
244+ cat "$TMP_MSG" >> $TMP_MSG.subject
245+ mv "$TMP_MSG.subject" "$TMP_MSG"
246+ fi
247+ export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
248+ fi
249
250 # commit
251 treeish=`git write-tree`
252 commitish=`git commit-tree $treeish -p $2 < "$TMP_MSG"`
253+ if [ ! $? -eq 0 ]; then
254+ echo "ERROR. Could not commit tree"
255+ git-reset --hard HEAD^
256+ exit 1
257+ fi
258 git update-ref HEAD $commitish
259
260 # mark patch as applied
261 git update-ref "refs/patches/$branch/$pname" HEAD
262
263- rm -f "$TMP_MSG"
264+ rm -f "$TMP_MSG" "$TMP_LOG" "$TMP_PATCH" "$TMP_INFO" "$TMP_PATCH_OUT"
265+
266 )
267 }
268
269@@ -568,7 +693,7 @@ push_patch()
270 bail_action="$2"
271 reject="--reject"
272
273- assert_head_check
274+ head_check "`tail -1 < "$applied" | cut -d: -f 1`"
275 cd_to_toplevel
276
277 # apply the patch if and only if there is something to apply
278@@ -671,7 +796,7 @@ refresh_patch()
279 # incldiffstat
280 __refresh_patch()
281 {
282- assert_head_check
283+ head_check "`tail -1 < "$applied" | cut -d: -f 1`"
284
285 (
286 TMP_DIFF=`get_tmp_file diff`
287@@ -711,6 +836,10 @@ __refresh_patch()
288
289 head -n "-$N" < "$applied" > "$applied.tmp"
290 mv "$applied.tmp" "$applied"
291+
292+ # update the shadow status.
293+ ref=`cat $GIT_DIR/refs/tags/${branch}_top`
294+ echo "$ref:$1" >> $applied_shadow
295 )
296 }
297
298@@ -791,7 +920,12 @@ diffstat=`git config --bool guilt.diffst
299 # The following gets run every time this file is source'd
300 #
301
302-GUILT_DIR="$GIT_DIR/patches"
303+
304+# GUILT_DIR="$GIT_DIR/patches"
305+if [ -z "$GUILT_BASE" ]; then
306+ GUILT_BASE=wrs
307+fi
308+GUILT_DIR="$GUILT_BASE/patches"
309
310 branch=`get_branch`
311
312@@ -814,6 +948,7 @@ fi
313 # very useful files
314 series="$GUILT_DIR/$branch/series"
315 applied="$GUILT_DIR/$branch/status"
316+applied_shadow="$GUILT_DIR/$branch/shadow_status"
317 guards_file="$GUILT_DIR/$branch/guards"
318
319 # determine a pager to use for anything interactive (fall back to more)