From 3e665862b84ad23b6866830725520834e9c2c6b3 Mon Sep 17 00:00:00 2001 From: Xin Pan Date: Mon, 26 Nov 2018 17:35:09 +0800 Subject: [PATCH] Protect important header files. test=develop --- paddle/fluid/framework/operator.h | 2 +- paddle/scripts/paddle_build.sh | 27 +++++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/paddle/fluid/framework/operator.h b/paddle/fluid/framework/operator.h index bfdfdc56b3..5bd68f9ac2 100644 --- a/paddle/fluid/framework/operator.h +++ b/paddle/fluid/framework/operator.h @@ -71,7 +71,7 @@ class OperatorBase; class ExecutionContext; /** - * OperatorBase has the basic element that Net will call to do computation. + * OperatorBase has the basic elements that Net will call to do computation. * Only CreateOperator from OpRegistry will new Operator directly. User * should always construct a proto message OpDesc and call * OpRegistry::CreateOp(op_desc) to get an Operator instance. diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 9632eaec00..0ab197a527 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -469,18 +469,21 @@ function assert_api_spec_approvals() { BRANCH="develop" fi - API_CHANGE=`git diff --name-only upstream/$BRANCH | grep "paddle/fluid/API.spec" || true` - echo "checking API.spec change, PR: ${GIT_PR_ID}, changes: ${API_CHANGE}" - if [ ${API_CHANGE} ] && [ "${GIT_PR_ID}" != "" ]; then - # NOTE: per_page=10000 should be ok for all cases, a PR review > 10000 is not human readable. - APPROVALS=`curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000 | \ - python ${PADDLE_ROOT}/tools/check_pr_approval.py 2 7845005 2887803 728699 13348433` - echo "current pr ${GIT_PR_ID} got approvals: ${APPROVALS}" - if [ "${APPROVALS}" == "FALSE" ]; then - echo "You must have at least 2 approvals for the api change!" - exit 1 - fi - fi + API_FILES=('paddle/fluid/API.spec' 'paddle/fluid/framework/operator.h') + for API_FILE in ${API_FILES}; do + API_CHANGE=`git diff --name-only upstream/$BRANCH | grep "${API_FILE}" || true` + echo "checking ${API_FILE} change, PR: ${GIT_PR_ID}, changes: ${API_CHANGE}" + if [ ${API_CHANGE} ] && [ "${GIT_PR_ID}" != "" ]; then + # NOTE: per_page=10000 should be ok for all cases, a PR review > 10000 is not human readable. + APPROVALS=`curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000 | \ + python ${PADDLE_ROOT}/tools/check_pr_approval.py 2 7845005 2887803 728699 13348433` + echo "current pr ${GIT_PR_ID} got approvals: ${APPROVALS}" + if [ "${APPROVALS}" == "FALSE" ]; then + echo "You must have at least 2 approvals for the api change! ${API_FILE}" + exit 1 + fi + fi + done } -- GitLab