// one switch to enable git mbox patches
time rpmbuild -bp   --nodeps --define 'dist .el7.centos' --define 'grublib /usr/lib/grub' --with scmgit grub.spec

// when project builds, but errs in packaging, use --with reuse
time rpmbuild -ba  --with reuse --nodeps --define 'dist .el7.centos' --with grbextra --with scmgit grub2.spec 

// to launch the SRPM in mock
time mock -r epel-7-x86_64 --no-clean --with scmgit --with grbextra --define 'dist .el7.centos' --define 'grublib /usr/lib/grub' --resultdir=~/mock grub2-2.02-0.37.el7.centos.src.rpm > mkgrub.out

// perl renamer
rename 's/(.*)/xen_$1/' *.patch

# write the last 4 commits up to HEAD into the above dir
git format-patch --cover-letter -4 HEAD -M master -o ../outgoing/

# similar as above but use a rev range
git format-patch --cover-letter 4.6.0-rc4..HEAD -M master -o ../outgoing/

# remove trailing ws
sed -i  's/[[:space:]]*$//'

