示例#1
0
 def __init__(self,
              installdir=None,
              mode="rebuild",
              projectfile=None,
              config='release',
              useenv=False,
              project=None,
              INCLUDE=None,
              LIB=None,
              PATH=None,
              **kwargs):
     if INCLUDE is None:
         INCLUDE = []
     if LIB is None:
         LIB = []
     if PATH is None:
         PATH = []
     self.installdir = installdir
     self.mode = mode
     self.projectfile = projectfile
     self.config = config
     self.useenv = useenv
     self.project = project
     if INCLUDE:
         self.INCLUDE = INCLUDE
         self.useenv = True
     if LIB:
         self.LIB = LIB
         self.useenv = True
     if PATH:
         self.PATH = PATH
     # always upcall !
     ShellCommand.__init__(self, **kwargs)
示例#2
0
    def start(self):
        # choose progressMetrics and logfiles based on whether trial is being
        # run with multiple workers or not.
        output_observer = logobserver.OutputProgressObserver('test.log')

        if self.jobs is not None:
            self.jobs = int(self.jobs)
            self.command.append("--jobs=%d" % self.jobs)

            # using -j/--jobs flag produces more than one test log.
            self.logfiles = {}
            for i in range(self.jobs):
                self.logfiles['test.%d.log' %
                              i] = '_trial_temp/%d/test.log' % i
                self.logfiles['err.%d.log' % i] = '_trial_temp/%d/err.log' % i
                self.logfiles['out.%d.log' % i] = '_trial_temp/%d/out.log' % i
                self.addLogObserver('test.%d.log' % i, output_observer)
        else:
            # this one just measures bytes of output in _trial_temp/test.log
            self.addLogObserver('test.log', output_observer)

        # now that self.build.allFiles() is nailed down, finish building the
        # command
        if self.testChanges:
            for f in self.build.allFiles():
                if f.endswith(".py"):
                    self.command.append("--testmodule=%s" % f)
        else:
            self.command.extend(self.tests)
        log.msg("Trial.start: command is", self.command)

        ShellCommand.start(self)
示例#3
0
    def __init__(self, *args, **kwargs):

        for name, default in [('binary', 'cppcheck'),
                              ('source', ['.']),
                              ('enable', []),
                              ('inconclusive', False),
                              ('extra_args', [])]:
            setattr(self, name, default)
            if name in kwargs:
                setattr(self, name, kwargs[name])
                del kwargs[name]

        ShellCommand.__init__(self, *args, **kwargs)
        self.addLogObserver(
            'stdio', logobserver.LogLineObserver())

        command = [self.binary]
        command.extend(self.source)
        if self.enable:
            command.append('--enable=%s' % ','.join(self.enable))
        if self.inconclusive:
            command.append('--inconclusive')
        command.extend(self.extra_args)
        self.setCommand(command)

        counts = self.counts = {}
        summaries = self.summaries = {}
        for m in self.MESSAGES:
            counts[m] = 0
            summaries[m] = []
示例#4
0
    def start(self):
        if self.getProperty('branch_'+self.layername):
            self.branch = self.getProperty('branch_'+self.layername)
        else:
            self.branch = "master"

        if self.getProperty('repo_'+self.layername):
            self.repourl = self.getProperty('repo_'+self.layername)
        else:
            self.repourl = "git://git.yoctoproject.org/poky"

        if self.getProperty('commit_'+self.layername) is 'HEAD' and  self.getProperty('commit_resolvedhead_'+self.layername) is not None:
            self.commit = self.getProperty('commit_resolvedhead_'+self.layername)
        else:
            self.commit = self.getProperty('commit_' + self.layername)
        if self.commit == "HEAD":
            cmd = 'git ls-remote ' + self.repourl + ' refs/heads/' + self.branch + '|cut -f1'
        elif self.commit is not None:
            cmd = 'echo ' + self.commit
        else:
            self.finished(SUCCESS)
            self.build.stopBuild('STOPPED!')

        self.command = cmd
        ShellCommand.start(self)
    def start(self):
        try:
            self.getProperty('package-local')
        except KeyError:
            self.setProperty('package-local', self.package)

        self.cmd = dedent(
            """
            # Wait a bit for the probe to startup or curl won't be able to connect to
            # the FTP server.
            # XXX: why do we need to wait that much? :(
            while true
            do
                curl --ftp-pasv ftp://%(user)s:%(password)s@%(prop-instance)s --upload-file %(prop-pkg)s

                if [ $? = 0 ]
                then
                    exit 0
                fi
                echo "FTP server not yet launched, waiting a bit..."
                sleep 1
            done
            """ %
            {
                'package': self.package,
                'user': self.user,
                'password': self.password,
                'prop-instance': self.getProperty('instance-name'),
                'prop-pkg': self.getProperty('package-local')
            }
        )

        self.setCommand(self.cmd)
        ShellCommand.start(self)
示例#6
0
    def __init__(self, fileloc=None, suppressTags=None, **kwargs):
        """
        Create the DebLintian object.

        @type fileloc: str
        @param fileloc: Location of the .deb or .changes to test.
        @type suppressTags: list
        @param suppressTags: List of tags to suppress.
        @type kwargs: dict
        @param kwargs: all other keyword arguments.
        """
        ShellCommand.__init__(self, **kwargs)
        if fileloc:
            self.fileloc = fileloc
        if suppressTags:
            self.suppressTags = suppressTags

        if not self.fileloc:
            config.error("You must specify a fileloc")

        self.command = ["lintian", "-v", self.fileloc]

        if self.suppressTags:
            for tag in self.suppressTags:
                self.command += ['--suppress-tags', tag]
示例#7
0
    def commandComplete(self, cmd):
        # Set a property with the location of the config file
        config_path = os.path.join(self.getProperty("workdir"),
                                   self.getWorkdir(), "acceptance_config.yml")
        self.setProperty("acceptance_config_path", config_path, self.name)

        ShellCommand.commandComplete(self, cmd)
示例#8
0
文件: rpmbuild.py 项目: kzys/buildbot
    def __init__(
        self,
        specfile=None,
        topdir="`pwd`",
        builddir="`pwd`",
        rpmdir="`pwd`",
        sourcedir="`pwd`",
        specdir="`pwd`",
        srcrpmdir="`pwd`",
        dist=".el5",
        autoRelease=False,
        vcsRevision=False,
        **kwargs
    ):
        """
        Creates the RpmBuild object.

        @type specfile: str
        @param specfile: the name of the spec file for the rpmbuild
        @type topdir: str
        @param topdir: the top directory for rpm building.
        @type builddir: str
        @param builddir: the directory to use for building
        @type rpmdir: str
        @param rpmdir: the directory to dump the rpms into
        @type sourcedir: str
        @param sourcedir: the directory that houses source code
        @type srcrpmdir: str
        @param srcrpmdir: the directory to dump source rpms into
        @type dist: str
        @param dist: the distribution to build for
        @type autoRelease: boolean
        @param autoRelease: if the auto release mechanics should be used
        @type vcsRevision: boolean
        @param vcsRevision: if the vcs revision mechanics should be used
        @type kwargs: dict
        @param kwargs: All further keyword arguments.
        """
        ShellCommand.__init__(self, **kwargs)
        self.addFactoryArguments(
            topdir=topdir,
            builddir=builddir,
            rpmdir=rpmdir,
            sourcedir=sourcedir,
            specdir=specdir,
            srcrpmdir=srcrpmdir,
            specfile=specfile,
            dist=dist,
            autoRelease=autoRelease,
            vcsRevision=vcsRevision,
        )
        self.rpmbuild = (
            'rpmbuild --define "_topdir %s" --define "_builddir %s"'
            ' --define "_rpmdir %s" --define "_sourcedir %s"'
            ' --define "_specdir %s" --define "_srcrpmdir %s"'
            ' --define "dist %s"' % (topdir, builddir, rpmdir, sourcedir, specdir, srcrpmdir, dist)
        )
        self.specfile = specfile
        self.autoRelease = autoRelease
        self.vcsRevision = vcsRevision
示例#9
0
 def start(self):
     DEST=self.getProperty("DEST")
     buildername=self.getProperty("buildername")
     if self.getProperty("custom_release_me_" + buildername):
         revision=self.getProperty("custom_release_name_" + buildername)
     else:
         revision=self.getProperty("got_revision_poky")
     self.basedir=os.path.join(self.slavedir, buildername)
     self.basedir=os.path.join(self.slavedir, buildername)
     bsptardir = self.machine
     cmd = "mkdir -p " + bsptardir + "/meta-intel; cd " + bsptardir + "; rm -rf meta-intel;"
     cmd = cmd + "git clone " + self.getProperty("repourl_meta-intel") + " meta-intel;"
     cmd = cmd + "cd meta-intel; git checkout " + self.getProperty("got_revision_meta-intel")+";"
     # issue with buildbot choking on a find exec. figure this out later.
     cmd = cmd + "for x in `find . -name .git\*`; do rm -rf $x; done;"
     cmd = cmd + "for x in `/bin/ls|egrep -v '(common|tlk|conf|README|MAINT|meta-" + self.machine.replace("-noemgd", "").replace("-lsb", "") + ")'`; do rm -rf $x; done;"
     cmd = cmd + "mkdir -p ./meta-" + self.machine.replace("-noemgd", "").replace("-lsb", "") + "/binary;"
     cmd = cmd + "cp -RL " + DEST + "/machines/" + self.machine + "/core-image-sato-" + self.machine + ".hddimage ./meta-" + self.machine.replace("-noemgd", "").replace("-lsb", "") + "/binary;"
     cmd = cmd + "cp -RL " + DEST + "/machines/" + self.machine + "/core-image-minimal-" + self.machine + ".hddimage ./meta-" + self.machine.replace("-noemgd", "").replace("-lsb", "") + "/binary;"
     cmd = cmd + "echo '' >> ./README.tlk;"
     cmd = cmd + "echo 'The following text is autogenerated during the autobuilder build process.' >> ./README.tlk;"
     cmd = cmd + "echo 'It is not a part of the repositories used to create this BSP package.' >>  ./README.tlk;"
     cmd = cmd + "echo '------------------------------------------------------------------------' >> ./README.tlk;"
     cmd = cmd + "echo 'Please note that the provided images were built using the meta-tlk layer' >> ./README.tlk;"
     cmd = cmd + "echo '(time limited kernel). Build instructions to build non-tlk images are' >> ./README.tlk;"
     cmd = cmd + "echo 'provided in ./meta-" + self.machine.replace("-noemgd", "").replace("-lsb", "") + "/README' >> ./README.tlk;"
     cmd = cmd + "echo '' >> ./README.tlk; cd ..;"
     cmd = cmd + "cd ..; tar cjvf " + self.machine + ".tar.bz2 meta-intel;"
     cmd = cmd + "mkdir -p " + DEST + "/machines/" + self.machine +";"
     cmd = cmd + "cp -RL " + self.machine + ".tar.bz2 " + DEST + "/machines/" + self.machine +";"
     self.command=cmd
     ShellCommand.start(self)
示例#10
0
 def start(self):
     DEST=self.getProperty("DEST")
     buildername=self.getProperty("buildername")
     revision = ""
     if str(os.environ.get('PUBLISH_BUILDS')) == "True":
         if self.getProperty("custom_release_me_"+buildername):
             revision=self.getProperty("custom_release_name_"+buildername)
         elif self.getProperty("got_revision_"+self.layername):
             revision=self.getProperty("got_revision_"+self.layername)
         if revision is not "":
             self.basedir=os.path.join(os.path.join(os.path.join(
                                         self.slavedir, buildername), self.workdir))
             command = " git archive --format=tar HEAD "
             command = command + "--prefix=" + self.layername + "-" + revision + "/"
             command = command + " | gzip > " + self.layername + "-" + revision + ".tar.gz; "
             command = command + " git archive --format=tar HEAD "
             command = command + "--prefix=" + self.layername + "-" + revision + "/"
             command = command + " | bzip2 -c > " + self.layername + "-" + revision + ".tar.bz2; "
             command = command + "md5sum " + self.layername + "-" + revision + ".tar.bz2 >> "
             command = command + self.layername + "-" + revision + ".tar.bz2.md5sum; "
             command = command + "md5sum " + self.layername + "-" + revision + ".tar.gz >> "
             command = command + self.layername + "-" + revision + ".tar.gz.md5sum; "
             command = command + "mkdir -p " + DEST + "; rsync -av "
             command = command + self.layername + "-" + revision +".tar.* " + DEST
             self.command=command
         else:
             self.command="echo 'No revision found. Skipping tarball'"
     else:
         self.command="echo 'Not publishing build, skipping step'"
     ShellCommand.start(self)
示例#11
0
 def __init__(self,
              specfile=None,
              topdir='`pwd`',
              builddir='`pwd`',
              rpmdir='`pwd`',
              sourcedir='`pwd`',
              specdir='`pwd`',
              srcrpmdir='`pwd`',
              dist='.el5',
              autoRelease=False,
              vcsRevision=False,
              **kwargs):
     ShellCommand.__init__(self, **kwargs)
     self.addFactoryArguments(topdir=topdir,
                              builddir=builddir,
                              rpmdir=rpmdir,
                              sourcedir=sourcedir,
                              specdir=specdir,
                              srcrpmdir=srcrpmdir,
                              specfile=specfile,
                              dist=dist,
                              autoRelease=autoRelease,
                              vcsRevision=vcsRevision)
     self.rpmbuild = (
         'rpmbuild --define "_topdir %s" --define "_builddir %s"'
         ' --define "_rpmdir %s" --define "_sourcedir %s"'
         ' --define "_specdir %s" --define "_srcrpmdir %s"'
         ' --define "dist %s"' % (topdir, builddir, rpmdir, sourcedir,
         specdir, srcrpmdir, dist))
     self.specfile = specfile
     self.autoRelease = autoRelease
     self.vcsRevision = vcsRevision
示例#12
0
 def start(self):
     pullrequestid = self.getProperty(PROPERTYNAME_JENKINSGITHUBPULLREQUEST)
     build_url = self.getProperty(PROPERTYNAME_JENKINSBUILDURL)
     mono_version = self.getProperty(PROPERTYNAME_MONOVERSION)
     git_commit = self.getProperty(PROPERTYNAME_JENKINSGITCOMMIT)
     config_name = self.getProperty('config_name')
     benchmarker_commit = self.getProperty('got_revision').get('benchmarker')
     assert benchmarker_commit is not None
     cmd = ['mono', 'tools/compare.exe', '--create-run-set']
     if pullrequestid is not None:
         cmd.append('--pull-request-url')
         cmd.append('https://github.com/mono/mono/pull/%s' % str(pullrequestid))
         cmd.append('--mono-repository')
         cmd.append('../mono')
     if build_url is not None:
         cmd.append('--build-url')
         cmd.append(build_url)
     if git_commit is not None:
         cmd.append('--main-product')
         cmd.append('mono')
         cmd.append(git_commit)
     cmd.append('--config-file')
     cmd.append('configs/%s.conf' % (config_name))
     cmd.append('--root')
     cmd.append(self.install_root(mono_version))
     cmd.append('--secondary-product')
     cmd.append('benchmarker')
     cmd.append(benchmarker_commit)
     self.setCommand(cmd)
     ShellCommand.start(self)
示例#13
0
    def __init__(self, failureOnNoTests=False, *args, **kwargs):
        ShellCommand.__init__(self, *args, **kwargs)
        self.failureOnNoTests = failureOnNoTests

        self.ioObserver = SubunitLogObserver()
        self.addLogObserver('stdio', self.ioObserver)
        self.progressMetrics = self.progressMetrics + ('tests', 'tests failed')
示例#14
0
文件: subunit.py 项目: cread/buildbot
 def __init__(self, *args, **kwargs):
     ShellCommand.__init__(self, *args, **kwargs)
     # importing here gets around an import loop
     from buildbot.process import subunitlogobserver
     self.ioObverser = subunitlogobserver.SubunitLogObserver()
     self.addLogObserver('stdio', self.ioObverser)
     self.progressMetrics = self.progressMetrics + ('tests', 'tests failed')
 def start(self):
     buildername=self.getProperty("buildername")
     oldbuildername=buildername.replace("plugin", "poky")
     branch=self.getProperty("branch")
     eclipsehome=self.workerworkdir + "/" + buildername + '/build'
     self.command='cd ' + eclipsehome + '/scripts/; ./setup.sh; ECLIPSE_HOME="' + eclipsehome + '/scripts/eclipse/" ./build.sh ' + branch + ' development'
     ShellCommand.start(self)
示例#16
0
 def __init__(self, **kwargs):
     """
     @type    workdir: string
     @keyword workdir: the workdir to start from (must be the base of the
                       Twisted tree)
     """
     ShellCommand.__init__(self, **kwargs)
示例#17
0
 def __init__(self, cvsroot, **kwargs):
     self.cvsroot = cvsroot
     self.workdir = "."
     kwargs['workdir'] = "."
     # command may be overridden in start()
     kwargs['command'] = ["cvs", "-d", cvsroot, "co", "mozilla/client.mk"]
     ShellCommand.__init__(self, **kwargs)
示例#18
0
    def __init__(self,
                 root=None,
                 resultdir=None,
                 **kwargs):
        """
        Creates the Mock object.

        @type root: str
        @param root: the name of the mock buildroot
        @type resultdir: str
        @param resultdir: the path of the result dir
        @type kwargs: dict
        @param kwargs: All further keyword arguments.
        """
        ShellCommand.__init__(self, **kwargs)
        if root:
            self.root = root
        if resultdir:
            self.resultdir = resultdir

        if not self.root:
            config.error("You must specify a mock root")

        self.command = ['mock', '--root', self.root]
        if self.resultdir:
            self.command += ['--resultdir', self.resultdir]
示例#19
0
 def __init__(self,
              installdir=None,
              mode="rebuild",
              projectfile=None,
              config='release',
              useenv=False,
              project=None,
              INCLUDE=[],
              LIB=[],
              PATH=[],
              **kwargs):
     self.installdir = installdir
     self.mode = mode
     self.projectfile = projectfile
     self.config = config
     self.useenv = useenv
     self.project = project
     if len(INCLUDE) > 0:
         self.INCLUDE = INCLUDE
         self.useenv = True
     if len(LIB) > 0:
         self.LIB = LIB
         self.useenv = True
     if len(PATH) > 0:
         self.PATH = PATH
     # always upcall !
     ShellCommand.__init__(self, **kwargs)
 def start(self):
     _layers = ast.literal_eval(self.getProperty("custom_layers"))
     fout = ""
     for layer in _layers:
         layername = layer.iterkeys().next()
         repo = layer[layer.iterkeys().next()]["repourl"]
         branch = layer[layer.iterkeys().next()]["branch"]
         # commit=layer[layer.iterkeys().next()]['commit']
         storedir = None
         mirrordir = None
         method = "clobber"
         mode = "full"
         self.workdir = ""
         self.description += "/n" + layername + "/n"
         if "poky" in layername or "oecore" in layername:
             workdir = "build"
         else:
             workdir = "build/" + layername
         log.msg(layer)
         fout += (
             "mkdir -p "
             + workdir
             + "; cd "
             + workdir
             + "; git clone "
             + repo
             + " .;git checkout"
             + branch
             + "; cd $BASEBUILDDIR;"
         )
     self.command = ["sh", "-c", "BASEBUILDDIR=`pwd`; rm -rf build;" + fout]
     ShellCommand.start(self)
示例#21
0
 def __init__(self, upload_furlfile=None, egg_filename_base=None,
              *args, **kwargs):
     kwargs['command'] = 'flappclient --furlfile %s upload-file %s*.egg' \
                         % (upload_furlfile, egg_filename_base)
     ShellCommand.__init__(self, *args, **kwargs)
     self.addFactoryArguments(upload_furlfile=upload_furlfile,
                              egg_filename_base=egg_filename_base)
示例#22
0
 def start(self):
     self.distro = self.getProperty("DISTRO")
     self.machine = self.getProperty("MACHINE")
     kmeta = self.getProperty("custom_kmeta")
     kbranch = self.getProperty("custom_kbranch")
     srcrev_meta = self.getProperty("custom_srcrev_meta")
     srcrev_machine = self.getProperty("custom_srcrev_machine")
     srcuri_meta = self.getProperty("custom_srcuri_meta")
     srcuri_machine = self.getProperty("custom_srcuri_machine")
     fout = ""
     if self.distro == "poky-rt":
         self.kstring = "pn-linux-yocto-rt"
     if srcrev_machine != "" and str(srcrev_machine) != "None":
         fout += 'SRCREV_machine_%s_%s = "%s"\n' % (self.machine, self.kstring, srcrev_machine)
     if srcrev_meta != "" and str(srcrev_meta) != "None":
         fout += 'SRCREV_meta_%s_%s = "%s"\n' % (self.machine, self.kstring, srcrev_meta)
     if kmeta != "" and str(kmeta) != "None":
         fout += 'KMETA_%s_%s = "%s"\n' % (self.machine, self.kstring, kmeta)
     if srcuri_meta != "" and str(srcuri_meta) != "None":
         fout += 'SRC_URI_%s_%s += "%s;bareclone=1;branch=${KMETA};type=kmeta;name=meta"\n' % (
             self.machine,
             self.kstring,
             srcuri_meta,
         )
     if kbranch != "" and str(kbranch) != "None":
         fout += 'KBRANCH_%s_%s = "%s"\n' % (self.machine, self.kstring, kbranch)
     if srcuri_machine != "" and str(srcuri_machine) != "None":
         fout += 'SRC_URI_%s_%s += "%s;bareclone=1;branch=${KBRANCH};type=machine;name=machine"\n' % (
             self.machine,
             self.kstring,
             srcuri_machine,
         )
     self.command = ["sh", "-c", "printf '" + fout + "'>> ./build/conf/auto.conf"]
     ShellCommand.start(self)
示例#23
0
文件: maxq.py 项目: Cray/buildbot
 def __init__(self, testdir=None, **kwargs):
     if not testdir:
         config.error("please pass testdir")
     kwargs['command'] = 'run_maxq.py %s' % (testdir,)
     ShellCommand.__init__(self, **kwargs)
     self.observer = MaxQObserver()
     self.addLogObserver('stdio', self.observer)
示例#24
0
 def __init__(self, **kwargs):
     assert 'platform' in kwargs
     platform = kwargs['platform']
     assert platform.startswith('win32') or platform.startswith('macosx') \
       or platform.startswith('linux')
     if 'leakFailureThreshold' in kwargs:
         self.leakFailureThreshold = kwargs['leakFailureThreshold']
     if not 'mallocLog' in kwargs:
         return FAILURE
     self.mallocLog = kwargs['mallocLog']
     if 'testname' in kwargs:
         testname = kwargs['testname'] + " "
     else:
         testname = ""
     self.testname = testname
     self.name = "compare " + testname + "leak logs"
     self.description = "compare " + testname + "leak logs"
     self.descriptionDone = "compare " + testname + "leak logs complete"
     if platform.startswith("win32"):
         kwargs['command'] = ['obj-firefox\\dist\\bin\\leakstats.exe',
                              kwargs['mallocLog']]
     else:
         kwargs['command'] = ['obj-firefox/dist/bin/leakstats',
                              kwargs['mallocLog']]
     ShellCommand.__init__(self, **kwargs)
示例#25
0
文件: utils.py 项目: chenbk85/op
  def __init__(self, build_status_oracle, coverage_url, coverage_dir,
               coverage_file, **kwargs):
    """Prepares the coverage command.

       Args:
         build_status_oracle: class that knows if the current build has failed.
         coverage_url: The base URL for the serving web server we will use
             when we generate the link to the coverage. This will generally
             be the slave's URL (something like http://slave-hostname/).
         coverage_dir: Where to write coverage HTML.
         coverage_file: The LCOV file to generate the coverage from.
    """
    ShellCommand.__init__(self, **kwargs)
    self.addFactoryArguments(build_status_oracle=build_status_oracle,
                             coverage_url=coverage_url,
                             coverage_dir=coverage_dir,
                             coverage_file=coverage_file)
    self.build_status_oracle = build_status_oracle
    self.coverage_url = coverage_url
    self.description = ['Coverage Report']
    self.name = 'LCOV (Report)'
    self.warnOnFailure = True
    self.flunkOnFailure = False
    output_dir = os.path.join(coverage_dir,
                              '%(buildername)s_%(buildnumber)s')
    generate_script = PosixPathJoin('tools', 'continuous_build',
                                    'build_internal', 'scripts',
                                    'generate_coverage_html.sh')
    self.setCommand([generate_script, coverage_file,
                     WithProperties(output_dir)])
示例#26
0
 def createSummary(self, log):
     ShellCommand.createSummary(self, log)
     for l in log.readlines():
         m = re.match(r"^New snapshot ID ([0-9]*) added\.", l)
         if m is not None:
             self.setProperty("coverity-snapshot-id", m.group(1), "CoverityCommit")
             break
    def initialize(self):
        builddir = self.getProperty('builddir', default='build_directory').replace('\\', '/')
        self.env['BUILD_DIR_PATH'] = builddir
        self.env['BUILD_DIR'] = os.path.basename(builddir)
        timestamp = datetime.datetime.now()
        timestamp_str = timestamp.strftime('%Y%m%d-%H%M%S')
        prop_name = 'timestamp' if not self.hasProperty('timestamp') else 'my_timestamp'
        self.setProperty(prop_name, timestamp_str, 'Initialize Step')

        # run buildenv with dummy command to remove Git index.lock
        env = self.env.copy()
        env['BUILD_INITIALIZE'] = '1'
        ci_branch = self.getProperty('ci-branch', default=None)
        if ci_branch is None:
            ci_branch = self.getProperty('branch', default=None)
        if ci_branch and not ci_branch.startswith('2.4'):
            self.env['BUILD_CI_BRANCH'] = ci_branch
            env['BUILD_CI_BRANCH'] = ci_branch
            env['BUILD_INIT_CI'] = '1'
            env['BUILD_CI_URL'] = 'git://code.ocv/opencv/opencv-ci.git'
        step = ShellCommand(name='init', descriptionDone=' ', description=' ',
                command=self.envCmd + 'echo Initialize', env=env, workdir='.',
                maxTime=24*60*60, timeout=24*60*60,
                haltOnFailure=True)
        step.addLogObserver('stdio', BuildPropertiesObserver(self))
        yield self.processStep(step)
示例#28
0
 def __init__(self, 
             installdir = None,
             mode = "rebuild", 
             projectfile = None,
             config = None,
             useenv = False,
             INCLUDE = [],
             LIB = [],
             PATH = [],
             **kwargs):
     self.installdir = installdir
     self.mode = mode
     self.projectfile = projectfile
     self.config = config
     self.useenv = useenv
     if len(INCLUDE) > 0:
         self.INCLUDE = INCLUDE
         self.useenv = True
     if len(LIB) > 0:
         self.LIB = LIB
         self.useenv = True
     if len(PATH) > 0:
         self.PATH = PATH
     # always upcall !
     ShellCommand.__init__(self, **kwargs)
     self.addFactoryArguments(
         installdir = installdir,
         mode = mode,
         projectfile = projectfile,
         config = config,
         useenv = useenv,
         INCLUDE = INCLUDE,
         LIB = LIB,
         PATH = PATH
     )
示例#29
0
 def __init__(self, factory, argdict=None, **kwargs):
     self.time="0"
     self.funny="False"
     self.factory = factory
     for k, v in argdict.iteritems():
         if k=="time":
             self.time=v
         else:
             setattr(self, k, v)
     sleep_quotes = ["Sleep, those little slices of death, how I loathe them.",
                                "No day is so bad it can't be fixed with a nap.",
                                "People who say they sleep like a baby usually don't have one.",
                                "Life is too short to sleep on low thread-count sheets",
                                "Sleep is a symptom of caffeine deprivation.",
                                "Without enough sleep, we all become tall two-year-olds.",
                                "I'm not asleep... but that doesn't mean I'm awake.",
                                "When you have insomnia, you're never really asleep, and you're never really awake.",
                                "Life is something that happens when you can't get to sleep.",
                                "Sleeping is no mean art:  for its sake one must stay awake all day.",
                                "I count it as a certainty that in paradise, everyone naps.",
                                "Early to rise and early to bed, makes a man healthy and wealthy and dead.",
                                "I like sleeping, its like death without commitment.",
                                "I do 5 sit-ups every morning. May not sound like much, but there's only so many times you can hit the snooze button.",
                                "The early bird gets the worm. The early worm...gets eaten."]
     from random import choice
     if self.funny == "True":
         self.description = choice(sleep_quotes) + "<br><br>Sleeping for " + self.time + " sec."
     else:
         self.description = "Sleeping for " + self.time + " sec."
     self.command = "/bin/sleep " + self.time
     # Timeout needs to be passed to LoggingBuildStep as a kwarg
     self.timeout = 1000
     kwargs['timeout']=self.timeout
     ShellCommand.__init__(self, **kwargs)
示例#30
0
    def start(self):
        # now that self.build.allFiles() is nailed down, finish building the
        # command
        if self.testChanges:
            for f in self.build.allFiles():
                if f.endswith(".py"):
                    self.command.append("--testmodule=%s" % f)
        else:
            for test in self.tests:
                if test:
                    # If there's just a null-y string, don't add it
                    self.command.append(test)
        log.msg("Trial.start: command is", self.command)

        # if our slave is too old to understand logfiles=, fetch them
        # manually. This is a fallback for the Twisted buildbot and some old
        # buildslaves.
        self._needToPullTestDotLog = False
        if self.slaveVersionIsOlderThan("shell", "2.1"):
            log.msg("Trial: buildslave %s is too old to accept logfiles=" %
                    self.getSlaveName())
            log.msg(" falling back to 'cat _trial_temp/test.log' instead")
            self.logfiles = {}
            self._needToPullTestDotLog = True

        ShellCommand.start(self)
示例#31
0
 def __init__(self, source, destination,
              files=None,
              recursive=False,
              mirror=False,
              move=False,
              exclude=None,
              exclude_files=None,
              exclude_dirs=None,
              custom_opts=None,
              verbose=False,
              **kwargs):
     self.source = source
     self.destination = destination
     self.files = files
     self.recursive = recursive
     self.mirror = mirror
     self.move = move
     self.exclude_files = exclude_files
     if exclude and not exclude_files:
         self.exclude_files = exclude
     self.exclude_dirs = exclude_dirs
     self.custom_opts = custom_opts
     self.verbose = verbose
     ShellCommand.__init__(self, **kwargs)
示例#32
0
文件: master.py 项目: astagi/r2d2
def get_changelog_step(type):
    build_apk = '{}_%(prop:gitversion)s_{}_{}.apk'.format(
        config.APP_NAME, type, strftime('%Y%m%d', gmtime()))
    command_init = 'echo "" > ../../../changes/{}changes.log;'.format(type)
    command_add_return = 'echo "" >> ../../../changes/{}changes.log;'.format(
        type)
    changelog_cmd = command_init
    if type != 'continuously':
        changelog_cmd += 'echo "BUILD: {}:{}/{}" >> ../../../changes/{}changes.log;'.format(
            config.BUILDBOT_HOST, config.BUILDSLIST_PORT, build_apk, type)
        changelog_cmd += command_add_return
    else:
        changelog_cmd += 'echo "BRANCH: $(git branch | sed -e \'s/^* //\')" >> ../../../changes/{}changes.log;'.format(
            type)
        changelog_cmd += command_add_return
    return ShellCommand(command=Interpolate(changelog_cmd))
示例#33
0
def final_dropdb(configurator, options, environ=()):
    return [
        ShellCommand(
            command=[
                'psql',
                'postgres',
                '-c',
                WithProperties('DROP DATABASE IF EXISTS "%(testing_db)s"'),
            ],
            name='final_dropdb',
            description=["dropdb", Property('testing_db')],
            env=environ,
            haltOnFailure=False,
            flunkOnFailure=False,
        )
    ]
示例#34
0
 def setup(self, **kwargs):
     self.addStep(
         Configure(command=["./configure", "--prefix", "$(PWD)/target"]))
     self.addStep(Compile(command=["make"]))
     self.addStep(
         ShellCommand(name="install",
                      description="installing",
                      command=["make", "install"]))
     self.addStep(
         Test(command=[
             "make",
             "-C",
             "Tools/freeze/test",
             "PYTHON=../../../target/bin/python3",
             "OUTDIR=../../../target/freezetest",
         ]))
示例#35
0
 def describe(self, done=False):
     description = ShellCommand.describe(self, done)
     if done:
         if not description:
             description = ['compile']
         description.append('%d projects' %
                            self.step_status.getStatistic('projects', 0))
         description.append('%d files' %
                            self.step_status.getStatistic('files', 0))
         warnings = self.step_status.getStatistic('warnings', 0)
         if warnings > 0:
             description.append('%d warnings' % warnings)
         errors = self.step_status.getStatistic('errors', 0)
         if errors > 0:
             description.append('%d errors' % errors)
     return description
 def __init__(self, hgHost, **kwargs):
     self.parent_class = BuildFactory
     self.parent_class.__init__(self, **kwargs)
     self.hgHost = hgHost
     self.addStep(SetProperty(
         name='set_topdir',
         command=['pwd'],
         property='topdir',
         workdir='.',
     ))
     self.addStep(ShellCommand(
         name='rm_pyc',
         command=['find', '.', '-name', '*.pyc', '-exec', 'rm', '-fv', '{}',
                  ';'],
         workdir=".",
     ))
    def __init__(self, config, project, profile):
        BuildFactory.__init__(self, [])
        env = {}

        for setup in profile.setups:
            desc = "Preparing %s" % setup
            prepare_dict = dict(name=desc, description=desc, descriptionDone=desc)
            self.addStep(SetupStep(setup, config=config, env=env, **prepare_dict))
        self.addStep(create_checkout_step(project))
        profile_commands = project.inplace.profile_commands(profile)
        for pc in profile_commands:
            shell_dict = dict(name=pc.name, description=pc.name, descriptionDone=pc.name)
            if len(pc.commands) == 1:
                self.addStep(ShellCommand(command=pc.commands[0], env=env, **shell_dict))
            else:
                self.addStep(ShellSequence(pc.commands, env=env, **shell_dict))
示例#38
0
    def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
        if branch == "3.x":
            branch = master_branch_version
        elif branch == "custom":
            branch = "3"
        installed_python = "./target/bin/python%s" % branch
        self.addStep(
            Configure(command=["./configure", "--prefix", "$(PWD)/target"] +
                      self.configureFlags))

        compile = ["make", self.makeTarget]
        install = ["make", self.installTarget]
        testopts = self.defaultTestOpts[:]
        # Timeout for the buildworker process
        self.test_timeout = self.test_timeout or TEST_TIMEOUT
        # Timeout for faulthandler
        if branch != "2.7":
            faulthandler_timeout = self.test_timeout - 5 * 60
            testopts += [f'--timeout={faulthandler_timeout}']
        if parallel:
            compile = ["make", parallel, self.makeTarget]
            install = ["make", parallel, self.installTarget]
            testopts = testopts + [parallel]

        test = [installed_python] + self.interpreterFlags
        test += ["-m", "test.regrtest"] + testopts

        cleantest = test + ["--cleanup"]

        self.addStep(Compile(command=compile))
        self.addStep(Install(command=install))
        self.addStep(LockInstall())
        # FIXME: https://bugs.python.org/issue37359#msg346686
        #if regrtest_has_cleanup(branch):
        #    self.addStep(CleanupTest(command=cleantest))
        self.addStep(
            ShellCommand(
                name="pythoninfo",
                description="pythoninfo",
                command=[installed_python, "-m", "test.pythoninfo"],
                warnOnFailure=True,
            ))
        self.addStep(
            Test(command=test, timeout=self.test_timeout,
                 usePTY=test_with_PTY))
        self.addStep(Uninstall())
        self.addStep(Clean())
示例#39
0
    def __init__(self, source, configure="./configure",
                 configureEnv=None,
                 configureFlags=None,
                 reconf=None,
                 compile=_DefaultCommand,
                 test=_DefaultCommand,
                 distcheck=_DefaultCommand):
        if configureEnv is None:
            configureEnv = {}
        if configureFlags is None:
            configureFlags = []
        if compile is _DefaultCommand:
            compile = ["make", "all"]
        if test is _DefaultCommand:
            test = ["make", "check"]
        if distcheck is _DefaultCommand:
            distcheck = ["make", "distcheck"]

        BuildFactory.__init__(self, [source])

        if reconf is True:
            reconf = ["autoreconf", "-si"]
        if reconf is not None:
            self.addStep(
                ShellCommand(name="autoreconf", command=reconf, env=configureEnv))

        if configure is not None:
            # we either need to wind up with a string (which will be
            # space-split), or with a list of strings (which will not). The
            # list of strings is the preferred form.
            if isinstance(configure, str):
                if configureFlags:
                    assert " " not in configure  # please use list instead
                    command = [configure] + configureFlags
                else:
                    command = configure
            else:
                assert isinstance(configure, (list, tuple))
                command = configure + configureFlags
            self.addStep(Configure(command=command, env=configureEnv))
        if compile is not None:
            self.addStep(Compile(command=compile, env=configureEnv))
        if test is not None:
            self.addStep(Test(command=test, env=configureEnv))
        if distcheck is not None:
            self.addStep(Test(command=distcheck, env=configureEnv))
    def testCommand(self):
        f = BuildFactory()
        f.addStep(SetProperty(command=["echo", "value"], property="propname"))
        f.addStep(
            ShellCommand(
                command=["echo", WithProperties("%(propname)s")]))

        ss = SourceStamp()

        req = FakeBuildRequest("Testing", ss, None)

        b = f.newBuild([req])
        b.build_status = FakeBuildStatus()
        b.slavebuilder = FakeSlaveBuilder()

        # This shouldn't raise an exception
        b.setupBuild(None)
示例#41
0
def get_makewheel_step(abi, arch):
    command = [
        "/usr/local/bin/python%s.%s" % (abi[2], abi[3]),
        "makepanda/makewheel.py",
        "--outputdir", outputdir,
        "--version", whl_version,
        "--platform", Interpolate("macosx-%s-%s", Property("osxtarget"), arch),
        "--verbose",
    ]

    do_step = True
    if abi in ('cp27-cp27m', 'cp34-cp34m', 'cp35-cp35m'):
        do_step = is_branch('release/1.10.x')

    return ShellCommand(name="makewheel " + arch + " " + abi,
                        command=command,
                        haltOnFailure=True, doStepIf=do_step)
示例#42
0
 def _step_Archive(self):
     command = [
         "tar", "cjf",
         WithProperties("../../%(filename)s"), "--owner", "0", "--group",
         "0", "--checkpoint", "--exclude=.svn", "."
     ]
     # OSX Snow Leopard (10.6) has tar which is bsdtar
     # make it use gnutar, this is also availible on Leopard (10.5)
     if self.host_os == "darwin":
         command[0] = "gnutar"
     # make the tarball
     self.addStep(
         ShellCommand(name="makedist",
                      description=["tarball", "package"],
                      workdir="build/build/root",
                      command=command,
                      haltOnFailure=True))
示例#43
0
def pip(what, packages):
    """
    Installs a list of packages with pip, in the current virtualenv.

    @param what: Description of the packages being installed.
    @param packages: L{list} of packages to install
    @returns: L{BuildStep}
    """
    return ShellCommand(name="install-" + what,
                        description=["installing", what],
                        descriptionDone=["install", what],
                        command=[
                            Interpolate(path.join(VIRTUALENV_DIR, "bin/pip")),
                            "install",
                            packages,
                        ],
                        haltOnFailure=True)
示例#44
0
    def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
        self.addStep(
            Configure(command=["./configure", "--prefix", "$(PWD)/target"] +
                      self.configureFlags))
        compile = ["make", self.makeTarget]
        testopts = self.testFlags
        # Timeout for the buildworker process
        self.test_timeout = self.test_timeout or TEST_TIMEOUT
        # Timeout for faulthandler
        faulthandler_timeout = self.test_timeout - 5 * 60
        if parallel:
            compile = ["make", parallel, self.makeTarget]
            testopts = testopts + " " + parallel
        if "-j" not in testopts:
            testopts = "-j2 " + testopts
        cleantest = [
            "make",
            "cleantest",
            "TESTOPTS=" + testopts + " ${BUILDBOT_TESTOPTS}",
            "TESTPYTHONOPTS=" + self.interpreterFlags,
            "TESTTIMEOUT=" + str(faulthandler_timeout),
        ]
        test = [
            "make",
            "buildbottest",
            "TESTOPTS=" + testopts + " ${BUILDBOT_TESTOPTS}",
            "TESTPYTHONOPTS=" + self.interpreterFlags,
            "TESTTIMEOUT=" + str(faulthandler_timeout),
        ]

        self.addStep(Compile(command=compile))
        self.addStep(
            ShellCommand(
                name="pythoninfo",
                description="pythoninfo",
                command=["make", "pythoninfo"],
                warnOnFailure=True,
            ))
        # FIXME: https://bugs.python.org/issue37359#msg346686
        #if regrtest_has_cleanup(branch):
        #    self.addStep(CleanupTest(command=cleantest))
        self.addStep(
            Test(command=test, timeout=self.test_timeout,
                 usePTY=test_with_PTY))
        self.addStep(Clean())
示例#45
0
def MakeMacLegacyBuilder():
    f = BuildFactory()
    f.addSteps(svn_co_legacy)
    f.addStep(
        ShellCommand(
            name='dmg',
            command=['bash', 'deploy.sh'],
            workdir='build/os/macosx',
            haltOnFailure=True,
        ))
    f.addStep(
        FileUpload(
            mode=0644,
            slavesrc=WithProperties(
                'os/macosx/dmg/SimpleChat-%(version_legacy)s.dmg'),
            masterdest=UploadFileNameLegacy(
                'SimpleChat-%(version_legacy)s.dmg'),
        ))
示例#46
0
def get_android_patch_steps(string, replacement, file):
    from buildbot.steps.shell import ShellCommand
    from buildbot.process.properties import Interpolate

    return [
        ShellCommand(
            name='patch',
            description=['patching'],
            descriptionDone=['patch'],
            hideStepIf=skipped_or_success,
            workdir=Interpolate('%(prop:builddir)s/build'),
            command=Interpolate('sed -i.bak s@' + string + '@' + replacement +
                                '@g ' + file),
            env={'PATH': Interpolate('%(prop:toolchain_path)s%(prop:PATH)s')},
            want_stdout=True,
            want_stderr=True,
            logEnviron=False)
    ]
示例#47
0
 def stepCleanupBuild(self):
     # workaround, buildbot immediate terminate launched processes(SIGKILL),
     # git has no chance for proper cleanup of .lock files
     for base in self.codebases:
         self.addStep(
             ShellCommand(name="Remove git locks " + base,
                          command='rm -f .git/index.lock',
                          workdir=base,
                          hideStepIf=lambda result, s: result == SUCCESS,
                          haltOnFailure=True))
     self.addStep(
         RemoveDirectory(dir='build',
                         hideStepIf=lambda result, s: result == SUCCESS,
                         haltOnFailure=True))
     self.addStep(
         MakeDirectory(dir='build',
                       hideStepIf=lambda result, s: result == SUCCESS,
                       haltOnFailure=True))
def openerp_command_initialize_tests(configurator, options,
                                     buildout_slave_path,
                                     environ=()):
    """Return steps to run bin/<PART>_command initialize --tests.

    Available manifest file options:

      :odoo.use-port: if set to ``true``, necessary free ports will be chosen,
                      and used in the test run.
                      See :func:`steps_odoo_port_reservation` for port
                      selection tuning options.
    """

    environ = dict(environ)

    steps = []

    buildout_part = options.get('buildout-part', DEFAULT_BUILDOUT_PART)
    command = ['bin/%s_command' % buildout_part, 'initialize',
               '--no-create', '--tests',
               '--database', WithProperties('%(testing_db)s')]
    modules = options.get('openerp-addons', 'all')
    if modules == 'all':
        command += ['--all-modules',
                    '--exclude', 'auth_ldap',
                    '--exclude', 'document_ftp']
    else:
        for module in modules.split(','):
            command += ['--module', module.strip()]

    if options.get('odoo.use-port', 'false').strip().lower() == 'true':
        steps.extend(steps_odoo_port_reservation(configurator, options,
                                                 environ=environ))
        command.append(WithProperties('--port=%(openerp_port)s'))

    steps.append(ShellCommand(command=command,
                              name='testing',
                              description='testing',
                              descriptionDone='tests',
                              haltOnFailure=True,
                              env=environ,
                              ))

    return steps
示例#49
0
def get_android_example_build_steps(name, description, command):
    from buildbot.steps.shell import ShellCommand
    from buildbot.process.properties import Interpolate

    return [
        ShellCommand(
            name=name,
            description=[description],
            descriptionDone=[name],
            workdir=Interpolate('%(prop:builddir)s/build/examples/android'),
            command=Interpolate(command),
            env={
                'PATH': Interpolate('%(prop:toolchain_path)s%(prop:PATH)s'),
                'NDK_MODULE_PATH': Interpolate('%(prop:builddir)s/install')
            },
            want_stdout=True,
            want_stderr=True,
            logEnviron=False)
    ]
示例#50
0
    def testCommand(self):
        f = BuildFactory()
        f.addStep(SetPropertyFromCommand(command=["echo", "value"], property="propname"))
        f.addStep(ShellCommand(command=["echo", WithProperties("%(propname)s")]))

        ss = mock.Mock(name="sourcestamp")
        ss.repository = 'repo'
        ss.changes = []
        ss.patch = ss.patch_info = None

        req = FakeBuildRequest("Testing", {ss.repository: ss}, None)

        b = f.newBuild([req])
        b.master = mock.Mock(name='master')
        b.build_status = FakeBuildStatus()
        b.slavebuilder = FakeSlaveBuilder()

        # This shouldn't raise an exception
        b.setupBuild(None)
 def update_repo(self, repo, branch='default'):
     workdir = repo.split("/")[-1]
     repourl = 'http://%s/%s' % (self.hgHost, repo)
     self.addStep(ShellCommand(
         name='%s_update' % workdir,
         command=['bash', '-c',
                  'if test -d %(workdir)s; then hg -R %(workdir)s pull; \
                  else hg clone --noupdate %(repourl)s %(workdir)s; fi && \
                  hg -R %(workdir)s up -C --rev %(branch)s' % locals()],
         timeout=3*60,
         descriptionDone="%s source" % workdir,
         workdir='.',
     ))
     self.addStep(SetProperty(
         name='set_%s_revision' % workdir,
         command=['hg', 'identify', '-i'],
         property='%s_revision' % workdir,
         workdir=workdir,
     ))
示例#52
0
def getShellCommandStep(f,
                        name,
                        command,
                        description="",
                        flunkOnFailure=True,
                        haltOnFailure=True,
                        alwaysRun=False,
                        workdir='scripts',
                        env=None):
    if env is None:
        env = {}
    f.addStep(ShellCommand(name=name,
                           command=command,
                           description=description,
                           env=env,
                           flunkOnFailure=flunkOnFailure,
                           haltOnFailure=haltOnFailure,
                           alwaysRun=alwaysRun,
                           workdir=workdir))
示例#53
0
def getPollyLNTFactory(triple, nt_flags, xfails=[], clean=False, test=False,
                       build_type="Release", extra_cmake_args=[], **kwargs):
    lnt_args = {}
    lnt_arg_names = ['submitURL', 'package_cache', 'testerName', 'reportBuildslave']

    for argname in lnt_arg_names:
        if argname in kwargs:
            lnt_args[argname] = kwargs.pop(argname)

    llvm_install_dir = 'stage1.install'

    f = ClangBuilder.getClangCMakeBuildFactory(
        test=False,
        useTwoStage=False,
        clean=clean,
        checkout_clang_tools_extra=False,
        checkout_compiler_rt=False,
        extra_cmake_args=extra_cmake_args,
        stage1_config=build_type)

    f.addStep(ShellCommand(name="install-llvm-and-clang",
                           command=["ninja", "install"],
                           haltOnFailure=True,
                           description=["install llvm and clang"],
                           workdir="stage1"))

    AddExternalPollyBuildFactory(f, llvm_install_dir, build_type)

    nt_flags.append('--cflag=' + '-Xclang')
    nt_flags.append('--cflag=' + '-load')
    nt_flags.append('--cflag=' + '-Xclang')
    nt_flags.append(WithProperties("--cflag=%s/polly.install/lib/LLVMPolly.so",
                                   'builddir'))

    # Add an LNT test runner.
    LNTBuilder.AddLNTTestsToFactory(f, nt_flags,
                                    cc_path=(llvm_install_dir+'/bin/clang'),
                                    cxx_path=(llvm_install_dir+'/bin/clang++'),
                                    **lnt_args);

    return f
示例#54
0
def sync_s3_debians(c, machines):
    with open(os.path.dirname(os.path.realpath(__file__)) +
              "/spec.yaml") as file:
        spec_list = yaml.full_load(file)

    f = BuildFactory()

    if spec_list["sync_s3"]:
        f.addStep(
            ShellCommand(
                name='s3-syncing',
                command=[
                    's3cmd', '--acl-public', '--delete-removed', '--verbose',
                    'sync', spec_list["local_repo_path"],
                    's3://{s3_bucket}'.format(s3_bucket=spec_list["s3_bucket"])
                ]))
    # Add to builders
    c['builders'].append(
        BuilderConfig(name='sync_s3_debians', slavenames=machines, factory=f))
    # return name of builder created
    return 'sync_s3_debians'
示例#55
0
def disable_intel_turbo_steps():
    steps = []
    steps.append(
        ShellCommand(
            name="disableintelturbo",
            command=[
                'bash', '-c',
                '(echo 0 | sudo /usr/bin/tee /sys/devices/system/cpu/cpufreq/boost) || (echo "only supported on Intel CPUs" && exit 1)'
            ],
            haltOnFailure=True))

    class AlwaysSuccessShellCommand(ShellCommand):
        def __init__(self, *args, **kwargs):
            ShellCommand.__init__(self, *args, **kwargs)

        def finished(self, _):
            ShellCommand.finished(self, SUCCESS)

    # cf. http://pm-blog.yarda.eu/2011/10/deeper-c-states-and-increased-latency.html
    # by keeping the file descriptor alive, we make sure that this setting is used.
    # after closing the file descriptor, the old setting will be restored by the
    # kernel module.
    steps.append(FileDownload('forcec0state.sh', 'forcec0state.sh'))

    # `setsid' is used in to escape the process group, otherwise it will be
    # killed by the timeout logic of AlwaysSuccessShellCommand. since the
    # parent process gets killed by it, we always force it to be
    # successful. (I wish there would be a nicer way to do it).
    steps.append(
        AlwaysSuccessShellCommand(name="forceC0state",
                                  command=[
                                      'sudo', '-b', '/bin/bash', '-c',
                                      'setsid bash -x ./forcec0state.sh'
                                  ],
                                  haltOnFailure=False,
                                  flunkOnFailure=False,
                                  timeout=5))

    return steps
示例#56
0
def masterConfig():
    c = {}
    from buildbot.config import BuilderConfig
    from buildbot.process.factory import BuildFactory
    from buildbot.plugins import schedulers

    c['schedulers'] = [
        schedulers.ForceScheduler(name="force", builderNames=["testy"])
    ]

    c['secretsProviders'] = [
        HashiCorpVaultSecretProvider(vaultToken='my_vaulttoken',
                                     vaultServer="http://localhost:8200")
    ]

    f = BuildFactory()
    f.addStep(ShellCommand(command=[Interpolate('echo %(secret:key)s')]))

    c['builders'] = [
        BuilderConfig(name="testy", workernames=["local1"], factory=f)
    ]
    return c
示例#57
0
def _make_factory_step_generator(project_name, project_git_uri, make_command=None, workdir="/srv/buildbot"):
    make_factory_steps = [
            Git(
                name = "Executing %s content fetch" % project_name,
                repourl=project_git_uri,
                mode='incremental'
                ),
            ShellCommand(
                name = "Executing %s: 'make %s'" % ( project_name, make_command ),
                command = [
                    "make",
                    make_command
                    ]
                ),
            DirectoryUpload(
                slavesrc="build",
                masterdest=Interpolate(
                    "/srv/output/%(kw:project_name)s/%(src::branch)s", 
                    ) 
                )
            ]
    return make_factory_steps
示例#58
0
def get_coverity_steps(link, type):
    from buildbot.steps.worker import RemoveDirectory
    from buildbot.steps.worker import MakeDirectory
    from buildbot.steps.shell import ShellCommand
    from buildbot.process.properties import Interpolate
    import private

    return [
        MakeDirectory(name='create build directory',
                      description=['preparing build directory'],
                      descriptionDone=['create build directory'],
                      dir=Interpolate('%(prop:builddir)s/build/build'),
                      hideStepIf=skipped_or_success),
        get_cmake_step(link, type, ['coverity']),
        get_build_step(link, type, ['coverity']),
        ShellCommand(
            name='coverity upload',
            description=['uploading to coverity'],
            descriptionDone=['upload to coverity'],
            hideStepIf=skipped_or_success,
            workdir=Interpolate('%(prop:builddir)s/build/build'),
            command=Interpolate(
                'cat cov-int/build-log.txt && tar czvf coverity-data.tgz cov-int && curl --form token=$COVERITY_TOKEN --form email=$COVERITY_EMAIL --form [email protected] --form version="%(prop:got_revision)s" --form description="Push to master" https://scan.coverity.com/builds?project=SFML%%2FSFML'
            ),
            env={
                'COVERITY_TOKEN': private.coverity_token,
                'COVERITY_EMAIL': private.coverity_email,
                'PATH': Interpolate('%(prop:toolchain_path)s%(prop:PATH)s')
            },
            want_stdout=True,
            want_stderr=True,
            logEnviron=False),
        RemoveDirectory(name='remove build directory',
                        description=['removing build directory'],
                        descriptionDone=['remove build directory'],
                        dir=Interpolate('%(prop:builddir)s/build/build'),
                        hideStepIf=skipped_or_success)
    ]
 def setup(self, parallel, branch, **kwargs):
     build_command = self.build_command + self.buildFlags
     test_command = self.test_command + self.testFlags
     clean_command = self.clean_command + self.cleanFlags
     if parallel:
         test_command.append(parallel)
     self.addStep(Compile(command=build_command))
     self.addStep(
         ShellCommand(
             name="pythoninfo",
             description="pythoninfo",
             command=self.python_command + ["-m", "test.pythoninfo"],
             warnOnFailure=True,
         ))
     # timeout is a bit more than the regrtest default timeout
     if self.test_timeout:
         timeout = self.test_timeout
     else:
         timeout = TEST_TIMEOUT
     if branch != "2.7":
         test_command += ["--timeout", timeout - (5 * 60)]
     self.addStep(Test(command=test_command, timeout=timeout))
     self.addStep(Clean(command=clean_command))
示例#60
0
def installTwistedTrunk():
    steps = []
    steps.append(
        Git(
            repourl=TWISTED_GIT,
            mode='full',
            method='fresh',
            codebase='twisted',
            workdir='Twisted',
            alwaysUseLatest=True,
        ))
    steps.append(
        ShellCommand(name='install-twisted-trunk',
                     description=['installing', 'twisted', 'trunk'],
                     descriptionDone=['install', 'twisted', 'trunk'],
                     command=[
                         virtualenvBinary('pip'), "install", "--no-index",
                         '--use-wheel', "-f",
                         "http://data.hybridcluster.net/python/", "."
                     ],
                     workdir='Twisted',
                     haltOnFailure=True))
    return steps