}
# test_package will run on the `script` step.
-# test_package call make download check for very new/modified package in it's
-# own clean sdk directory
-test_packages() {
+# test_package call make download check for very new/modified package
+test_packages2() {
# search for new or modified packages. PKGS will hold a list of package like 'admin/muninlite admin/monit ...'
- PKGS=$(git diff --name-only "$TRAVIS_COMMIT_RANGE" | grep 'Makefile$' | grep -v '/files/' | awk -F'/Makefile' '{ print $1 }')
+ PKGS=$(git diff --diff-filter=d --name-only "$TRAVIS_COMMIT_RANGE" | grep 'Makefile$' | grep -v '/files/' | awk -F'/Makefile' '{ print $1 }')
if [ -z "$PKGS" ] ; then
- echo_blue "No new or modified packages found!" >&2
- exit 0
+ echo_blue "No new or modified packages found!"
+ return 0
fi
echo_blue "=== Found new/modified packages:"
echo_blue "=== $pkg_name Finished package"
done
- exit $RET
+ return $RET
+}
+
+test_commits() {
+ RET=0
+ for commit in $(git rev-list ${TRAVIS_COMMIT_RANGE/.../..}); do
+ echo_blue "=== Checking commit '$commit'"
+ if git show --format='%P' -s $commit | grep -qF ' '; then
+ echo_red "Pull request should not include merge commits"
+ RET=1
+ fi
+
+ author="$(git show -s --format=%aN $commit)"
+ if echo $author | grep -q '\S\+\s\+\S\+'; then
+ echo_green "Author name ($author) seems ok"
+ else
+ echo_red "Author name ($author) need to be your real name 'firstname lastname'"
+ RET=1
+ fi
+
+ subject="$(git show -s --format=%s $commit)"
+ if echo "$subject" | grep -q '^[0-9A-Za-z,/-]\+: '; then
+ echo_green "Commit subject line seems ok ($subject)"
+ else
+ echo_red "Commit subject line MUST start with '<package name>: ' ($subject)"
+ RET=1
+ fi
+
+ body="$(git show -s --format=%b $commit)"
+ sob="$(git show -s --format='Signed-off-by: %aN <%aE>' $commit)"
+ if echo "$body" | grep -qF "$sob"; then
+ echo_green "Signed-off-by match author"
+ else
+ echo_red "Signed-off-by is missing or doesn't match author (should be '$sob')"
+ RET=1
+ fi
+ done
+
+ return $RET
+}
+
+test_packages() {
+ GRET=0
+ test_commits || GRET=1
+ test_packages2 || GRET=1
+ return $GRET
}
echo_blue "=== Travis ENV"
env
echo_blue "=== Travis ENV"
+until [ "$(git rev-list ${TRAVIS_COMMIT_RANGE/.../..} | tail -n1)" != "a22de9b74cf9579d1ce7e6cf1845b4afa4277b00" ]; do
+ # if clone depth is too small, git rev-list / diff return incorrect results
+ echo_blue "Fetching 50 commits more"
+ git fetch origin --deepen=50
+done
+
if [ "$TRAVIS_PULL_REQUEST" = false ] ; then
echo "Only Pull Requests are supported at the moment." >&2
exit 0