aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Roxell <anders.roxell@linaro.org>2015-01-03 14:16:05 +0100
committerAnders Roxell <anders.roxell@linaro.org>2015-01-03 14:18:17 +0100
commitabeec3308a68fda82e4bd8cba3314327a0e08c37 (patch)
treed5fa16c9bf2c89032a5a16c282295eaa3b7eefb6
parent652bdc4eb93832b1f252619a296d8a311ede0531 (diff)
apply-and-build: restructure the format patch part
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
-rwxr-xr-xapply-and-build.sh30
1 files changed, 19 insertions, 11 deletions
diff --git a/apply-and-build.sh b/apply-and-build.sh
index c44e690..f37171e 100755
--- a/apply-and-build.sh
+++ b/apply-and-build.sh
@@ -158,6 +158,23 @@ apply_patch() {
popd > /dev/null
}
+format_patch() {
+ pushd ${1} > /dev/null
+ logfile_basename=$2
+
+ # Create patch to use in CHECKFORMAT and CHECKPATCH
+ git format-patch -1 > /dev/null
+
+ if [[ ${CHECKFORMAT} -eq 1 ]]; then
+ file 0001-*.patch > ${logfile_basename}-checkformat.log 2>&1
+ cat ${logfile_basename}-checkformat.log | grep "ASCII" > /dev/null 2>&1
+ [[ $? -eq 0 ]] && rm ${logfile_basename}-checkformat.log
+ fi
+ [[ -f ${logfile_basename}-checkformat.log ]] && cat ${logfile_basename}-checkformat.log | tee -a ${SUMMARY_LOG}
+
+ popd > /dev/null
+}
+
if [ ! -d ${PATCH_DIR} ]; then
echo "PATCH_DIR is invalid ${PATCH_DIR}"
@@ -184,18 +201,9 @@ for patch in $(find $PATCH_DIR -type f -iregex "${FILE_EXT_REGEX}" |sort -h); do
echo -e "\n\nUsing patch: $(basename ${patch})" | tee -a ${SUMMARY_LOG}
apply_patch ${ODP_BUILDDIR} ${CURRENT_LOG}
- pushd ${ODP_BUILDDIR} > /dev/null
-
- # Create patch to use in CHECKFORMAT and CHECKPATCH
- git format-patch -1 > /dev/null
-
- if [[ ${CHECKFORMAT} -eq 1 ]]; then
- file 0001-*.patch > ${CURRENT_LOG}-checkformat.log 2>&1
- cat ${CURRENT_LOG}-checkformat.log | grep "ASCII" > /dev/null 2>&1
- [[ $? -eq 0 ]] && rm ${CURRENT_LOG}-checkformat.log
- fi
- [[ -f ${CURRENT_LOG}-checkformat.log ]] && cat ${CURRENT_LOG}-checkformat.log | tee -a ${SUMMARY_LOG}
+ 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