modules/buildslave/manifests/install/version.pp
author kmoir@mozilla.com
Wed, 28 May 2014 09:04:48 -0400
changeset 1775 ad32888ce123
parent 432 0f305f0659c9
child 1991 aac10543c8ef
permissions -rw-r--r--
Bug 1006082 - Run Android 2.3 tests against armv6 builds, on Ash only r=aki
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# install a particular version of the buildslave code
#
# title: version number
# active: if true, make /tools/buildbot point here (default false)
# ensure: present/absent
define buildslave::install::version($active=false, $ensure="present") {
    $version = $title

    anchor {
        "buildslave::install::version::${version}::begin": ;
        "buildslave::install::version::${version}::end": ;
    }

    # set the parameters for the virtualenv below.  Each version should set
    # $packages explicitly.
    case $version {
        "0.8.4-pre-moz2": {
            include packages::mozilla::python27
            $py_require = Class['packages::mozilla::python27']
            $packages = [
                          "zope.interface==3.6.1",
                          "buildbot-slave==$version",
                          # buildbot (master) is needed for buildbot sendchange
                          "buildbot==$version",
                          "Twisted==10.2.0",
                          # this is required for some mozilla custom classes
                          "simplejson==2.1.3" ]
        }

        default: {
            fail("unrecognized buildbot version $version")
        }
    }

    case $ensure {
        present: {
            Anchor["buildslave::install::version::${version}::begin"] ->
            python::virtualenv {
                "/tools/buildbot-$version":
                    python => $::packages::mozilla::python27::python,
                    require => $py_require,
                    packages => $packages;
            } -> Anchor["buildslave::install::version::${version}::end"]

            if $active {
                Anchor["buildslave::install::version::${version}::begin"] ->
                file {
                    "/tools/buildbot":
                        ensure => "link",
                        target => "/tools/buildbot-$version";
                } -> Anchor["buildslave::install::version::${version}::end"]
            }
        }

        absent: {
            # absent? that's easy - blow away the directory
            python::virtualenv {
                "/tools/buildbot-$version":
                    python => $::packages::mozilla::python27::python,
                    packages => $packages,
                    ensure => absent;
            }
        }
    }
}