예제 #1
0
 def git_clean(self):
     cd_cmd = self.cd_to_code()
     # note: we put clean_garbage before clean so the latter won't complain about these directories
     clean_garbage_cmd = "rm -rf .dotest"  # FIXME there's probably other types of garbage
     clean_cmd = "git clean -f"
     retcodes = ClusterRun(
         self.config,
         ClusterRunConcatCommands([cd_cmd, clean_garbage_cmd, clean_cmd]))
     return ClusterRunSummaryCode(retcodes)
예제 #2
0
 def apply_patch_mail(self, patch_file):
     ClusterSCP(self.config, [
         patch_file, "remote:" + self.remote_directory() + "/" + patch_file
     ])
     cd_cmd = self.cd_to_code()
     patch_cmd = "git am " + patch_file
     retcodes = ClusterRun(self.config,
                           ClusterRunConcatCommands([cd_cmd, patch_cmd]))
     return ClusterRunSummaryCode(retcodes)
예제 #3
0
 def checkout(self):
     checkout_cmd = "git clone " + self.config.repository + " " + self.config.code_dir
     cd_cmd = self.cd_to_code()
     branch_cmd = "git branch _cluster origin/" + self.config.branch
     checkout_branch_cmd = "git checkout _cluster"
     retcodes = ClusterRun(
         self.config,
         ClusterRunConcatCommands(
             [checkout_cmd, cd_cmd, branch_cmd, checkout_branch_cmd]))
     return ClusterRunSummaryCode(retcodes)
예제 #4
0
 def clean(self):
     cd_code_cmd = self.cd_to_code()
     cd_build_cmd = self.cd_to_build()
     clean_cmd = "make clean "
     cache_cmd = "rm -f CMakeCache.txt"
     retcodes = ClusterRun(
         self.config,
         ClusterRunConcatCommands(
             [cd_code_cmd, clean_cmd, cd_build_cmd, cache_cmd]))
     return ClusterRunSummaryCode(retcodes)
예제 #5
0
 def build(self, build_type='Default', with_timestamp=True):
     cd_code_cmd = self.cd_to_code()
     cd_build_cmd = self.cd_to_build()
     build_cmd = "%s cmake -DCMAKE_BUILD_TYPE=%s -DCBR_TIMESTAMP_PACKETS=%s ." % (
         self.ccache_args(), build_type, str(with_timestamp))
     make_cmd = "make -j2"
     retcodes = ClusterRun(
         self.config,
         ClusterRunConcatCommands(
             [cd_code_cmd, cd_build_cmd, build_cmd, make_cmd]))
     return ClusterRunSummaryCode(retcodes)
예제 #6
0
    def profile(self, binary):
        cd_code_cmd = self.cd_to_code()
        cd_scripts_cmd = self.cd_to_scripts()
        prof_cmd = "gprof ../build/cmake/%s > gprof.out" % (binary)
        retcodes = ClusterRun(
            self.config,
            ClusterRunConcatCommands([cd_code_cmd, cd_scripts_cmd, prof_cmd]))

        gprof_pattern = "gprof-%(node)04d.txt"
        ClusterSCP(self.config, [
            "remote:" + self.config.code_dir + "/scripts/gprof.out",
            gprof_pattern
        ])

        return ClusterRunSummaryCode(retcodes)
예제 #7
0
    def oprofile(self, binary):
        cd_code_cmd = self.cd_to_code()
        cd_scripts_cmd = self.cd_to_scripts()
        prof_cmd = "opreport \\*cbr\\* > oprofile.out"
        prof_cmd += "; opreport -l \\*cbr\\* >> oprofile.out"
        retcodes = ClusterRun(
            self.config,
            ClusterRunConcatCommands([cd_code_cmd, cd_scripts_cmd, prof_cmd]))

        oprof_pattern = "oprofile-%(node)04d.txt"
        ClusterSCP(self.config, [
            "remote:" + self.config.code_dir + "/scripts/oprofile.out",
            oprof_pattern
        ])

        return ClusterRunSummaryCode(retcodes)
예제 #8
0
    def ccache_args(self):
        if (not self.config.ccache):
            return ''

        # FIXME caching this somewhere would probably be wise...
        retcodes = ClusterRun(
            self.config,
            ClusterRunConcatCommands(
                ["ls /usr/bin/ccache /usr/bin/g++ /usr/bin/gcc &> /dev/null"]))
        # FIXME we should do this per-node, but cluster_run doesn't support that yet for per-node runs
        if (ClusterRunSummaryCode(retcodes) == 0):
            # We have all the pieces we need
            return 'CC="/usr/bin/ccache /usr/bin/gcc" CXX="/usr/bin/ccache /usr/bin/g++"'

        print 'Warning: Running without ccache!'
        return ""
예제 #9
0
 def update(self, with_submodules=True):
     cd_cmd = self.cd_to_code()
     fetch_cmd = "git fetch origin"
     pull_cmd = "git pull origin master"
     reset_cmd = ""
     if self.is_submodule:
         reset_cmd = "git checkout origin/master"
     submodules_init_cmd = ""
     submodules_update_cmd = ""
     if with_submodules:
         submodules_init_cmd = "git submodule init"
         submodules_update_cmd = "git submodule update"
     retcodes = ClusterRun(
         self.config,
         ClusterRunConcatCommands([
             cd_cmd, fetch_cmd, pull_cmd, reset_cmd, submodules_init_cmd,
             submodules_update_cmd
         ]))
     return ClusterRunSummaryCode(retcodes)
예제 #10
0
    def apply_patchset(self):
        # Setup all possible necessary commands, then filter out based on files
        file_cmds = [('git am', self.patchmail_file),
                     ('patch -p1 <', self.patch_file)]
        to_do = [(cmd, file) for (cmd, file) in file_cmds
                 if os.stat(file)[stat.ST_SIZE] > 0]

        # Copy files over
        scp_args = [file for (cmd, file) in to_do]
        scp_args.append("remote:" + self.remote_directory() + "/")
        ClusterSCP(self.config, scp_args)

        # Perform actual patching
        cd_cmd = self.cd_to_code()
        patch_cmds = [(cmd + ' ' + file) for (cmd, file) in to_do]

        cmds = [cd_cmd]
        cmds.extend(patch_cmds)

        retcodes = ClusterRun(self.config, ClusterRunConcatCommands(cmds))
        return ClusterRunSummaryCode(retcodes)
예제 #11
0
 def reset_to_origin_head(self):
     cd_cmd = self.cd_to_code()
     reset_cmd = "git reset --hard origin/" + self.config.branch
     retcodes = ClusterRun(self.config,
                           ClusterRunConcatCommands([cd_cmd, reset_cmd]))
     return ClusterRunSummaryCode(retcodes)
예제 #12
0
 def revert_patchset(self):
     retcodes = []
     for rep in self.repositories:
         retcodes.append(rep.revert_patchset())
     return ClusterRunSummaryCode(retcodes)
예제 #13
0
 def dependencies(self):
     cd_cmd = self.cd_to_code()
     build_cmd = "make minimal-depends"
     retcodes = ClusterRun(self.config,
                           ClusterRunConcatCommands([cd_cmd, build_cmd]))
     return ClusterRunSummaryCode(retcodes)
예제 #14
0
 def destroy(self):
     destroy_cmd = "rm -rf " + self.config.code_dir
     retcodes = ClusterRun(self.config, destroy_cmd)
     return ClusterRunSummaryCode(retcodes)