X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;ds=sidebyside;f=scripts%2Fkernel-send-patches.sh;h=13a1ec042cc6cd78a4fb719f5759a589d340930b;hb=d3b7636e6374ce603f2d8d17337f0c43b4145517;hp=10d93efd42f8d66e6413ac32144f35566b704217;hpb=6c556b2fa0d393a0da58ac8bb7273dc834b51e34;p=hvutilities.git diff --git a/scripts/kernel-send-patches.sh b/scripts/kernel-send-patches.sh index 10d93ef..13a1ec0 100755 --- a/scripts/kernel-send-patches.sh +++ b/scripts/kernel-send-patches.sh @@ -53,13 +53,16 @@ compile_cmd="make" compile_script=/tmp/kernel-compile-script.sh cover="no" series="" +resend="no" +GIT_FORMAT_PATCH_SUBJECT="PATCH" print_usage() { echo "${PROG_NAME} -- Envoi de patches linux kernel" - echo "Usage: ${PROG_NAME} [OPTIONS...] COMMIT_START COMMIT_END" + echo "Usage: ${PROG_NAME} [OPTIONS...]" echo echo "Options:" + echo " -d resend patch" echo " -e end commit (string)" echo " -f folder containing patch infos" echo " -h display this help and exit" @@ -68,8 +71,11 @@ print_usage() echo } -while getopts "e:f:hrs:" flag ;do +while getopts "de:f:hrs:" flag ;do case ${flag} in + d) + resend="yes" + ;; e) commit_end="${OPTARG}" ;; @@ -156,6 +162,11 @@ if [ x"${base_branch}" = x"" ]; then exit 1 fi +if [ x"${compile_branch}" = x"" ]; then + echo "Missing compile_branch shell variable" + exit 1 +fi + if [ x"${base_commit}" = x"" ]; then base_commit="auto" fi @@ -232,14 +243,12 @@ rm -rf ${srcdir}/*.patch # If the cover letter is not between start and end commits, save a copy: cp ${srcdir}/cover-letter.txt /tmp -patches_branch="kernel_send_patches" +patches_branch="hv_send_patches_$(basename ${srcdir})" if [ x"${series}" != x"" ]; then patches_branch="${patches_branch}_v${series}" fi -patches_branch="${patches_branch}_$(basename ${srcdir})" - orig_branch=$(git branch --show-current) if [ x"${orig_branch}" = x"" ]; then @@ -268,7 +277,12 @@ if [ x"${series}" != x"" -a x"${series}" != x"1" ]; then GIT_FORMAT_PATCH_OPTS="${GIT_FORMAT_PATCH_OPTS} -v ${series}" fi -git format-patch ${GIT_FORMAT_PATCH_OPTS} --output-directory=${srcdir} ${base_branch} +if [ x"${resend}" = x"yes" ]; then + GIT_FORMAT_PATCH_SUBJECT="RESEND ${GIT_FORMAT_PATCH_SUBJECT}" +fi + +git format-patch --subject-prefix="${GIT_FORMAT_PATCH_SUBJECT}" \ + ${GIT_FORMAT_PATCH_OPTS} --output-directory=${srcdir} ${base_branch} if [ x"${cover}" = x"yes" ]; then # Replace subject line in cover letter: @@ -313,11 +327,29 @@ fi sed -i -e "s@COMPILE_CMD@${compile_cmd}@" ${compile_script} chmod u+x ${compile_script} -# Compile each commit. Create branch to avoid "detached HEAD" state, and also to -# keep a record of what was sent: -git rebase --exec=${compile_script} ${base_branch} +# Create temporary branch for compilation, based on compile_branch: +temp_compile_branch="${patches_branch}_compile" + +if git branch | grep -q ${temp_compile_branch}; then + git branch -D ${temp_compile_branch} +fi + +git checkout -b ${temp_compile_branch} ${compile_branch} + +# Make sure temp_compile_branch is rebased on base_branch: +git rebase ${base_branch} + +# Apply all of our commits to temp_compile_branch: +git cherry-pick ${COMMIT_START_SHA1}..${COMMIT_END_SHA1} + +# Compile and test each commit: +git rebase --exec=${compile_script} ${compile_branch} + git checkout ${orig_branch} +# Remove temporary branch: +git branch -D ${temp_compile_branch} + # Send email(s) git send-email ${DRY_RUN} --annotate --thread --no-chain-reply-to \ ${TO_OPTS} ${CC_OPTS} \