projects
/
hvutilities.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
hvsp: allow to specify end commit as a label
[hvutilities.git]
/
scripts
/
kernel-send-patches.sh
diff --git
a/scripts/kernel-send-patches.sh
b/scripts/kernel-send-patches.sh
index
daf7708
..
c41886b
100755
(executable)
--- a/
scripts/kernel-send-patches.sh
+++ b/
scripts/kernel-send-patches.sh
@@
-53,23
+53,31
@@
compile_cmd="make"
compile_script=/tmp/kernel-compile-script.sh
cover="no"
series=""
compile_script=/tmp/kernel-compile-script.sh
cover="no"
series=""
+resend="no"
+GIT_FORMAT_PATCH_SUBJECT="PATCH"
+skip_compile=0
print_usage()
{
echo "${PROG_NAME} -- Envoi de patches linux kernel"
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
echo "Options:"
+ echo " -d resend patch"
echo " -e end commit (string)"
echo " -f folder containing patch infos"
echo " -h display this help and exit"
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
}
echo " -r really send emails (default = dry-run)"
echo " -s start commit (string)"
echo
}
-while getopts "
e:f:h
rs:" flag ;do
+while getopts "
de:f:hn
rs:" flag ;do
case ${flag} in
case ${flag} in
+ d)
+ resend="yes"
+ ;;
e)
commit_end="${OPTARG}"
;;
e)
commit_end="${OPTARG}"
;;
@@
-80,6
+88,9
@@
while getopts "e:f:hrs:" flag ;do
print_usage
exit 0
;;
print_usage
exit 0
;;
+ n)
+ skip_compile=1
+ ;;
r)
DRY_RUN=""
;;
r)
DRY_RUN=""
;;
@@
-156,9
+167,11
@@
if [ x"${base_branch}" = x"" ]; then
exit 1
fi
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
fi
if [ x"${base_commit}" = x"" ]; then
@@
-171,6
+184,16
@@
find_commit_by_log()
echo $(git log --oneline HEAD~100..HEAD | grep "${1}" | awk {'print $1'})
}
echo $(git log --oneline HEAD~100..HEAD | grep "${1}" | awk {'print $1'})
}
+# Find SHA1 of preceding commit:
+# First arg: commit message
+find_preceding_commit_by_log()
+{
+ local sha1_end
+
+ sha1_end="$(find_commit_by_log "${1}")"
+ echo $(git log --oneline ${sha1_end}~2..${sha1_end}~1 | awk {'print $1'})
+}
+
# Remove "Name" if present in email address. Needed because of a bug in
# get_maintainer.pl even if we specify the "--non" option.
# Arg #1: "Name <email>" or "email"
# Remove "Name" if present in email address. Needed because of a bug in
# get_maintainer.pl even if we specify the "--non" option.
# Arg #1: "Name <email>" or "email"
@@
-232,6
+255,11
@@
if [ x"${COMMIT_END_SHA1}" = x"" ]; then
exit 1
fi
exit 1
fi
+if echo "${commit_end}" | grep -q "^end"; then
+ # Take commit just before end commit:
+ COMMIT_END_SHA1=$(find_preceding_commit_by_log "${commit_end}")
+fi
+
rm -rf ${srcdir}/*.patch
# If the cover letter is not between start and end commits, save a copy:
rm -rf ${srcdir}/*.patch
# If the cover letter is not between start and end commits, save a copy:
@@
-271,7
+299,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_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:
if [ x"${cover}" = x"yes" ]; then
# Replace subject line in cover letter:
@@
-301,7
+334,8
@@
for p in ${srcdir}/*.patch; do
fi
done
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
#!/bin/bash
# Do not edit, auto-generated script
echo
@@
-310,34
+344,37
@@
echo "Testing commit: $(git log --oneline | head -n 1)"
COMPILE_CMD
EOF
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}
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 \
# Send email(s)
git send-email ${DRY_RUN} --annotate --thread --no-chain-reply-to \