Example #1
0
def check_tools(required_tools, targeted_platform_variant=None, quiet=False):
    exitcode = 0
    # Only test the highest version of each tool -- and only do so once per tool.
    required_tools = get_unique_tools_with_greatest_version(required_tools)
    required_tools_name_width = 10
    if required_tools:
        required_tools_name_width = max(
            [len(tool.tool) for tool in required_tools]) + 1
    if not targeted_platform_variant:
        targeted_platform_variant = buildinfo.get_natural_platform_variant()
    else:
        targeted_platform_variant = buildinfo.fuzzy_match_platform_variant(
            targeted_platform_variant)
    if required_tools:
        for tool in required_tools:
            if tool.platforms is None and tool.verify is None:
                if not quiet:
                    eprintc(
                        '''No information for %s.
Please provide information to be able to verify that %s
is properly set up on this machine.''' % (tool.tool, tool.tool), ERROR_COLOR)
                exitcode = 1
            else:
                platforms = buildinfo.get_implied_platform_variants(
                    tool.platforms)
                #print('tool %s has implied platforms %s; looking for %s' % (tool.tool, '|'.join(platforms), targeted_platform_variant))
                if targeted_platform_variant in platforms:
                    if verify_command_in_path(tool,
                                              required_tools_name_width,
                                              quiet=quiet):
                        exitcode = 1
    if os.name == 'nt':
        if os.path.exists(os.path.join(os.getcwd(), 'TempWmicBatchFile.bat')):
            os.remove(os.path.join(os.getcwd(), 'TempWmicBatchFile.bat'))
    return exitcode
Example #2
0
 def get_required_tools(self, tool_types="build|test", targeted_platform_variant=None):
     """
     Return a dict, indexed by tool type, where values are lists of tools
     required by this sandbox.
     @param targeted_platform_variant If None, the sandbox's active tpv
     is used as the platform on which the tools are required.
     """
     if type(tool_types) != type([]):
         tool_types = tool_types.split("|")
     if not targeted_platform_variant:
         targeted_platform_variant = self.get_targeted_platform_variant()
     else:
         targeted_platform_variant = buildinfo.fuzzy_match_platform_variant(targeted_platform_variant)
     tdict = {}
     for ttype in tool_types:
         tdict[ttype] = []
     comps = self.get_cached_components()
     if comps:
         comps = [(c.name, c.reused_aspect) for c in comps]
     else:
         comps = self.get_on_disk_components()
         comps = [(c, self.get_component_reused_aspect(c)) for c in comps]
     for cc in comps:
         path = self.get_component_path(cc[0], cc[1])
         for ttype in tool_types:
             # print('checking %s for %s tools' % (path, ttype))
             section = metadata.get_section_info_from_disk("%s tools" % ttype, path)
             if section:
                 for tool, info in section.iteritems():
                     # print('found ' + str((tool, info)))
                     tdict[ttype].append(check_tools.ReqTool.from_pair(tool, info))
     for ttype in tdict:
         tdict[ttype] = check_tools.get_unique_tools_with_greatest_version(tdict[ttype])
     return tdict
Example #3
0
def check_tools(required_tools, targeted_platform_variant=None, quiet=False):
    exitcode = 0
    # Only test the highest version of each tool -- and only do so once per tool.
    required_tools = get_unique_tools_with_greatest_version(required_tools)
    required_tools_name_width = 10
    if required_tools:
        required_tools_name_width = max([len(tool.tool) for tool in required_tools]) + 1
    if not targeted_platform_variant:
        targeted_platform_variant = buildinfo.get_natural_platform_variant()
    else:
        targeted_platform_variant = buildinfo.fuzzy_match_platform_variant(targeted_platform_variant)
    if required_tools:
        for tool in required_tools:
            if tool.platforms is None and tool.verify is None:
                if not quiet:
                    eprintc('''No information for %s.
Please provide information to be able to verify that %s
is properly set up on this machine.''' % (tool.tool, tool.tool), ERROR_COLOR)
                exitcode = 1
            else:
                platforms = buildinfo.get_implied_platform_variants(tool.platforms)
                #print('tool %s has implied platforms %s; looking for %s' % (tool.tool, '|'.join(platforms), targeted_platform_variant))
                if targeted_platform_variant in platforms:
                    if verify_command_in_path(tool, required_tools_name_width, quiet=quiet):
                        exitcode = 1
    if os.name == 'nt':
        if os.path.exists(os.path.join(os.getcwd(), 'TempWmicBatchFile.bat')):
            os.remove(os.path.join(os.getcwd(), 'TempWmicBatchFile.bat'))
    return exitcode
Example #4
0
def _aggregate_status(summaries):
    reasons = []
    when = 0
    for s in summaries:
        if when < s.get_end_time():
            when = s.get_end_time()
        hostdescrip = s.os + ' ' + s.version + ' ' + s.bitness
        # To keep this from becoming too verbose, only display target if
        # it's different from the one implied by the OS.
        implied_variant = buildinfo.fuzzy_match_platform_variant(s.os + ' ' + s.bitness)
        if implied_variant != s.tpv:
            hostdescrip += ' targeting %s' % (s.os + ' ' + s.version + ' ' + s.bitness, s.tpv)
        reason = '%s (%s) on %s (%s): %s.' % (s.build_id, s.style, s.host, hostdescrip, s.failure_reason)
        reasons.append(reason)
    return Status(summaries[0].get_imputed_result(), reasons, when)
Example #5
0
def _aggregate_status(summaries):
    reasons = []
    when = 0
    for s in summaries:
        if when < s.get_end_time():
            when = s.get_end_time()
        hostdescrip = s.os + ' ' + s.version + ' ' + s.bitness
        # To keep this from becoming too verbose, only display target if
        # it's different from the one implied by the OS.
        implied_variant = buildinfo.fuzzy_match_platform_variant(s.os + ' ' +
                                                                 s.bitness)
        if implied_variant != s.tpv:
            hostdescrip += ' targeting %s' % (s.os + ' ' + s.version + ' ' +
                                              s.bitness, s.tpv)
        reason = '%s (%s) on %s (%s): %s.' % (s.build_id, s.style, s.host,
                                              hostdescrip, s.failure_reason)
        reasons.append(reason)
    return Status(summaries[0].get_imputed_result(), reasons, when)
Example #6
0
 def get_required_tools(self,
                        tool_types='build|test',
                        targeted_platform_variant=None):
     '''
     Return a dict, indexed by tool type, where values are lists of tools
     required by this sandbox.
     @param targeted_platform_variant If None, the sandbox's active tpv
     is used as the platform on which the tools are required.
     '''
     if type(tool_types) != type([]):
         tool_types = tool_types.split('|')
     if not targeted_platform_variant:
         targeted_platform_variant = self.get_targeted_platform_variant()
     else:
         targeted_platform_variant = buildinfo.fuzzy_match_platform_variant(
             targeted_platform_variant)
     tdict = {}
     for ttype in tool_types:
         tdict[ttype] = []
     comps = self.get_cached_components()
     if comps:
         comps = [(c.name, c.reused_aspect) for c in comps]
     else:
         comps = self.get_on_disk_components()
         comps = [(c, self.get_component_reused_aspect(c)) for c in comps]
     for cc in comps:
         path = self.get_component_path(cc[0], cc[1])
         for ttype in tool_types:
             #print('checking %s for %s tools' % (path, ttype))
             section = metadata.get_section_info_from_disk(
                 '%s tools' % ttype, path)
             if section:
                 for tool, info in section.iteritems():
                     #print('found ' + str((tool, info)))
                     tdict[ttype].append(
                         check_tools.ReqTool.from_pair(tool, info))
     for ttype in tdict:
         tdict[ttype] = check_tools.get_unique_tools_with_greatest_version(
             tdict[ttype])
     return tdict
Example #7
0
 def test_fuzzy_match_platform_variant_bitness_only(self):
     if EXPECTED_NAME == 'Windows':
         self.assertEquals("win_32", buildinfo.fuzzy_match_platform_variant('32'))
         self.assertEquals("win_32", buildinfo.fuzzy_match_platform_variant('x86'))
         self.assertEquals("win_32", buildinfo.fuzzy_match_platform_variant('32-bit'))
         self.assertEquals("win_x64", buildinfo.fuzzy_match_platform_variant('64'))
         self.assertEquals("win_x64", buildinfo.fuzzy_match_platform_variant('x86-64'))
         self.assertEquals("win_x64", buildinfo.fuzzy_match_platform_variant('x64'))
     elif EXPECTED_NAME == 'Linux':
         self.assertEquals("linux_i686", buildinfo.fuzzy_match_platform_variant('32'))
         self.assertEquals("linux_i686", buildinfo.fuzzy_match_platform_variant('x86'))
         self.assertEquals("linux_i686", buildinfo.fuzzy_match_platform_variant('32-bit'))
         self.assertEquals("linux_x86-64", buildinfo.fuzzy_match_platform_variant('64'))
         self.assertEquals("linux_x86-64", buildinfo.fuzzy_match_platform_variant('x86-64'))
         self.assertEquals("linux_x86-64", buildinfo.fuzzy_match_platform_variant('x64'))
     else:
         self.assertEquals("osx_universal", buildinfo.fuzzy_match_platform_variant('osx'))
Example #8
0
 def test_fuzzy_match_platform_variant_with_None(self):
     self.assertEquals(None, buildinfo.fuzzy_match_platform_variant('unknown'))
Example #9
0
 def test_fuzzy_match_platform_variant_with_named_platform(self):
     self.assertEquals("win_32", buildinfo.fuzzy_match_platform_variant('W32'))
     self.assertEquals("win_32", buildinfo.fuzzy_match_platform_variant('win_32'))
     self.assertEquals("win_32", buildinfo.fuzzy_match_platform_variant('Windows-x86'))
     self.assertEquals("win_32", buildinfo.fuzzy_match_platform_variant('32-bit windows'))
     self.assertEquals("win_x64", buildinfo.fuzzy_match_platform_variant('WIN_64'))
     self.assertEquals("win_x64", buildinfo.fuzzy_match_platform_variant('win_x86-64'))
     self.assertEquals("win_x64", buildinfo.fuzzy_match_platform_variant('Windows-x64'))
     self.assertEquals("win_x64", buildinfo.fuzzy_match_platform_variant('w64'))
     self.assertEquals("linux_i686", buildinfo.fuzzy_match_platform_variant('l32'))
     self.assertEquals("linux_i686", buildinfo.fuzzy_match_platform_variant('lInUX-32'))
     self.assertEquals("linux_i686", buildinfo.fuzzy_match_platform_variant('linux_i586'))
     self.assertEquals("linux_i686", buildinfo.fuzzy_match_platform_variant('lini386'))
     self.assertEquals("osx_universal", buildinfo.fuzzy_match_platform_variant('osx'))
     self.assertEquals("osx_universal", buildinfo.fuzzy_match_platform_variant('Mac OSX 10'))
     self.assertEquals("osx_universal", buildinfo.fuzzy_match_platform_variant('mac'))