~dooferlad/+junk/python-ci-config

« back to all changes in this revision

Viewing changes to android-ci.py

  • Committer: James Tunnicliffe
  • Date: 2012-11-21 20:09:55 UTC
  • Revision ID: james.tunnicliffe@linaro.org-20121121200955-kr9j1gdqj9fm16cy
More tidying up.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
 
3
3
from linaro_ci import *
4
 
 
5
 
# Above: Our library. Fill in the gaps
6
 
# Below: A typical user job
 
4
import os
7
5
 
8
6
class AndroidBuild(LinaroCIJob):
9
7
    """Build android"""
11
9
    def __init__(self):
12
10
        self.set_triggers(["daily 22:00", "on merge request"])
13
11
 
14
 
    def run(self, target):
 
12
    def run(self, config):
15
13
        cpus = 4
16
14
 
17
15
        self.x86_64 = x86_64(
22
20
        )
23
21
 
24
22
        self.x86_64.chdir("dev")
 
23
        self.x86_64.in_directory("android")
 
24
        base_directory = self.x86_64.cwd()
 
25
 
25
26
        self.x86_64.install_deps(["repo", "gcc", "git"])
26
 
        self.x86_64.in_directory("android")
27
 
        self.source = self.x86_64.checkout(
28
 
                        "repo",
29
 
                        "git://android.git.linaro.org/platform/manifest.git",
30
 
                        "linaro_android_4.0.4",
31
 
                        "staging-origen.xml")
 
27
        self.source = self.x86_64.checkout("repo",
 
28
                                           config["check out"]["repo"],
 
29
                                           config["check out"]["branch"],
 
30
                                           config["check out"]["file name"])
32
31
 
33
32
        # If any of the above commands fails (return code != 0), we throw an
34
33
        # exception, which will terminate execution, though you could catch it
35
34
        # if you wanted to try something else.
36
35
 
37
36
        # Use the software bundle GCC, identified by tags
38
 
        self.x86_64.use("android-toolchain",
39
 
                        ["eabi-4.7", "daily", "linux", "x86"])
 
37
        self.x86_64.use("android-toolchain", config["toolchain tags"])
40
38
 
 
39
        toolchain_dir = os.path.join(base_directory,
 
40
                            "android-toolchain-eabi/bin/"
 
41
                            "arm-linux-androideabi-")
41
42
        # Run the build
42
43
        # This fails because of https://bugs.launchpad.net/linaro-android/+bug/1013114
43
44
        # and, well, I can't be bothered to patch it up as we develop the API. Close enough.
45
46
            # Until self.x86_64.build is refined and correctly implemented, just specify the full command
46
47
            build_command="make"
47
48
            " -j4 "
48
 
            "TARGET_PRODUCT=origen TARGET_SIMULATOR=false "
49
 
            "TARGET_TOOLS_PREFIX=/home/dooferlad/dev/android/android-toolchain-eabi/bin/arm-linux-androideabi- "
50
 
            "boottarball systemtarball userdatatarball showcommands",
51
 
            jobs=cpus, target=target,
 
49
            "TARGET_PRODUCT=%s TARGET_SIMULATOR=false " % (config["target"]) +
 
50
            "TARGET_TOOLS_PREFIX=" + toolchain_dir +
 
51
            " boottarball systemtarball userdatatarball showcommands",
 
52
            jobs=cpus, target=config["target"],
52
53
            cached=True,  # If this code has been checked out and built before, use cached build
53
54
            source_uid=self.source.uid) # UID to work out if this has already been built
54
55
                                  
56
57
    """Use standard Android build, boot it on snowball"""
57
58
 
58
59
    def run(self):
59
 
        super(AndroidBuildBootSnowball, self).run("snowball")
 
60
        config = {
 
61
            "check out": {
 
62
                "repo": "git://android.git.linaro.org/platform/manifest.git",
 
63
                "branch": "linaro_android_4.0.4",
 
64
                "file name": "tracking-snowball.xml"
 
65
            },
 
66
 
 
67
            "toolchain tags": ["eabi-4.7", "daily", "linux", "x86"],
 
68
 
 
69
            "target": "snowball"
 
70
        }
 
71
        super(AndroidBuildBootSnowball, self).run(config)
60
72
 
61
73
        self.snowball = Snowball()
62
74
        self.snowball.set_disk_image(self.android_build)