ntpd: update to 4.2.8p11
[feed/packages.git] / .travis_do.sh
index 3c39aeed3473b6c66b21a8e506dbc2520af36931..e2dae41e2c8165c1515a11981434d6c9fb735e86 100755 (executable)
@@ -6,7 +6,7 @@ set -e
 
 SDK_HOME="$HOME/sdk"
 SDK_PATH=https://downloads.lede-project.org/snapshots/targets/ar71xx/generic/
-SDK=lede-sdk-ar71xx-generic_gcc-5.4.0_musl.Linux-x86_64
+SDK=openwrt-sdk-ar71xx-generic_gcc-5.5.0_musl.Linux-x86_64
 PACKAGES_DIR="$PWD"
 
 echo_red()   { printf "\033[1;31m$*\033[m\n"; }
@@ -67,8 +67,14 @@ download_sdk() {
 # test_package will run on the `script` step.
 # test_package call make download check for very new/modified package
 test_packages2() {
+       local commit_range=$TRAVIS_COMMIT_RANGE
+       if [ -z "$TRAVIS_PULL_REQUEST_SHA" ]; then
+               echo_blue "Using only the latest commit, since we're not in a Pull Request"
+               commit_range=HEAD~1
+       fi
+
        # search for new or modified packages. PKGS will hold a list of package like 'admin/muninlite admin/monit ...'
-       PKGS=$(git diff --diff-filter=d --name-only "$TRAVIS_COMMIT_RANGE" | grep 'Makefile$' | grep -v '/files/' | awk -F'/Makefile' '{ print $1 }')
+       PKGS=$(git diff --diff-filter=d --name-only "$commit_range" | grep 'Makefile$' | grep -v '/files/' | awk -F'/Makefile' '{ print $1 }')
 
        if [ -z "$PKGS" ] ; then
                echo_blue "No new or modified packages found!"
@@ -107,8 +113,8 @@ EOF
                pkg_name=$(echo "$pkg_dir" | awk -F/ '{ print $NF }')
                echo_blue "=== $pkg_name: Starting quick tests"
 
-               exec_status 'WARNING|ERROR' make "package/$pkg_name/download" V=s || RET=1
-               exec_status 'WARNING|ERROR' make "package/$pkg_name/check" V=s || RET=1
+               exec_status '^ERROR' make "package/$pkg_name/download" V=s || RET=1
+               exec_status '^ERROR' make "package/$pkg_name/check" V=s || RET=1
 
                echo_blue "=== $pkg_name: quick tests done"
        done
@@ -142,6 +148,10 @@ EOF
 
 test_commits() {
        RET=0
+       if [ -z "$TRAVIS_PULL_REQUEST_SHA" ]; then
+               echo_blue "Skipping commits tests (not in a Pull Request)"
+               return 0
+       fi
        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
@@ -158,7 +168,7 @@ test_commits() {
                fi
 
                subject="$(git show -s --format=%s $commit)"
-               if echo "$subject" | grep -q -e '^[0-9A-Za-z,/-]\+: ' -e '^Revert '; then
+               if echo "$subject" | grep -q -e '^[0-9A-Za-z,/_-]\+: ' -e '^Revert '; then
                        echo_green "Commit subject line seems ok ($subject)"
                else
                        echo_red "Commit subject line MUST start with '<package name>: ' ($subject)"
@@ -186,20 +196,16 @@ echo_blue "=== Travis ENV"
 env
 echo_blue "=== Travis ENV"
 
-while true; do
-       # if clone depth is too small, git rev-list / diff return incorrect or empty results
-       C="$(git rev-list ${TRAVIS_COMMIT_RANGE/.../..} | tail -n1)" 2>/dev/null
-       [ -n "$C" -a "$C" != "a22de9b74cf9579d1ce7e6cf1845b4afa4277b00" ] && break
-       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
+if [ -n "$TRAVIS_PULL_REQUEST_SHA" ]; then
+       while true; do
+               # if clone depth is too small, git rev-list / diff return incorrect or empty results
+               C="$(git rev-list ${TRAVIS_COMMIT_RANGE/.../..} | tail -n1)" 2>/dev/null
+               [ -n "$C" -a "$C" != "a22de9b74cf9579d1ce7e6cf1845b4afa4277b00" ] && break
+               echo_blue "Fetching 50 commits more"
+               git fetch origin --deepen=50
+       done
 fi
 
-
 if [ $# -ne 1 ] ; then
        cat <<EOF
 Usage: $0 (download_sdk|test_packages)