summaryrefslogtreecommitdiff
path: root/tools/applymbox
blob: 5ac8d2b4dacb62633574d1ef00ab293701d79c1d (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
#!/bin/sh
##
## "dotest" is my stupid name for my patch-application script, which
## I never got around to renaming after I tested it. We're now on the
## second generation of scripts, still called "dotest".
##
## Update: Ryan Anderson finally shamed me into naming this "applymbox".
##
## You give it a mbox-format collection of emails, and it will try to
## apply them to the kernel using "applypatch"
##
## dotest [ -q ] mail_archive [Signoff_file]
##
rm -rf .dotest
mkdir .dotest
case $1 in
 
	-q)	touch .dotest/.query_apply
		shift;;
esac
mailsplit $1 .dotest || exit 1
for i in .dotest/*
do
	mailinfo .dotest/msg .dotest/patch < $i > .dotest/info || exit 1
	git-stripspace < .dotest/msg > .dotest/msg-clean
	applypatch .dotest/msg-clean .dotest/patch .dotest/info "$2"
	ret=$?
	if [ $ret -ne 0 ]; then
		# 2 is a special exit code from applypatch to indicate that
	    	# the patch wasn't applied, but continue anyway 
		[ $ret -ne 2 ] && exit $ret
	fi
done
# return to pristine
rm -fr .dotest