2015-11-18 13:36:51 +01:00
|
|
|
#!/usr/bin/env bash
|
2014-11-26 11:12:46 +01:00
|
|
|
#
|
2015-02-08 18:51:25 +01:00
|
|
|
# Copyright (C) 2014 Martine Lenders <mlenders@inf.fu-berlin.de>
|
2014-11-26 11:12:46 +01:00
|
|
|
#
|
|
|
|
# This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
# General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
# directory for more details.
|
|
|
|
#
|
|
|
|
|
2018-06-05 17:06:11 +02:00
|
|
|
: "${RIOTBASE:=$(cd $(dirname $0)/../../../; pwd)}"
|
|
|
|
cd $RIOTBASE
|
|
|
|
|
|
|
|
: "${RIOTTOOLS:=${RIOTBASE}/dist/tools}"
|
2018-03-22 17:21:09 +01:00
|
|
|
. "${RIOTTOOLS}"/pr_check/check_labels.sh
|
2014-11-26 11:12:46 +01:00
|
|
|
|
2018-06-05 17:06:11 +02:00
|
|
|
EXIT_CODE=0
|
|
|
|
|
2014-11-26 11:12:46 +01:00
|
|
|
if tput colors &> /dev/null && [ $(tput colors) -ge 8 ]; then
|
|
|
|
CERROR="\e[1;31m"
|
|
|
|
CRESET="\e[0m"
|
|
|
|
else
|
|
|
|
CERROR=
|
|
|
|
CRESET=
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ${#} -eq 1 ]]; then
|
|
|
|
RIOT_MASTER="${1}"
|
|
|
|
else
|
|
|
|
RIOT_MASTER="master"
|
|
|
|
fi
|
|
|
|
|
2014-12-03 12:29:30 +01:00
|
|
|
SQUASH_COMMITS="$(git log $(git merge-base HEAD "${RIOT_MASTER}")...HEAD --pretty=format:" %h %s" | \
|
2017-11-13 15:48:52 +01:00
|
|
|
grep -i -e "^ [0-9a-f]\+ .\{0,2\}SQUASH" -e "^ [0-9a-f]\+ .\{0,2\}FIX")"
|
2014-11-26 11:12:46 +01:00
|
|
|
|
|
|
|
if [ -n "${SQUASH_COMMITS}" ]; then
|
|
|
|
echo -e "${CERROR}Pull request needs squashing:${CRESET}" 1>&2
|
|
|
|
echo -e "${SQUASH_COMMITS}"
|
|
|
|
EXIT_CODE=1
|
|
|
|
fi
|
|
|
|
|
2016-03-12 00:54:43 +01:00
|
|
|
if [ -n "$TRAVIS_PULL_REQUEST" -o -n "$CI_PULL_NR" ]; then
|
2018-10-05 19:07:32 +02:00
|
|
|
if check_gh_label "CI: needs squashing"; then
|
2015-05-18 11:51:58 +02:00
|
|
|
echo -e "${CERROR}Pull request needs squashing according to its labels set on GitHub${CRESET}"
|
2014-11-26 11:12:46 +01:00
|
|
|
EXIT_CODE=1
|
|
|
|
fi
|
|
|
|
|
2018-10-05 19:07:32 +02:00
|
|
|
if check_gh_label "State: waiting for other PR"; then
|
2015-05-18 11:51:58 +02:00
|
|
|
echo -e "${CERROR}Pull request is waiting for another pull request according to its labels set on GitHub${CRESET}"
|
2014-11-26 11:12:46 +01:00
|
|
|
EXIT_CODE=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-05-16 11:31:32 +02:00
|
|
|
if git grep -q PKG_SOURCE_LOCAL -- pkg/*/Makefile; then
|
|
|
|
echo -e "${CERROR}The following files contain a PKG_SOURCE_LOCAL definition:${CRESET}"
|
|
|
|
git grep -l PKG_SOURCE_LOCAL -- pkg/*/Makefile
|
|
|
|
EXIT_CODE=1
|
|
|
|
fi
|
|
|
|
|
2014-11-26 11:12:46 +01:00
|
|
|
exit ${EXIT_CODE}
|