summaryrefslogtreecommitdiffstats
path: root/meta/packages/guilt
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2010-08-10 15:01:37 -0400
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-20 16:35:39 +0100
commit2cf104f7e09d620b9c04122d15ce347db34f9577 (patch)
tree173af7dc87afd8e96ef694807bb1080ab2718591 /meta/packages/guilt
parent15543017ec044b1b072a50335a6fd0a036def47e (diff)
downloadpoky-2cf104f7e09d620b9c04122d15ce347db34f9577.tar.gz
guilt: import guilt for kernel patch management
The Wind River kernel is "patched" via guilt to provide both git integration and quilt like patch management (if that is of interest). This is a modified 0.33 guilt with some changes to streamline interactions with the way that the Wind River kernel is constructed. That being said, the common semantics of guilt are not changed, and it can be used for other purposes. Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta/packages/guilt')
-rw-r--r--meta/packages/guilt/files/guilt-bash.patch286
-rw-r--r--meta/packages/guilt/files/guilt-import-commit.patch94
-rw-r--r--meta/packages/guilt/files/guilt-init.patch23
-rw-r--r--meta/packages/guilt/files/guilt-pop.patch71
-rw-r--r--meta/packages/guilt/files/guilt-push-no-series.patch27
-rw-r--r--meta/packages/guilt/files/guilt-push.patch40
-rw-r--r--meta/packages/guilt/files/guilt-set-git_exec_path.patch27
-rw-r--r--meta/packages/guilt/files/guilt.patch317
-rw-r--r--meta/packages/guilt/files/improve_auto_header_gen.patch69
-rw-r--r--meta/packages/guilt/files/make_git_commands_conditional.patch46
-rw-r--r--meta/packages/guilt/files/optional_head_check.patch58
-rw-r--r--meta/packages/guilt/files/uninstall_force.patch12
-rw-r--r--meta/packages/guilt/guilt-native_0.33.bb30
13 files changed, 1100 insertions, 0 deletions
diff --git a/meta/packages/guilt/files/guilt-bash.patch b/meta/packages/guilt/files/guilt-bash.patch
new file mode 100644
index 0000000000..d2058e8cf3
--- /dev/null
+++ b/meta/packages/guilt/files/guilt-bash.patch
@@ -0,0 +1,286 @@
1guilt: explicitly call for bash
2
3Running complex guilt stacks of patches/commits can cause interesting
4failures after ~20m of processing, with errors like "Bad substitution".
5
6These have been traced back to having /bin/sh --> /bin/dash on Ubuntu
7systems. Putting a shell that actually *works* (such as /bin/bash)
8in as /bin/sh makes the problem go away. So here we change the guilt
9scripts to explicitly call for bash to ensure we don't have a similar
10issue after deployment.
11
12Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
13
14---
15 guilt | 2 +-
16 guilt-add | 2 +-
17 guilt-applied | 2 +-
18 guilt-branch | 2 +-
19 guilt-delete | 2 +-
20 guilt-diff | 2 +-
21 guilt-export | 2 +-
22 guilt-files | 2 +-
23 guilt-fold | 2 +-
24 guilt-fork | 2 +-
25 guilt-graph | 2 +-
26 guilt-header | 2 +-
27 guilt-help | 2 +-
28 guilt-import | 2 +-
29 guilt-import-commit | 2 +-
30 guilt-init | 4 ++--
31 guilt-new | 2 +-
32 guilt-next | 2 +-
33 guilt-patchbomb | 2 +-
34 guilt-pop | 2 +-
35 guilt-prev | 2 +-
36 guilt-push | 2 +-
37 guilt-rebase | 2 +-
38 guilt-refresh | 2 +-
39 guilt-rm | 2 +-
40 guilt-series | 2 +-
41 guilt-status | 2 +-
42 guilt-top | 2 +-
43 guilt-unapplied | 2 +-
44 29 files changed, 30 insertions(+), 30 deletions(-)
45
46--- a/guilt
47+++ b/guilt
48@@ -1,4 +1,4 @@
49-#!/bin/sh
50+#!/bin/bash
51 #
52 # Copyright (c) Josef "Jeff" Sipek, 2006-2010
53 #
54--- a/guilt-add
55+++ b/guilt-add
56@@ -1,4 +1,4 @@
57-#!/bin/sh
58+#!/bin/bash
59 #
60 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
61 #
62--- a/guilt-applied
63+++ b/guilt-applied
64@@ -1,4 +1,4 @@
65-#!/bin/sh
66+#!/bin/bash
67 #
68 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
69 #
70--- a/guilt-branch
71+++ b/guilt-branch
72@@ -1,4 +1,4 @@
73-#!/bin/sh
74+#!/bin/bash
75 #
76 # Copyright (c) Josef "Jeff" Sipek, 2007-2008
77 #
78--- a/guilt-delete
79+++ b/guilt-delete
80@@ -1,4 +1,4 @@
81-#!/bin/sh
82+#!/bin/bash
83 #
84 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
85 #
86--- a/guilt-diff
87+++ b/guilt-diff
88@@ -1,4 +1,4 @@
89-#!/bin/sh
90+#!/bin/bash
91 #
92 # Copyright (C) 2007 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
93 #
94--- a/guilt-export
95+++ b/guilt-export
96@@ -1,4 +1,4 @@
97-#!/bin/sh
98+#!/bin/bash
99 #
100 # Copyright (c) Pierre Habouzit, 2007
101 #
102--- a/guilt-files
103+++ b/guilt-files
104@@ -1,4 +1,4 @@
105-#!/bin/sh
106+#!/bin/bash
107 #
108 # Copyright (C) 2007 Yasushi SHOJI <yashi@atmark-techno.com>
109 #
110--- a/guilt-fold
111+++ b/guilt-fold
112@@ -1,4 +1,4 @@
113-#!/bin/sh
114+#!/bin/bash
115 #
116 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
117 #
118--- a/guilt-fork
119+++ b/guilt-fork
120@@ -1,4 +1,4 @@
121-#!/bin/sh
122+#!/bin/bash
123 #
124 # Copyright (c) Josef "Jeff" Sipek, 2007
125 #
126--- a/guilt-graph
127+++ b/guilt-graph
128@@ -1,4 +1,4 @@
129-#!/bin/sh
130+#!/bin/bash
131 #
132 # Copyright (c) Josef "Jeff" Sipek, 2007
133 #
134--- a/guilt-header
135+++ b/guilt-header
136@@ -1,4 +1,4 @@
137-#!/bin/sh
138+#!/bin/bash
139 #
140 # Copyright (c) Josef "Jeff" Sipek, 2006-2010
141 #
142--- a/guilt-help
143+++ b/guilt-help
144@@ -1,4 +1,4 @@
145-#!/bin/sh
146+#!/bin/bash
147 #
148 # Copyright (c) Josef "Jeff" Sipek, 2007
149 #
150--- a/guilt-import
151+++ b/guilt-import
152@@ -1,4 +1,4 @@
153-#!/bin/sh
154+#!/bin/bash
155 #
156 # Copyright (c) Josef "Jeff" Sipek, 2007
157 #
158--- a/guilt-import-commit
159+++ b/guilt-import-commit
160@@ -1,4 +1,4 @@
161-#!/bin/sh
162+#!/bin/bash
163 #
164 # Copyright (c) Josef "Jeff" Sipek, 2007
165 #
166--- a/guilt-init
167+++ b/guilt-init
168@@ -1,4 +1,4 @@
169-#!/bin/sh
170+#!/bin/bash
171 #
172 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
173 #
174@@ -31,7 +31,7 @@ touch "$GUILT_DIR/$branch/status"
175
176 mkdir -p "$GIT_DIR/hooks/guilt"
177 cat > "$GIT_DIR/hooks/guilt/delete" <<EOF
178-#!/bin/sh
179+#!/bin/bash
180 # Usage: <script> <patch being removed>
181
182 echo "Removing patch '\$1'..."
183--- a/guilt-new
184+++ b/guilt-new
185@@ -1,4 +1,4 @@
186-#!/bin/sh
187+#!/bin/bash
188 #
189 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
190 #
191--- a/guilt-next
192+++ b/guilt-next
193@@ -1,4 +1,4 @@
194-#!/bin/sh
195+#!/bin/bash
196 #
197 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
198 #
199--- a/guilt-patchbomb
200+++ b/guilt-patchbomb
201@@ -1,4 +1,4 @@
202-#!/bin/sh
203+#!/bin/bash
204 #
205 # Copyright (c) Josef "Jeff" Sipek, 2007
206 #
207--- a/guilt-pop
208+++ b/guilt-pop
209@@ -1,4 +1,4 @@
210-#!/bin/sh
211+#!/bin/bash
212 #
213 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
214 #
215--- a/guilt-prev
216+++ b/guilt-prev
217@@ -1,4 +1,4 @@
218-#!/bin/sh
219+#!/bin/bash
220 #
221 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
222 #
223--- a/guilt-push
224+++ b/guilt-push
225@@ -1,4 +1,4 @@
226-#!/bin/sh
227+#!/bin/bash
228 #
229 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
230 #
231--- a/guilt-rebase
232+++ b/guilt-rebase
233@@ -1,4 +1,4 @@
234-#!/bin/sh
235+#!/bin/bash
236 #
237 # Copyright (c) Josef "Jeff" Sipek, 2007
238 #
239--- a/guilt-refresh
240+++ b/guilt-refresh
241@@ -1,4 +1,4 @@
242-#!/bin/sh
243+#!/bin/bash
244 #
245 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
246 #
247--- a/guilt-rm
248+++ b/guilt-rm
249@@ -1,4 +1,4 @@
250-#!/bin/sh
251+#!/bin/bash
252 #
253 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
254 #
255--- a/guilt-series
256+++ b/guilt-series
257@@ -1,4 +1,4 @@
258-#!/bin/sh
259+#!/bin/bash
260 #
261 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
262 #
263--- a/guilt-status
264+++ b/guilt-status
265@@ -1,4 +1,4 @@
266-#!/bin/sh
267+#!/bin/bash
268 #
269 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
270 #
271--- a/guilt-top
272+++ b/guilt-top
273@@ -1,4 +1,4 @@
274-#!/bin/sh
275+#!/bin/bash
276 #
277 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
278 #
279--- a/guilt-unapplied
280+++ b/guilt-unapplied
281@@ -1,4 +1,4 @@
282-#!/bin/sh
283+#!/bin/bash
284 #
285 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
286 #
diff --git a/meta/packages/guilt/files/guilt-import-commit.patch b/meta/packages/guilt/files/guilt-import-commit.patch
new file mode 100644
index 0000000000..78cc93e5d2
--- /dev/null
+++ b/meta/packages/guilt/files/guilt-import-commit.patch
@@ -0,0 +1,94 @@
1guilt: import commits via git format-patch
2
3Rather than attempting to process commits directly, it
4is preferable to try dumping the change via git format-patch
5to take advantage of the proper header/subject/from lines that
6are generated.
7
8If patches cannot be exported, fall back to importing
9commits via a more custom method.
10
11Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
12
13---
14 guilt-import-commit | 40 +++++++++++++++++++++++++++++-----------
15 1 file changed, 29 insertions(+), 11 deletions(-)
16
17--- a/guilt-import-commit
18+++ b/guilt-import-commit
19@@ -20,46 +20,64 @@ fi
20 disp "About to begin conversion..." >&2
21 disp "Current head: `cat $GIT_DIR/refs/heads/$branch`" >&2
22
23+# try git-format-patch first, if it fails fall back to internal
24+# methods.
25+patches=`git-format-patch -o $GUILT_DIR/$branch $rhash`
26+if [ -z "$patches" ]; then
27+ need_custom_patches="1"
28+fi
29+
30 for rev in `git rev-list $rhash`; do
31+ if [ ! -z "$need_custom_patches" ]; then
32 s=`git log --pretty=oneline -1 $rev | cut -c 42-`
33
34 fname=`echo $s | sed -e "s/&/and/g" -e "s/[ :]/_/g" -e "s,[/\\],-,g" \
35- -e "s/['\\[{}]//g" -e 's/]//g' -e 's/\*/-/g' \
36+ -e "s/['\\()<>[{}]//g" -e 's/]//g' -e 's/\*/-/g' \
37 -e 's/\?/-/g' | tr A-Z a-z`
38
39- disp "Converting `echo $rev | cut -c 1-8` as $fname"
40+ disp "Converting `echo $rev | cut -c 1-8` as $fname.patch"
41
42 mangle_prefix=1
43 fname_base=$fname
44- while [ -f "$GUILT_DIR/$branch/$fname" ]; do
45+ while [ -f "$GUILT_DIR/$branch/$fname.patch" ]; do
46 fname="$fname_base-$mangle_prefix"
47 mangle_prefix=`expr $mangle_prefix + 1`
48- disp "Patch under that name exists...trying '$fname'"
49+ disp "Patch under that name exists...trying '$fname.patch'"
50 done
51
52 (
53 do_make_header $rev
54 echo ""
55 git diff --binary $rev^..$rev
56- ) > $GUILT_DIR/$branch/$fname
57+ ) > $GUILT_DIR/$branch/$fname.patch
58
59 # FIXME: grab the GIT_AUTHOR_DATE from the commit object and set the
60 # timestamp on the patch
61
62- # insert the patch name into the series file
63- series_insert_patch $fname
64+ patches="$patches $fname.patch"
65+ fi
66
67- # Only reset if the commit was on this branch
68- if head_check $rev 2> /dev/null; then
69+ # Only reset if the commit was on this branch
70+ if head_check $rev 2> /dev/null; then
71 # BEWARE: "git reset" ahead! Is there a way to verify that
72 # we really created a patch? - We don't want to lose any
73 # history.
74 git reset --hard $rev^ > /dev/null
75- elif [ -z "$warned" ]; then
76+ elif [ -z "$warned" ]; then
77 disp "Warning: commit $rev is not the HEAD...preserving commit" >&2
78 disp "Warning: (this message is displayed only once)" >&2
79 warned=t
80- fi
81+ fi
82+done
83+
84+rpatches=`echo "$patches" | sed 's% %\n%g' | tac`
85+for patch in $rpatches; do
86+
87+ iname=`echo $patch | sed s%$GUILT_DIR/$branch/%%`
88+ echo "Inserting $iname"
89+
90+ # insert the patch name into the series file
91+ series_insert_patch $iname
92 done
93
94 disp "Done." >&2
diff --git a/meta/packages/guilt/files/guilt-init.patch b/meta/packages/guilt/files/guilt-init.patch
new file mode 100644
index 0000000000..a06da5bf74
--- /dev/null
+++ b/meta/packages/guilt/files/guilt-init.patch
@@ -0,0 +1,23 @@
1guilt: allow previously initialized branches to be re-initialized
2
3Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
4
5---
6 guilt-init | 6 +++---
7 1 file changed, 3 insertions(+), 3 deletions(-)
8
9--- a/guilt-init
10+++ b/guilt-init
11@@ -20,9 +20,9 @@ while case $# in 0) break ;; esac; do
12 shift
13 done
14
15-if [ -d "$GUILT_DIR/$branch" ]; then
16- die "Branch $branch appears to be already initialized (GIT_DIR=$GIT_DIR)"
17-fi
18+# if [ -d "$GUILT_DIR/$branch" ]; then
19+# die "Branch $branch appears to be already initialized (GIT_DIR=$GIT_DIR)"
20+# fi
21
22 [ ! -d "$GUILT_DIR" ] && mkdir "$GUILT_DIR"
23 mkdir -p "$GUILT_DIR/$branch"
diff --git a/meta/packages/guilt/files/guilt-pop.patch b/meta/packages/guilt/files/guilt-pop.patch
new file mode 100644
index 0000000000..c26b324ccf
--- /dev/null
+++ b/meta/packages/guilt/files/guilt-pop.patch
@@ -0,0 +1,71 @@
1guilt: pop and delete tags
2
3Add support for popping to a tag and the ability to delete
4a tag while popping from the tree
5
6Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
7
8---
9 guilt-pop | 28 ++++++++++++++++++++++++++--
10 1 file changed, 26 insertions(+), 2 deletions(-)
11
12--- a/guilt-pop
13+++ b/guilt-pop
14@@ -17,6 +17,13 @@ while [ $# -gt 0 ]; do
15 -n)
16 num=t
17 ;;
18+ -t|--t)
19+ tag=$2
20+ shift
21+ ;;
22+ -d|--d) # can only be used with --t
23+ delete_tag=t
24+ ;;
25 *)
26 break
27 ;;
28@@ -24,7 +31,7 @@ while [ $# -gt 0 ]; do
29 shift
30 done
31
32-# "guilt-pop" or "guilt-pop foo" or "guilt-pop -n foo"
33+# "guilt-pop" or "guilt-pop foo" or "guilt-pop -n foo" or "guilt-pop -t <tag>"
34 if [ -z "$all" ] && [ $# -gt 1 ]; then
35 usage
36 fi
37@@ -44,12 +51,26 @@ fi
38 patch="$1"
39 [ ! -z "$all" ] && patch="-a"
40
41+
42+# tag processing will just roll into another one of
43+# the pop types, number or patch name
44+if [ ! -z "$tag" ]; then
45+ git-rev-list HEAD ^$tag > /dev/null 2>/dev/null
46+ if [ $? -eq 0 ]; then
47+ revs="`git-rev-list HEAD ^$tag`"
48+ num=`echo "$revs" | wc -l`
49+ patch=$num
50+ else
51+ echo "Cannot find tag $tag";
52+ exit 0
53+ fi
54+fi
55+
56 if [ ! -s "$applied" ]; then
57 disp "No patches applied."
58 exit 0
59 elif [ "$patch" = "-a" ]; then
60 # we are supposed to pop all patches
61-
62 sidx=`wc -l < $applied`
63 eidx=0
64 elif [ ! -z "$num" ]; then
65@@ -96,3 +117,6 @@ pop_many_patches `git rev-parse refs/pat
66 p=`get_top`
67 [ ! -z "$p" ] && disp "Now at $p." || disp "All patches popped."
68
69+if [ ! -z "$delete_tag" ]; then
70+ git tag -d $tag
71+fi;
diff --git a/meta/packages/guilt/files/guilt-push-no-series.patch b/meta/packages/guilt/files/guilt-push-no-series.patch
new file mode 100644
index 0000000000..d40119c712
--- /dev/null
+++ b/meta/packages/guilt/files/guilt-push-no-series.patch
@@ -0,0 +1,27 @@
1guilt-push: Avoid duplicate hits in a series
2
3If a series file becomes mangled and a patch name appears in there
4more than once, then the guilt-push will fail a horrible and
5incomprehensible death. Make it fail in a sensible way.
6
7Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
8
9---
10
11 guilt-push | 5 +++++
12 1 file changed, 5 insertions(+)
13
14--- a/guilt-push
15+++ b/guilt-push
16@@ -90,6 +90,11 @@ else
17 if [ -z "$eidx" ]; then
18 die "Patch $patch is not in the series or is guarded."
19 fi
20+
21+ matches=`echo $eidx | wc -w`
22+ if [ $matches -gt 1 ]; then
23+ die "Patch $patch is in the series multiple times"
24+ fi
25 fi
26
27 # make sure that there are no unapplied changes
diff --git a/meta/packages/guilt/files/guilt-push.patch b/meta/packages/guilt/files/guilt-push.patch
new file mode 100644
index 0000000000..2184329595
--- /dev/null
+++ b/meta/packages/guilt/files/guilt-push.patch
@@ -0,0 +1,40 @@
1guilt: add support for pushing and tagging
2
3It can be handy to push AND tag at the same time.
4
5Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
6
7---
8
9 guilt-push | 16 +++++++++++++++-
10 1 file changed, 15 insertions(+), 1 deletion(-)
11
12--- a/guilt-push
13+++ b/guilt-push
14@@ -19,7 +19,11 @@ while [ $# -gt 0 ]; do
15 -n)
16 num=t
17 ;;
18- *)
19+ -t|--t)
20+ tag=$2
21+ shift
22+ ;;
23+ *)
24 break
25 ;;
26 esac
27@@ -126,3 +130,13 @@ do
28 fi
29 done
30
31+ret=$?
32+if [ $ret -ne 0 ]; then
33+ exit $ret
34+fi
35+
36+# if a tag was specified, tag the tree now.
37+if [ -n "$tag" ]; then
38+ git-rev-parse HEAD > "$GIT_DIR/refs/tags/$tag"
39+fi
40+
diff --git a/meta/packages/guilt/files/guilt-set-git_exec_path.patch b/meta/packages/guilt/files/guilt-set-git_exec_path.patch
new file mode 100644
index 0000000000..92e75f29ef
--- /dev/null
+++ b/meta/packages/guilt/files/guilt-set-git_exec_path.patch
@@ -0,0 +1,27 @@
1guilt: set GIT_EXEC_PATH in guilt wrapper
2
3git has the habit of tracking the directory where it was
4installed. If you build git, relocate git and then remove
5the old directory --exec-path will return that original
6(now non-existent) directory. We insist that git and
7guilt be in the same directory to ensure they are matched,
8so we use the environment variable GIT_EXEC_PATH to
9force the issue.
10
11Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
12
13---
14 guilt | 2 ++
15 1 file changed, 2 insertions(+)
16
17--- a/guilt
18+++ b/guilt
19@@ -23,6 +23,8 @@ esac
20 # we change directories ourselves
21 SUBDIRECTORY_OK=1
22
23+export GIT_EXEC_PATH=`dirname $0`/../libexec/git-core
24+
25 if [ -z "$DO_NOT_USE_GITREPO_COMMANDS" ]; then
26 . "$(git --exec-path)/git-sh-setup"
27 fi
diff --git a/meta/packages/guilt/files/guilt.patch b/meta/packages/guilt/files/guilt.patch
new file mode 100644
index 0000000000..a3352cf810
--- /dev/null
+++ b/meta/packages/guilt/files/guilt.patch
@@ -0,0 +1,317 @@
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
15Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
16
17---
18 guilt | 183 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------
19 1 file changed, 159 insertions(+), 24 deletions(-)
20
21--- a/guilt
22+++ b/guilt
23@@ -153,14 +153,16 @@ get_branch()
24
25 verify_branch()
26 {
27- [ ! -d "$GIT_DIR/patches" ] &&
28+ [ ! -d "$GUILT_DIR" ] &&
29 die "Patches directory doesn't exist, try guilt-init"
30- [ ! -d "$GIT_DIR/patches/$branch" ] &&
31+ [ ! -d "$GUILT_DIR/$branch" ] &&
32 die "Branch $branch is not initialized, try guilt-init"
33- [ ! -f "$GIT_DIR/patches/$branch/series" ] &&
34+ [ ! -f "$GUILT_DIR/$branch/series" ] &&
35 die "Branch $branch does not have a series file"
36- [ ! -f "$GIT_DIR/patches/$branch/status" ] &&
37+ [ ! -f "$GUILT_DIR/$branch/status" ] &&
38 die "Branch $branch does not have a status file"
39+ [ -f "$GUILT_DIR/$branch/applied" ] &&
40+ die "Warning: Branch $branch has 'applied' file - guilt is not compatible with stgit"
41 [ -f "$GIT_DIR/patches/$branch/applied" ] &&
42 die "Warning: Branch $branch has 'applied' file - guilt is not compatible with stgit"
43 }
44@@ -339,6 +341,17 @@ BEGIN{}
45 '
46 }
47
48+# usage: do_get_only_patch patchfile
49+# similar to do_get_patch except everything leading up to
50+# the first diff line and after the last chunk are removed
51+do_get_only_patch()
52+{
53+ cat "$1" | awk '
54+BEGIN{}
55+/^(diff )/,/^(-- |END{})/
56+' | sed '/^-- *$/D'
57+}
58+
59 # usage: do_get_header patchfile
60 do_get_header()
61 {
62@@ -352,8 +365,13 @@ do_get_header()
63 BEGIN{skip=0}
64 /^Subject:/ && (NR==1){print substr($0, 10); next}
65 /^From:/{skip=1; next}
66+/^Author:/{skip=1; next}
67+/^Date:/{skip=1; next}
68+/^commit/{skip=1; next}
69 /^[ \t\f\n\r\v]*$/ && (skip==1){skip=0; next}
70 /^(diff |---$|--- )/{exit}
71+/^diff --git/{exit}
72+/^Index: /{exit}
73 {print $0}
74 END{}
75 '
76@@ -415,6 +433,15 @@ series_insert_patch()
77 mv "$series.tmp" "$series"
78 }
79
80+series_append_patch()
81+{
82+ # unlike series_insert_patch, which inserts the passed
83+ # patch after the current top patch, this function always
84+ # appends the patch to the series
85+
86+ echo $1 >> "$series"
87+}
88+
89 # usage: series_remove_patch <patchname>
90 series_remove_patch()
91 {
92@@ -473,8 +500,7 @@ remove_patch_refs()
93 # usage: pop_many_patches <commitish> <number of patches>
94 pop_many_patches()
95 {
96- assert_head_check
97-
98+ head_check "`tail -1 < "$applied" | cut -d: -f 1`"
99 (
100 cd_to_toplevel
101
102@@ -508,50 +534,149 @@ remove_ref()
103 )
104 }
105
106+prep_patch()
107+{
108+ patch=$1;
109+ tgt=$2;
110+
111+ if test -f $patch; then
112+ case $patch in
113+ *.gz) gzip -dc $patch > $tgt ;;
114+ *.bz2) bzip2 -dc $patch > $tgt ;;
115+ *) cp $patch $tgt ;;
116+ esac;
117+ fi;
118+}
119+
120 # usage: commit patchname parent
121 commit()
122 {
123 (
124 TMP_MSG=`get_tmp_file msg`
125+ TMP_PATCH=`get_tmp_file patch`
126+ TMP_PATCH_OUT=`get_tmp_file patch_out`
127+ TMP_INFO=`get_tmp_file info`
128
129 p="$GUILT_DIR/$branch/$1"
130 pname="$1"
131+ prep_patch "$p" "$TMP_PATCH"
132+ p=$TMP_PATCH
133+
134 cd_to_toplevel
135
136 git diff-files --name-only | (while read n; do git update-index "$n" ; done)
137
138+ # borrowed from git-am
139+ header_type=git
140+ git mailinfo "$TMP_MSG" "$TMP_PATCH_OUT" \
141+ <"$p" >"$TMP_INFO";
142+
143+ # skip pine's internal folder data
144+ grep '^Author: Mail System Internal Data$' \
145+ <"$TMP_INFO" >/dev/null
146+
147+ git stripspace < "$TMP_MSG" > "$TMP_MSG.clean"
148+ mv "$TMP_MSG.clean" "$TMP_MSG"
149+ git stripspace < "$TMP_INFO" > "$TMP_INFO.clean"
150+ mv "$TMP_INFO.clean" "$TMP_INFO"
151+
152+ # If mailinfo couldn't get something , try another way
153 # grab a commit message out of the patch
154- do_get_header "$p" > "$TMP_MSG"
155+ if [ ! -s "$TMP_MSG" ] || [ ! -s "$TMP_INFO" ]; then
156+ do_get_header "$p" > "$TMP_MSG"
157+ header_type=guilt
158+ fi
159
160- # make a default commit message if patch doesn't contain one
161- [ ! -s "$TMP_MSG" ] && echo "patch $pname" > "$TMP_MSG"
162+ # last try: make a default commit message if patch doesn't contain one
163+ [ ! -s "$TMP_MSG" ] && echo "auto_msg: patch $pname" > "$TMP_MSG"
164
165- # extract a From line from the patch header, and set
166- # GIT_AUTHOR_{NAME,EMAIL}
167- author_str=`sed -n -e '/^From:/ { s/^From: //; p; q; }; /^(diff |---$|--- )/ q' "$p"`
168- if [ ! -z "$author_str" ]; then
169+
170+ if [ "$header_type" = "guilt" ]; then
171+
172+ # extract a From line from the patch header, and set
173+ # GIT_AUTHOR_{NAME,EMAIL}
174+ author_str=`sed -n -e '/^From:/ { s/^From: //; p; q }; /^(diff |---)/ q' "$p"`
175+ if [ ! -z "$author_str" ]; then
176 GIT_AUTHOR_NAME=`echo $author_str | sed -e 's/ *<.*$//'`
177 export GIT_AUTHOR_NAME="${GIT_AUTHOR_NAME:-" "}"
178 export GIT_AUTHOR_EMAIL="`echo $author_str | sed -e 's/[^<]*//'`"
179- fi
180+ fi
181+
182+
183+ # check in the patch for a subject
184+ SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$p")"
185+ if [ -z "$SUBJECT" ]; then
186+ # if we can't find a subject in the patch, then let's construct
187+ # one from the header of the patch itself
188+ SUBJECT=`cat "$TMP_MSG" | head -n 1`
189+ if [ ${#SUBJECT} -gt 60 ]; then
190+ SUBJECT=${SUBJECT: -60}
191+ fi
192+ fi
193+
194+ if [ -z "$SUBJECT" ]; then
195+ # if we are *still* without a subject, then just use
196+ # the patch name
197+ SUBJECT=`echo $1 | sed 's%^patch *%%'`
198+
199+ if [ ${#SUBJECT} -gt 60 ]; then
200+ SUBJECT=${SUBJECT: -60}
201+ fi
202+ fi
203
204- # must strip nano-second part otherwise git gets very
205- # confused, and makes up strange timestamps from the past
206- # (chances are it decides to interpret it as a unix
207- # timestamp).
208- export GIT_AUTHOR_DATE="`stat -c %y "$p" | sed -e '
209+ SUBJECT=`echo $SUBJECT | sed s'%^ *%%'`
210+
211+ if [ ! -z "$SUBJECT" ]; then
212+ echo "$SUBJECT" >> $TMP_MSG.subject
213+ echo "" >> $TMP_MSG.subject
214+ cat "$TMP_MSG" >> $TMP_MSG.subject
215+ mv "$TMP_MSG.subject" "$TMP_MSG"
216+ fi
217+
218+ # must strip nano-second part otherwise git gets very
219+ # confused, and makes up strange timestamps from the past
220+ # (chances are it decides to interpret it as a unix
221+ # timestamp).
222+ export GIT_AUTHOR_DATE="`stat -c %y "$p" | sed -e '\
223 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/'`"
224- export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
225+ export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
226+ else
227+ # using git headers, closely related to git-am
228+
229+ GIT_AUTHOR_NAME="$(sed -n '/^Author/ s/Author: //p' "$TMP_INFO")"
230+ GIT_AUTHOR_EMAIL="$(sed -n '/^Email/ s/Email: //p' "$TMP_INFO")"
231+ GIT_AUTHOR_DATE="$(sed -n '/^Date/ s/Date: //p' "$TMP_INFO")"
232+ if test -z "$GIT_AUTHOR_EMAIL"
233+ then
234+ echo "Warning: patch does not have a valid e-mail address."
235+ GIT_AUTHOR_EMAIL=$GIT_AUTHOR_NAME
236+ fi
237+
238+ SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$TMP_INFO")"
239+ if [ ! -z "$SUBJECT" ]; then
240+ echo "$SUBJECT" >> $TMP_MSG.subject
241+ echo "" >> $TMP_MSG.subject
242+ cat "$TMP_MSG" >> $TMP_MSG.subject
243+ mv "$TMP_MSG.subject" "$TMP_MSG"
244+ fi
245+ export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
246+ fi
247
248 # commit
249 treeish=`git write-tree`
250 commitish=`git commit-tree $treeish -p $2 < "$TMP_MSG"`
251+ if [ ! $? -eq 0 ]; then
252+ echo "ERROR. Could not commit tree"
253+ git-reset --hard HEAD^
254+ exit 1
255+ fi
256 git update-ref HEAD $commitish
257
258 # mark patch as applied
259 git update-ref "refs/patches/$branch/$pname" HEAD
260
261- rm -f "$TMP_MSG"
262+ rm -f "$TMP_MSG" "$TMP_LOG" "$TMP_PATCH" "$TMP_INFO" "$TMP_PATCH_OUT"
263+
264 )
265 }
266
267@@ -568,7 +693,7 @@ push_patch()
268 bail_action="$2"
269 reject="--reject"
270
271- assert_head_check
272+ head_check "`tail -1 < "$applied" | cut -d: -f 1`"
273 cd_to_toplevel
274
275 # apply the patch if and only if there is something to apply
276@@ -671,7 +796,7 @@ refresh_patch()
277 # incldiffstat
278 __refresh_patch()
279 {
280- assert_head_check
281+ head_check "`tail -1 < "$applied" | cut -d: -f 1`"
282
283 (
284 TMP_DIFF=`get_tmp_file diff`
285@@ -711,6 +836,10 @@ __refresh_patch()
286
287 head -n "-$N" < "$applied" > "$applied.tmp"
288 mv "$applied.tmp" "$applied"
289+
290+ # update the shadow status.
291+ ref=`cat $GIT_DIR/refs/tags/${branch}_top`
292+ echo "$ref:$1" >> $applied_shadow
293 )
294 }
295
296@@ -791,7 +920,12 @@ diffstat=`git config --bool guilt.diffst
297 # The following gets run every time this file is source'd
298 #
299
300-GUILT_DIR="$GIT_DIR/patches"
301+
302+# GUILT_DIR="$GIT_DIR/patches"
303+if [ -z "$GUILT_BASE" ]; then
304+ GUILT_BASE=wrs
305+fi
306+GUILT_DIR="$GUILT_BASE/patches"
307
308 branch=`get_branch`
309
310@@ -814,6 +948,7 @@ fi
311 # very useful files
312 series="$GUILT_DIR/$branch/series"
313 applied="$GUILT_DIR/$branch/status"
314+applied_shadow="$GUILT_DIR/$branch/shadow_status"
315 guards_file="$GUILT_DIR/$branch/guards"
316
317 # determine a pager to use for anything interactive (fall back to more)
diff --git a/meta/packages/guilt/files/improve_auto_header_gen.patch b/meta/packages/guilt/files/improve_auto_header_gen.patch
new file mode 100644
index 0000000000..b98ec5e9fe
--- /dev/null
+++ b/meta/packages/guilt/files/improve_auto_header_gen.patch
@@ -0,0 +1,69 @@
1guilt: improve the generation of an automatic header
2
3Patches that do not have a proper header are encountered when generating
4a tree. This improves the detection of these patches and generates a sane
5header so the eventual commit will be coherent
6
7Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
8
9---
10
11 guilt | 24 ++++++++++++++++++------
12 1 file changed, 18 insertions(+), 6 deletions(-)
13
14--- a/guilt
15+++ b/guilt
16@@ -591,7 +591,12 @@ commit()
17 fi
18
19 # last try: make a default commit message if patch doesn't contain one
20- [ ! -s "$TMP_MSG" ] && echo "auto_msg: patch $pname" > "$TMP_MSG"
21+ if [ ! -s "$TMP_MSG" ]; then
22+ echo "auto_msg: importing `basename $pname`" > "$TMP_MSG"
23+ echo "" >> "$TMP_MSG"
24+ echo "This is an automatic import of patch $pname, no headers were" >> "$TMP_MSG"
25+ echo "detected and a default message was constructed" >> "$TMP_MSG"
26+ fi
27
28
29 if [ "$header_type" = "guilt" ]; then
30@@ -599,12 +604,14 @@ commit()
31 # extract a From line from the patch header, and set
32 # GIT_AUTHOR_{NAME,EMAIL}
33 author_str=`sed -n -e '/^From:/ { s/^From: //; p; q }; /^(diff |---)/ q' "$p"`
34- if [ ! -z "$author_str" ]; then
35- GIT_AUTHOR_NAME=`echo $author_str | sed -e 's/ *<.*$//'`
36- export GIT_AUTHOR_NAME="${GIT_AUTHOR_NAME:-" "}"
37- export GIT_AUTHOR_EMAIL="`echo $author_str | sed -e 's/[^<]*//'`"
38+ if [ -z "$author_str" ]; then
39+ author_str="auto commit <unknown@unknown>"
40 fi
41
42+ GIT_AUTHOR_NAME=`echo $author_str | sed -e 's/ *<.*$//'`
43+ export GIT_AUTHOR_NAME="${GIT_AUTHOR_NAME:-" "}"
44+ export GIT_AUTHOR_EMAIL="`echo $author_str | sed -e 's/[^<]*//'`"
45+
46
47 # check in the patch for a subject
48 SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$p")"
49@@ -615,6 +622,11 @@ commit()
50 if [ ${#SUBJECT} -gt 60 ]; then
51 SUBJECT=${SUBJECT: -60}
52 fi
53+
54+ # remove the line from the tmp msg
55+ mv "$TMP_MSG" "$TMP_MSG.work"
56+ cat "$TMP_MSG.work" | grep -v -E ".*$SUBJECT.*" > "$TMP_MSG"
57+ rm "$TMP_MSG.work"
58 fi
59
60 if [ -z "$SUBJECT" ]; then
61@@ -629,7 +641,7 @@ commit()
62
63 SUBJECT=`echo $SUBJECT | sed s'%^ *%%'`
64
65- if [ ! -z "$SUBJECT" ]; then
66+ if [ -n "$SUBJECT" ]; then
67 echo "$SUBJECT" >> $TMP_MSG.subject
68 echo "" >> $TMP_MSG.subject
69 cat "$TMP_MSG" >> $TMP_MSG.subject
diff --git a/meta/packages/guilt/files/make_git_commands_conditional.patch b/meta/packages/guilt/files/make_git_commands_conditional.patch
new file mode 100644
index 0000000000..b6d40dbc9f
--- /dev/null
+++ b/meta/packages/guilt/files/make_git_commands_conditional.patch
@@ -0,0 +1,46 @@
1guilt: allow operation outside of git repos
2
3Sometimes guilt is sourced when there isn't a containing git repository.
4Some of the git commands that are always called will report errors
5unecesarility in this scenario. This adds a variable that will inhibit
6those problematic calls
7
8Signed-off-by <bruce.ashfield@windriver.com>
9
10---
11
12 guilt | 9 ++++++---
13 1 file changed, 6 insertions(+), 3 deletions(-)
14
15
16--- a/guilt
17+++ b/guilt
18@@ -23,7 +23,9 @@ esac
19 # we change directories ourselves
20 SUBDIRECTORY_OK=1
21
22-. "$(git --exec-path)/git-sh-setup"
23+if [ -z "$DO_NOT_USE_GITREPO_COMMANDS" ]; then
24+ . "$(git --exec-path)/git-sh-setup"
25+fi
26
27 #
28 # Git version check
29@@ -921,14 +923,15 @@ diffstat=`git config --bool guilt.diffst
30 # The following gets run every time this file is source'd
31 #
32
33-
34 # GUILT_DIR="$GIT_DIR/patches"
35 if [ -z "$GUILT_BASE" ]; then
36 GUILT_BASE=wrs
37 fi
38 GUILT_DIR="$GUILT_BASE/patches"
39
40-branch=`get_branch`
41+if [ -z "$DO_NOT_USE_GITREPO_COMMANDS" ]; then
42+ branch=`get_branch`
43+fi
44
45 # most of the time we want to verify that the repo's branch has been
46 # initialized, but every once in a blue moon (e.g., we want to run guilt-init),
diff --git a/meta/packages/guilt/files/optional_head_check.patch b/meta/packages/guilt/files/optional_head_check.patch
new file mode 100644
index 0000000000..368d63b6ab
--- /dev/null
+++ b/meta/packages/guilt/files/optional_head_check.patch
@@ -0,0 +1,58 @@
1guilt: allow guilt-push to opt out of head checking
2
3Depending on the method used to construct a tree, it is entirely
4possible that branches are not only made up of guilt created commits.
5This mixed mode is valid, and in particular is valid when applying
6patches to a tree.
7
8In the default mode of operation, you will see a warning such as
9this when working on a branch:
10
11Expected HEAD commit dbd5861f81a92b8b329561f94b8575c7ee6768b6
12 got 3e8e6f6bd9f1772b91fc1fe9949f541d0560b487
13
14This looks severe, but is harmless during tree construction,
15since even if the HEAD commit was expected, you can still run into
16issues pushing a patch. This is particularly seen when templates are
17adding patches to a kernel.
18
19To make this look less ominous, we make the head check for patch
20pushing opt-in. Which means that by default, you'll no longer see
21this warning if you work with a mixed mode branch during tree
22construction.
23
24Other modes such as pop or refresh can run into problems when
25the HEAD commit isn't tracked or expected, so they should remained
26checked.
27
28Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
29
30---
31 guilt | 3 +++
32 guilt-push | 3 +++
33 2 files changed, 6 insertions(+)
34
35--- a/guilt
36+++ b/guilt
37@@ -417,6 +417,9 @@ head_check()
38 return 0 ;;
39 esac
40
41+ # If do_head_check isn't set, bail, we are "opt-in"
42+ [ -z "$do_head_check" ] && return 0
43+
44 if [ "`git rev-parse refs/heads/$branch`" != "`git rev-parse $1`" ]; then
45 disp "Expected HEAD commit $1" >&2
46 disp " got `git rev-parse refs/heads/$branch`" >&2
47--- a/guilt-push
48+++ b/guilt-push
49@@ -23,6 +23,9 @@ while [ $# -gt 0 ]; do
50 tag=$2
51 shift
52 ;;
53+ --head_check)
54+ do_head_check=t
55+ ;;
56 *)
57 break
58 ;;
diff --git a/meta/packages/guilt/files/uninstall_force.patch b/meta/packages/guilt/files/uninstall_force.patch
new file mode 100644
index 0000000000..8c9067dd46
--- /dev/null
+++ b/meta/packages/guilt/files/uninstall_force.patch
@@ -0,0 +1,12 @@
1guilt: force removal when uninstalling
2
3Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
4
5--- a/uninstall.orig
6+++ b/uninstall
7@@ -12,4 +12,4 @@
8
9 shift
10
11-(cd $PRE; rm "$@")
12+(cd $PRE; rm -f "$@")
diff --git a/meta/packages/guilt/guilt-native_0.33.bb b/meta/packages/guilt/guilt-native_0.33.bb
new file mode 100644
index 0000000000..62d91f6953
--- /dev/null
+++ b/meta/packages/guilt/guilt-native_0.33.bb
@@ -0,0 +1,30 @@
1DESCRIPTION = "guilt is quilt like tool for git"
2LICENSE = "GPL"
3
4PR = r0
5PV = "0.33"
6
7inherit native
8
9SRC_URI = "http://www.kernel.org/pub/linux/kernel/people/jsipek/guilt/guilt-${PV}.tar.gz\
10 file://guilt-push.patch \
11 file://guilt-pop.patch \
12 file://guilt.patch \
13 file://guilt-init.patch \
14 file://guilt-import-commit.patch \
15 file://uninstall_force.patch \
16 file://guilt-push-no-series.patch \
17 file://make_git_commands_conditional.patch \
18 file://improve_auto_header_gen.patch \
19 file://guilt-set-git_exec_path.patch \
20 file://guilt-bash.patch \
21 file://optional_head_check.patch"
22
23# we don't compile, we just install
24do_compile() {
25 :
26}
27
28do_install() {
29 oe_runmake PREFIX=${D}/${base_prefix}/usr install
30} \ No newline at end of file