aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/hob-dogtail/finish.py
blob: c4ff3045467b87ace337db27c8be624dbee78467 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import time
import commands
from dogtail import tree

try:
    bitbake = tree.root.application('bitbake')
except:
    print "can not connect to the application"
else:
    try:
        hob = bitbake.child( roleName='frame' )
    except:
        print "can not connect to the application"

class Finish():

	def waitFinish(self):		
		print "Waiting for build to complete"
		nrprocs=10
		aux=50		
		while (aux > 0):		
			nrprocs = commands.getoutput("ps aux | grep bitbake | wc -l")
			if (int(nrprocs) < 6):
				aux = aux-1
			else:
				aux = 30
			time.sleep(10)
		
                try:
			hob.child('Build new image')
			print "Image build complete"		
		except:
	                hob.child('File a bug')
			print "Image build failed"
        	        self.writeInFile("finish_build: found a bug")
		time.sleep(60)
		return 10		










''' Old version
		print "Waiting for build to complete"
		nrprocs=10
		aux=50		
		while (aux > 0):		
			while (int(nrprocs) > 5):
				nrprocs = commands.getoutput("ps aux | grep bitbake | wc -l")
				#print nrprocs
				time.sleep(10)
			time.sleep(10)
			aux = aux-1
		print "Image build complete"
		time.sleep(60)
		return 10		
'''