aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/hob-dogtail/ipkBuild.py
blob: 91898e2c79bf2bc0343445bcbabd387d7f92c723 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
from dogtail import tree
from dogtail.utils import run
import os
import sys, string, time
import subprocess
from subprocess import call
from finishBuild import TestFinish
from dogtail.tree import predicate
from base import Base
from finish import Finish

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 IpkImageBuild(Base):

    def testFinish(self):
	final = None
    	try:
    		final = hob.child("Build new image")
		print "Image is ready"
		if final is not None:
			print final
			return 10
    	except:
		return 25
	else:
		try:
			final = hob.child("File a bug")
			if final is not None:
				return 20
		except:
			return 25
		else:
			try:
				final = hob.child("Step 2 of 2: Edit packages")
				if final is not None:
					return 20
			except:			
				print "Image ready not detected"
				return 25

    def ipkSelect(self):
        self.selectMachine('qemux86')
	time.sleep(180)

        press = 0
        while press < 20:
            try:
                selectDistro = hob.child(name = 'Advanced configuration\nSelect image types, package formats, etc', roleName='push button')
                selectDistro.click()
                break
            except:
                press += 1
        if press == 20:
            self.writeInFile("ipk_build: can not find advanced configuration button")
            return 10

        press = 0
        while press < 20:
            try:
                advConfig=bitbake.dialog('Advanced configuration')
                changeTab=advConfig.child('Output').click()
                break
            except:
                press += 1
        if press == 20:
            self.writeInFile("ipk_build: can not find output button")
            return 10

        press = 0
        while press < 20:
            try:
                distroType = advConfig.findChildren(predicate.GenericPredicate(roleName="combo box"))
                distroType[1].click()
                break
            except:
                press += 1

        try:
            selectPackageType = advConfig.child(name='ipk')
            selectPackageType.click()
        except:
            self.writeInFile("ipk_build: can not find package button")
            return 10
        try:
            advConfig.child('Save').click()
        except:
            self.writeInFile("ipk_build: can not find save button")
            return 10
        time.sleep(180)

        self.selectImage('core-image-minimal')
        try:
            hob.child('Build image').click()
        except:
            self.writeInFile("ipk_build: can not find build image button")
            return 10
	
	time.sleep(120)
	
	finish = Finish().waitFinish()

        if finish == 20:
            self.writeInFile("ipk image build: failed")
        else:
            self.writeInFile("ipk image build: passed")
        time.sleep(120)
	finish = 1

        bnw = hob.child('Build new image')
	print "Clicking Build new image"
	t=str(bnw)
	try:
		print t    
		if t.index('Build new image') > 0:
			try:                        
				bnw.click()				
			except:
				print "Found the build new image button but failed to click it!"
		else:
			print "Cannot find build new image button"
	except:
		print "Not the right element!"        
	scriptname=os.path.basename(__file__)
	print "Ending "+scriptname
        #return 10