From patchwork Thu May 28 14:51:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 49118 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6B0AD202A3 for ; Thu, 28 May 2015 14:51:27 +0000 (UTC) Received: by wgez8 with SMTP id z8sf10733444wge.2 for ; Thu, 28 May 2015 07:51:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=N9Oy0EPWTEvAjStifkZvWRItwYMh+WI8bEd+O250U1k=; b=l2PgyxGAUZX9Le/txMZNPR9ugiR3WbeEd/Tiq+IDEucq9qSAPd5D9aOPwAxorrEImY yEtNw1H4WzcX1O4lHnhDrW0XYnrKTzOth9uiMxswbXrEq4expl8nXvibEIcZ0SbB7SY0 WTLrlPESkplZTaXoNvw29eA6dxcJHZRwbSBc+NOFRYyRndEHUasEMkO5LiqOPM4FrBzU DxUdX5Wk5F/u+lfyX2shjANpKrGVP0KpxMdcTgZ3DYTwp56x2gWzGSQH9mgFLqD898k1 VeXp3XEHGcZlyr9swkiyvKJmKpyeSaLnC1BBnCbDD3aQtgn+0HCmZuy7yDGpIXyrNHKr ifmg== X-Gm-Message-State: ALoCoQnxi9NZ/OEPS9SB6FxyiaBPHYxXY6wnx2A64sWrPJjk6GVX3ohHaX70W6GLNZUH5UzLkaYx X-Received: by 10.112.148.101 with SMTP id tr5mr3055284lbb.13.1432824686674; Thu, 28 May 2015 07:51:26 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.198 with SMTP id la6ls223879lac.91.gmail; Thu, 28 May 2015 07:51:26 -0700 (PDT) X-Received: by 10.112.139.130 with SMTP id qy2mr3257396lbb.33.1432824686454; Thu, 28 May 2015 07:51:26 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id cj8si2168730lad.8.2015.05.28.07.51.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 07:51:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by laat2 with SMTP id t2so33858529laa.1 for ; Thu, 28 May 2015 07:51:26 -0700 (PDT) X-Received: by 10.153.6.36 with SMTP id cr4mr3333337lad.56.1432824686001; Thu, 28 May 2015 07:51:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1218532lbb; Thu, 28 May 2015 07:51:25 -0700 (PDT) X-Received: by 10.55.41.166 with SMTP id p38mr5774991qkp.93.1432824684544; Thu, 28 May 2015 07:51:24 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id a3si853610qga.120.2015.05.28.07.51.23; Thu, 28 May 2015 07:51:24 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id A732661EEB; Thu, 28 May 2015 14:51:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id BE73161EE5; Thu, 28 May 2015 14:51:19 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 493A561EE8; Thu, 28 May 2015 14:51:16 +0000 (UTC) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by lists.linaro.org (Postfix) with ESMTPS id 3F3CB61EE5 for ; Thu, 28 May 2015 14:51:15 +0000 (UTC) Received: by lbcue7 with SMTP id ue7so30035058lbc.0 for ; Thu, 28 May 2015 07:51:13 -0700 (PDT) X-Received: by 10.112.130.129 with SMTP id oe1mr3173036lbb.37.1432824673528; Thu, 28 May 2015 07:51:13 -0700 (PDT) Received: from erachmi-VirtualBox.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by mx.google.com with ESMTPSA id xs12sm602524lac.16.2015.05.28.07.51.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 May 2015 07:51:12 -0700 (PDT) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org Date: Thu, 28 May 2015 16:51:01 +0200 Message-Id: <1432824661-3586-1-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCH] apply-and-build.sh: fixing cover-letter issue X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christophe.milard@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 When an empty patch (such as a cover letter) was given to apply-and-build, the latter would fail applying the patch and all following patches (saying OK when it could be wrong) Signed-off-by: Christophe Milard --- apply-and-build.sh | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/apply-and-build.sh b/apply-and-build.sh index e41c297..683a0b6 100755 --- a/apply-and-build.sh +++ b/apply-and-build.sh @@ -152,26 +152,40 @@ apply_patch() { echo " Trying to apply patch" git am ${patch} >> ${logfile_basename}-am.log 2>&1 - egrep "^Patch failed at" ${logfile_basename}-am.log > /dev/null - if [ $? -eq 0 ]; then + if [ $? -ne 0 ]; then + #git am is unsuccessfull, because of a apply failure or empty patch cat ${logfile_basename}-am.log - git am --abort || exit 1 - git checkout . || exit 1 - git clean -xdf || exit 1 - git am --3way ${patch} >> ${logfile_basename}-am-3way.log 2>&1 - egrep "^Patch failed at" ${logfile_basename}-am-3way.log > /dev/null + egrep "^Patch failed at" ${logfile_basename}-am.log > /dev/null if [ $? -eq 0 ]; then - cat ${logfile_basename}-am-3way.log - echo " Error: Patch failed to apply" + #apply failure: clean up and try 3way apply: git am --abort || exit 1 git checkout . || exit 1 git clean -xdf || exit 1 + git am --3way ${patch} >> ${logfile_basename}-am-3way.log 2>&1 + if [ $? -ne 0 ]; then + #even 3way apply failed: clean and give up + cat ${logfile_basename}-am-3way.log + echo " Error: Patch failed to apply" + git am --abort || exit 1 + git checkout . || exit 1 + git clean -xdf || exit 1 + popd > /dev/null + continue + else + #3way apply worked + echo " Warning: git am --3way, applied" + fi + else + #git am unsuccessful but no "Patch failed at" in output: + echo " Warning: Patch could not apply, but did not fail (empty patch? cover-letter?): skipping it..." + git am --abort #to be on the safe side, but probably unsuccessful. + git checkout . || exit 1 + git clean -xdf || exit 1 popd > /dev/null continue - else - echo " Warning: git am --3way, applied" fi else + #patch successfully applied: echo " Patch applied" egrep "^warning:" ${logfile_basename}-am.log > /dev/null if [ $? -eq 0 ]; then