summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-04-06 17:46:36 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-04-06 23:00:10 +0100
commitd94d12914d351bf560b06d6f4e45c294b04ecaa3 (patch)
tree3d2173cc1f349c2e51dad7ed1175f575f92a3ce8
parent449598c8e6be75bd0c9d59e7bdf859d1d6f83858 (diff)
downloadopenembedded-core-contrib-d94d12914d351bf560b06d6f4e45c294b04ecaa3.tar.gz
buildinfohelper: Add handler for cancelling a build
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 <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/ui/buildinfohelper.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/bb/ui/buildinfohelper.py b/lib/bb/ui/buildinfohelper.py
index eb0e425e2c..37a3fcb9c7 100644
--- a/lib/bb/ui/buildinfohelper.py
+++ b/lib/bb/ui/buildinfohelper.py
@@ -218,6 +218,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
@@ -1405,9 +1414,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()