Esempio n. 1
0
def create(instance_name=get_instance_name()):
    with settings(**get_settings()):
        instance_info = instances[instance_name]

        run("rm -rf %s" % instance_info["sandbox_dir"])
        run("virtualenv --system-site-packages %s" %
            instance_info["sandbox_dir"])

        chars = string.ascii_lowercase + string.ascii_uppercase + string.digits
        password = ''.join(random.choice(chars) for x in range(16))

        with prefix(get_virtualenv_activate(instance_name)):
            run("rm -rf buildbot")
            run("pip install buildbot-slave")

            name = slaves[env.host_string]["name"]

            run("rm -rf %s" % instance_info["slave_dir"])

            run("buildslave create-slave --umask=022 %s "
                "buildbot.sugarlabs.org:%d "
                "%s %s" %
                (instance_info["slave_dir"],
                 instance_info["config"]["slaves_port"], name, password))

            put(StringIO.StringIO(admin),
                os.path.join(instance_info["slave_dir"], "info", "admin"))
            put(StringIO.StringIO(name),
                os.path.join(instance_info["slave_dir"], "info", "host"))
Esempio n. 2
0
def configure(instance_name=get_instance_name()):
    instance_info = instances[instance_name]

    config = {"slaves": {}}
    config.update(instance_info["config"])

    tac = StringIO.StringIO()

    for host, info in slaves.items():
        slave_config = {"arch": info["arch"]}

        config["slaves"][info["name"]] = slave_config

        with settings(host_string=host, gateway=info["gateway"]):
            get(os.path.join(instance_info["slave_dir"], "buildbot.tac"), tac)
            for line in tac.getvalue().split("\n"):
                start = "passwd = "
                if line.startswith(start):
                    password = line[len(start) + 1:-1]
                    slave_config["password"] = password

    config_json = StringIO.StringIO()
    json.dump(config, config_json, indent=4, sort_keys=True)
    put(config_json, "config.json")
    sudo("cp config.json ~/%s" % instance_info["master_dir"])
    run("rm config.json")
Esempio n. 3
0
def create(instance_name=get_instance_name()):
    with settings(**get_settings()):
        instance_info = instances[instance_name]

        run("rm -rf %s" % instance_info["sandbox_dir"])
        run("virtualenv --system-site-packages %s" %
            instance_info["sandbox_dir"])

        chars = string.ascii_lowercase + string.ascii_uppercase + string.digits
        password = ''.join(random.choice(chars) for x in range(16))

        with prefix(get_virtualenv_activate(instance_name)):
            run("rm -rf buildbot")
            run("pip install buildbot-slave")

            name = slaves[env.host_string]["name"]

            run("rm -rf %s" % instance_info["slave_dir"])

            run("buildslave create-slave --umask=022 %s "
                "buildbot.sugarlabs.org:%d "
                "%s %s" % (instance_info["slave_dir"],
                           instance_info["config"]["slaves_port"],
                           name, password))

            put(StringIO.StringIO(admin),
                os.path.join(instance_info["slave_dir"], "info", "admin"))
            put(StringIO.StringIO(name),
                os.path.join(instance_info["slave_dir"], "info", "host"))
Esempio n. 4
0
def configure(instance_name=get_instance_name()):
    instance_info = instances[instance_name]

    config = {"slaves": {}}
    config.update(instance_info["config"])

    tac = StringIO.StringIO()

    for host, info in slaves.items():
        slave_config = {"arch": info["arch"]}

        config["slaves"][info["name"]] = slave_config

        with settings(host_string=host, gateway=info["gateway"]):
            get(os.path.join(instance_info["slave_dir"], "buildbot.tac"), tac)
            for line in tac.getvalue().split("\n"):
                start = "passwd = "
                if line.startswith(start):
                    password = line[len(start) + 1:-1]
                    slave_config["password"] = password

    config_json = StringIO.StringIO()
    json.dump(config, config_json, indent=4, sort_keys=True)
    put(config_json, "config.json")
    sudo("cp config.json ~/%s" % instance_info["master_dir"])
    run("rm config.json")
Esempio n. 5
0
def update(instance_name=get_instance_name()):
    instance_info = instances[instance_name]

    with prefix(get_virtualenv_activate(instance_name)):
        sudo("rm -rf ~/git")
        sudo("mkdir ~/git")

        with cd("~/git"):
            url = "https://github.com/sugarlabs/sugar-buildbot.git"
            sudo("git clone %s" % url)

            config = instance_info["config"]

            for branch in config["branches"]:
                repo_name = "sugar-build-%s" % branch

                sudo("git clone %s %s" % (config["repo"], repo_name))

                with cd(repo_name):
                    sudo("git checkout %s" % branch)

        with cd("~/git/sugar-buildbot"):
            master_dir = instance_info["master_dir"]
            sudo("cp *.py master.cfg ~/%s" % master_dir)
            sudo("cp -r commands ~/%s" % master_dir)
Esempio n. 6
0
def update(instance_name=get_instance_name()):
    instance_info = instances[instance_name]

    with prefix(get_virtualenv_activate(instance_name)):
        sudo("rm -rf ~/git")
        sudo("mkdir ~/git")

        with cd("~/git"):
            url = "https://github.com/sugarlabs/sugar-buildbot.git"
            sudo("git clone %s" % url)

            config = instance_info["config"]

            for branch in config["branches"]:
                repo_name = "sugar-build-%s" % branch

                sudo("git clone %s %s" % (config["repo"], repo_name))

                with cd(repo_name):
                    sudo("git checkout %s" % branch)

        with cd("~/git/sugar-buildbot"):
            master_dir = instance_info["master_dir"]
            sudo("cp *.py master.cfg ~/%s" % master_dir)
            sudo("cp -r commands ~/%s" % master_dir)
Esempio n. 7
0
def create(instance_name=get_instance_name()):
    instance_info = instances[instance_name]

    sudo("rm -rf ~/%s" % instance_info["sandbox_dir"])
    sudo("virtualenv ~/%s" % instance_info["sandbox_dir"])

    with prefix(get_virtualenv_activate(instance_name)):
        sudo("pip install buildbot")

        sudo("rm -rf ~/%s" % instance_info["master_dir"])
        sudo("buildbot create-master --log-size %d --log-count %d ~/%s" %
             (1024 * 1024 * 10, 10, instance_info["master_dir"]))

    execute(update)
    execute(configure)
Esempio n. 8
0
def create(instance_name=get_instance_name()):
    instance_info = instances[instance_name]

    sudo("rm -rf ~/%s" % instance_info["sandbox_dir"])
    sudo("virtualenv ~/%s" % instance_info["sandbox_dir"])

    with prefix(get_virtualenv_activate(instance_name)):
        sudo("pip install buildbot")

        sudo("rm -rf ~/%s" % instance_info["master_dir"])
        sudo("buildbot create-master --log-size %d --log-count %d ~/%s" %
             (1024 * 1024 * 10, 10, instance_info["master_dir"]))

    execute(update)
    execute(configure)
Esempio n. 9
0
def kill_dbus(instance_name=get_instance_name()):
    with settings(**get_settings()):
        run("killall dbus-daemon | true")
Esempio n. 10
0
def clean_build(instance_name=get_instance_name()):
    with settings(**get_settings()):
        instance_info = instances[instance_name]
        slave_dir = instance_info["slave_dir"]
        for name in "full", "quick":
            run("rm -rf %s" % os.path.join(slave_dir, "*-%s" % name))
Esempio n. 11
0
def restart(instance_name=get_instance_name()):
    with settings(**get_settings()):
        with prefix(get_virtualenv_activate(instance_name)):
            run("buildslave restart %s" %
                instances[instance_name]["slave_dir"])
Esempio n. 12
0
def start(instance_name=get_instance_name()):
    with settings(**get_settings()):
        buildslave_bin = get_virtualenv_bin(instance_name, "buildslave")
        slave_dir = instances[instance_name]["slave_dir"]
        run("%s start %s" % (buildslave_bin, slave_dir))
Esempio n. 13
0
def clean_build(instance_name=get_instance_name()):
    with settings(**get_settings()):
        instance_info = instances[instance_name]
        slave_dir = instance_info["slave_dir"]
        for name in "full", "quick":
            run("rm -rf %s" % os.path.join(slave_dir, "*-%s" % name))
Esempio n. 14
0
def restart(instance_name=get_instance_name()):
    with prefix(get_virtualenv_activate(instance_name)):
        sudo("buildbot restart ~/%s" % instances[instance_name]["master_dir"])
Esempio n. 15
0
def start(instance_name=get_instance_name()):
    with settings(**get_settings()):
        buildslave_bin = get_virtualenv_bin(instance_name, "buildslave")
        slave_dir = instances[instance_name]["slave_dir"]
        run("%s start %s" % (buildslave_bin, slave_dir))
Esempio n. 16
0
def kill_dbus(instance_name=get_instance_name()):
    with settings(**get_settings()):
        run("killall dbus-daemon | true")
Esempio n. 17
0
def restart(instance_name=get_instance_name()):
    with settings(**get_settings()):
        with prefix(get_virtualenv_activate(instance_name)):
            run("buildslave restart %s" %
                instances[instance_name]["slave_dir"])
Esempio n. 18
0
def restart(instance_name=get_instance_name()):
    with prefix(get_virtualenv_activate(instance_name)):
        sudo("buildbot restart ~/%s" % instances[instance_name]["master_dir"])