From 464a8c26c891b8f2f1133ee141e81424de7d2da3 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Mon, 30 Oct 2023 16:06:11 -0400 Subject: [PATCH] hvsp: add skip compilation option --- scripts/kernel-send-patches.sh | 59 ++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/scripts/kernel-send-patches.sh b/scripts/kernel-send-patches.sh index 13a1ec0..b928b32 100755 --- a/scripts/kernel-send-patches.sh +++ b/scripts/kernel-send-patches.sh @@ -55,6 +55,7 @@ cover="no" series="" resend="no" GIT_FORMAT_PATCH_SUBJECT="PATCH" +skip_compile=0 print_usage() { @@ -66,12 +67,13 @@ print_usage() echo " -e end commit (string)" echo " -f folder containing patch infos" echo " -h display this help and exit" + echo " -n dot not compile patches" echo " -r really send emails (default = dry-run)" echo " -s start commit (string)" echo } -while getopts "de:f:hrs:" flag ;do +while getopts "de:f:hnrs:" flag ;do case ${flag} in d) resend="yes" @@ -86,6 +88,9 @@ while getopts "de:f:hrs:" flag ;do print_usage exit 0 ;; + n) + skip_compile=1 + ;; r) DRY_RUN="" ;; @@ -162,9 +167,11 @@ if [ x"${base_branch}" = x"" ]; then exit 1 fi -if [ x"${compile_branch}" = x"" ]; then - echo "Missing compile_branch shell variable" - exit 1 +if [ ${skip_compile} -eq 0 ]; then + if [ x"${compile_branch}" = x"" ]; then + echo "Missing compile_branch shell variable" + exit 1 + fi fi if [ x"${base_commit}" = x"" ]; then @@ -312,7 +319,8 @@ for p in ${srcdir}/*.patch; do fi done -cat > ${compile_script} << "EOF" +if [ ${skip_compile} -eq 0 ]; then + cat > ${compile_script} << "EOF" #!/bin/bash # Do not edit, auto-generated script echo @@ -321,34 +329,37 @@ echo "Testing commit: $(git log --oneline | head -n 1)" COMPILE_CMD EOF -if [ x"${init_cmd}" != x"" ]; then - sed -i -e "s@.*INIT_CMD@${init_cmd}@" ${compile_script} -fi -sed -i -e "s@COMPILE_CMD@${compile_cmd}@" ${compile_script} -chmod u+x ${compile_script} + if [ x"${init_cmd}" != x"" ]; then + sed -i -e "s@.*INIT_CMD@${init_cmd}@" ${compile_script} + fi + sed -i -e "s@COMPILE_CMD@${compile_cmd}@" ${compile_script} + chmod u+x ${compile_script} -# Create temporary branch for compilation, based on compile_branch: -temp_compile_branch="${patches_branch}_compile" + # 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 + if git branch | grep -q ${temp_compile_branch}; then + git branch -D ${temp_compile_branch} + fi -git checkout -b ${temp_compile_branch} ${compile_branch} + git checkout -b ${temp_compile_branch} ${compile_branch} -# Make sure temp_compile_branch is rebased on base_branch: -git rebase ${base_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} + # 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} + # Compile and test each commit: + git rebase --exec=${compile_script} ${compile_branch} +fi git checkout ${orig_branch} -# Remove temporary branch: -git branch -D ${temp_compile_branch} +if [ ${skip_compile} -eq 0 ]; then + # Remove temporary branch: + git branch -D ${temp_compile_branch} +fi # Send email(s) git send-email ${DRY_RUN} --annotate --thread --no-chain-reply-to \ -- 2.20.1