YETUS-1027. checkmake output is incorrect (#161)
diff --git a/precommit/src/main/shell/test-patch.d/checkmake.sh b/precommit/src/main/shell/test-patch.d/checkmake.sh
index 9c4316c..2f3d784 100755
--- a/precommit/src/main/shell/test-patch.d/checkmake.sh
+++ b/precommit/src/main/shell/test-patch.d/checkmake.sh
@@ -65,6 +65,7 @@
{
declare i
declare repostatus=$1
+ declare basefn="${PATCH_DIR}/${repostatus}-checkmake-result"
declare -a args
echo "Running checkmake against identified Makefiles."
@@ -80,12 +81,18 @@
if [[ ${i} =~ /Makefile$ ]] || [[ ${i} =~ ^Makefile$ ]]; then
if [[ -f ${i} ]]; then
while read -r; do
- echo "${i}:${REPLY}" >> "${PATCH_DIR}/${repostatus}-checkmake-result.txt"
+ echo "${i}:${REPLY}" >> "${basefn}.tmp"
done < <("${CHECKMAKE}" "${args[@]}" "${i}")
fi
fi
done
+ if [[ -f "$${basefn}.tmp" ]]; then
+ sort -k1,1 -k2,2n "${basefn}.tmp" \
+ > "${basefn}.text"
+ rm "${basefn}.tmp"
+ fi
+
popd >/dev/null || return 1
return 0
}
@@ -109,7 +116,7 @@
return 0
}
-## @description Wrapper to call column_calcdiffs
+## @description Wrapper to call error_calcdiffs
## @audience private
## @stability evolving
## @replaceable no
@@ -118,7 +125,7 @@
## @return differences
function checkmake_calcdiffs
{
- column_calcdiffs "$@"
+ error_calcdiffs "$@"
}
function checkmake_postapply
diff --git a/precommit/src/test/resources/Makefile b/precommit/src/test/resources/Makefile
new file mode 100644
index 0000000..472fd62
--- /dev/null
+++ b/precommit/src/test/resources/Makefile
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+.PHONY: all clean test
+
+all:
+
+clean:
+
+test: