On Fri, Aug 28, 2015 at 05:15:15PM +1000, Gavin Shan wrote: > This submits changes with formatted commit log while updating Linux > headers using scripts/update-linux-headers.sh. > > Signed-off-by: Gavin Shan <gws...@linux.vnet.ibm.com> > --- > scripts/update-linux-headers.sh | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh > index 18daabe..1be02b8 100755 > --- a/scripts/update-linux-headers.sh > +++ b/scripts/update-linux-headers.sh > @@ -63,6 +63,28 @@ cp_virtio() { > fi > } > > +submit_change() { > + from=$1 > + to=$2 > + if ! [ -e $to/include/qemu-common.h ]; then > + echo "$to not QEMU source directory, skip submitting changes" > + exit 3 > + fi > + > + version=$(make -C $from -s kernelversion) > + commit=$(cd $from && git log --oneline -1 | cut -d " " -f 1)
"git rev-parse HEAD" might be a simpler way to get the current commit id. > + subject="Synchronize Linux headers from kernel $version" > + message="Synchronize the Linux headers from kernel version $version" > + message=$(echo "$message\n(commit $commit)") Might be more readable to use the shell <<EOF syntax to construct the commit message. > + res=$(cd $to && git commit -qa -m "$subject" -m "$message" -s && echo $?) > + if [ "$res" = "0" ]; then > + echo "Changes submitted successfully" > + else > + echo "Error $res submitting changes" > + exit 4 > + fi > +} > + > # This will pick up non-directories too (eg "Kconfig") but we will > # ignore them in the next loop. > ARCHLIST=$(cd "$linux/arch" && echo *) > @@ -132,3 +154,5 @@ cat <<EOF > >$output/include/standard-headers/linux/if_ether.h > EOF > > rm -rf "$tmpdir" > + > +submit_change "$linux" "$output" Obviously this will fail if you run it against an exported qemu source tree, instead of a git tree. I'm not sure if that's a problem. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
pgpIsmEShmWFM.pgp
Description: PGP signature