summaryrefslogtreecommitdiff
path: root/contrib.sh
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-04-26 21:37:37 -0400
committermidipix <writeonce@midipix.org>2016-04-28 17:30:28 -0400
commit61a679d71cd1dc35cf95bb4ded611468a9edad47 (patch)
tree3be30cf32daf531f9db7a0592aaffd71d56d8a40 /contrib.sh
parent3e7d5bf7bb66b14b327b6997b1793a6ceb3f8fc2 (diff)
downloadslibtool-61a679d71cd1dc35cf95bb4ded611468a9edad47.tar.bz2
slibtool-61a679d71cd1dc35cf95bb4ded611468a9edad47.tar.xz
project: added CONTRIB and contrib.sh.
Diffstat (limited to 'contrib.sh')
-rwxr-xr-xcontrib.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/contrib.sh b/contrib.sh
new file mode 100755
index 0000000..501b539
--- /dev/null
+++ b/contrib.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+# init vars
+commit=$1; [ -z "$commit" ] && commit='HEAD'
+blank=
+bline=
+fname=
+
+# source.patch
+git format-patch -1 $commit --stdout > source.patch || exit 2
+cat contrib.msg >> source.patch || exit 2
+
+# source.patch without the (noisy) first line
+tail -n +2 source.patch > contrib.patch || exit 2
+
+# contrib.patch: first blank line
+blank=`grep -n ^$ contrib.patch | head -n1`
+[ -z "$blank" ] && exit 2
+
+bline=`echo $blank | cut -f1 -d':'`
+[ -z "$bline" ] && exit 2
+
+# use sha256sum of the above for patch file name
+fname=`sha256sum contrib.patch | cut -f1 -d' '` || exit 2
+[ -z "$fname" ] && exit 2
+
+# prepare for submission, sign the patch
+mv contrib.patch $fname.patch || exit 2
+head -n$bline $fname.patch | tail -n +2 > $fname.sig || exit 2
+
+[ -z "$PAGER" ] && PAGER='less'
+$PAGER $fname.patch || exit 2
+cat contrib.msg || exit 2
+
+echo
+echo 'press <enter> to continue, <ctrl-c> to abort>'
+echo
+
+read enter
+
+gpg --armor --detach-sign $fname.patch || exit 2
+cat $fname.patch.asc >> $fname.sig || exit 2
+
+# verify
+gpg --verify $fname.sig $fname.patch || exit 2
+
+# clean up
+rm source.patch
+rm $fname.patch.asc
+
+# info
+echo
+echo "commit $commit was successfully prepared for submission."
+echo "$fname.patch: a patch file that can be imported by git-am."
+echo "$fname.sig: a gpg signature file of the above patch."
+echo
+
+# all done
+exit 0