aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Roxell <anders.roxell@linaro.org>2015-01-03 14:16:28 +0100
committerAnders Roxell <anders.roxell@linaro.org>2015-01-03 14:18:30 +0100
commit98caac9a1c50f349a5ede96c3682d85351e44ded (patch)
tree3bded0b112e3890c169132ecaac855e71d1251f6
parentabeec3308a68fda82e4bd8cba3314327a0e08c37 (diff)
apply-and-build: restructure the check patch part
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
-rwxr-xr-xapply-and-build.sh26
1 files changed, 15 insertions, 11 deletions
diff --git a/apply-and-build.sh b/apply-and-build.sh
index f37171e..54e0dde 100755
--- a/apply-and-build.sh
+++ b/apply-and-build.sh
@@ -175,6 +175,20 @@ format_patch() {
popd > /dev/null
}
+check_patch() {
+ pushd ${1} > /dev/null
+ logfile_basename=$2
+
+ if [[ ${CHECKPATCH} -eq 1 ]]; then
+ ./scripts/checkpatch.pl 0001-*.patch > ${logfile_basename}-checkpatch.log 2>&1
+ tail -n 10 ${logfile_basename}-checkpatch.log | grep "total: 0 errors, 0 warnings" > /dev/null 2>&1
+ [[ $? -eq 0 ]] && rm ${logfile_basename}-checkpatch.log
+ fi
+ rm 0001-*.patch
+ [[ -f ${logfile_basename}-checkpatch.log ]] && cat ${logfile_basename}-checkpatch.log | tee -a ${SUMMARY_LOG}
+
+ popd > /dev/null
+}
if [ ! -d ${PATCH_DIR} ]; then
echo "PATCH_DIR is invalid ${PATCH_DIR}"
@@ -203,17 +217,7 @@ for patch in $(find $PATCH_DIR -type f -iregex "${FILE_EXT_REGEX}" |sort -h); do
format_patch ${ODP_BUILDDIR} ${CURRENT_LOG}
- pushd ${ODP_BUILDDIR} > /dev/null
-
- if [[ ${CHECKPATCH} -eq 1 ]]; then
- ./scripts/checkpatch.pl 0001-*.patch > ${CURRENT_LOG}-checkpatch.log 2>&1
- tail -n 10 ${CURRENT_LOG}-checkpatch.log | grep "total: 0 errors, 0 warnings" > /dev/null 2>&1
- [[ $? -eq 0 ]] && rm ${CURRENT_LOG}-checkpatch.log
- fi
- rm 0001-*.patch
- [[ -f ${CURRENT_LOG}-checkpatch.log ]] && cat ${CURRENT_LOG}-checkpatch.log | tee -a ${SUMMARY_LOG}
-
- popd > /dev/null
+ check_patch ${ODP_BUILDDIR} ${CURRENT_LOG}
echo " Building with patch" | tee -a ${SUMMARY_LOG}
build_test ${ODP_BUILDDIR} ${CURRENT_LOG}