From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 0D6E9E00C89; Wed, 23 Mar 2016 03:36:52 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id B7246E00B46 for ; Wed, 23 Mar 2016 03:36:33 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP; 23 Mar 2016 03:36:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,382,1455004800"; d="scan'208";a="943320675" Received: from linux.intel.com ([10.23.219.25]) by fmsmga002.fm.intel.com with ESMTP; 23 Mar 2016 03:36:33 -0700 Received: from vmed.fi.intel.com (vmed.fi.intel.com [10.237.72.51]) by linux.intel.com (Postfix) with ESMTP id 6F9A86A4002 for ; Wed, 23 Mar 2016 04:24:16 -0700 (PDT) From: Ed Bartosh To: toaster@yoctoproject.org Date: Wed, 23 Mar 2016 10:15:17 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [PATCH v6 26/41] buildinfohelper: Add handler for cancelling a build X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Mar 2016 10:36:52 -0000 From: Michael Wood When a build is cancelled the build (action) is complete if it has been caused the request being cancelled then update the build outcome accordingly. Signed-off-by: Michael Wood Signed-off-by: Ed Bartosh --- bitbake/lib/bb/ui/buildinfohelper.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 430061d..406f608 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py @@ -215,6 +215,15 @@ class ORMWrapper(object): assert isinstance(errors, int) assert isinstance(warnings, int) + if build.outcome == Build.CANCELLED: + return + try: + if build.buildrequest.state == BuildRequest.REQ_CANCELLING: + return + except AttributeError: + # We may not have a buildrequest if this is a command line build + pass + outcome = Build.SUCCEEDED if errors or taskfailures: outcome = Build.FAILED @@ -1389,9 +1398,17 @@ class BuildInfoHelper(object): be.lock = BuildEnvironment.LOCK_LOCK be.save() br = BuildRequest.objects.get(pk = br_id) + + # if we're 'done' because we got cancelled update the build outcome + if br.state == BuildRequest.REQ_CANCELLING: + logger.info("Build cancelled") + br.build.outcome = Build.CANCELLED + br.build.save() + errorcode = 0 + if errorcode == 0: # request archival of the project artifacts - br.state = BuildRequest.REQ_ARCHIVE + br.state = BuildRequest.REQ_COMPLETED else: br.state = BuildRequest.REQ_FAILED br.save() -- 2.1.4