示例#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
示例#2
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
示例#3
0
def _check_app_checked_out():
    if not os.path.isdir(os.path.join(APP_FOLDER, '.bzr')):
        eprintc('''
Sadm has not been installed with a bzr checkout command. This will prevent sadm
from updating itself. Recommended install command for sadm is:
    bzr co --lightweight %s/sadm/built.%s/trunk <installdir>''' % (
                DEFAULT_MASTER_REPOROOT, buildinfo.get_natural_platform_variant()),
                                                                ERROR_COLOR)
        sys.exit(1)
    else:
        print('\nSadm has been installed correctly with a bzr checkout.')
示例#4
0
 def get_targeted_platform_variant(self):
     """
     Return the platform variant that's currently being targeted by this
     sandbox. This identifier (e.g., "linux_x86-64" or "win_32") is opaque
     to the build system, and does not obey any consistent rules across
     platforms.
     """
     global _TPV
     tpv = self._get_conf(_SETTINGS_SECTION, _PLATFORM_VARIANT_KEY)
     if tpv is None:
         if _TPV is None:
             _TPV = buildinfo.get_natural_platform_variant()
         tpv = _TPV
     return tpv
示例#5
0
 def get_targeted_platform_variant(self):
     '''
     Return the platform variant that's currently being targeted by this
     sandbox. This identifier (e.g., "linux_x86-64" or "win_32") is opaque
     to the build system, and does not obey any consistent rules across
     platforms.
     '''
     global _TPV
     tpv = self._get_conf(_SETTINGS_SECTION, _PLATFORM_VARIANT_KEY)
     if tpv is None:
         if _TPV is None:
             _TPV = buildinfo.get_natural_platform_variant()
         tpv = _TPV
     return tpv
示例#6
0
def checkin(sb, folder_to_publish, dry_run):
    msg = str(sb.get_build_id())
    if buildinfo.get_natural_platform_variant() != sb.get_targeted_platform_variant():
        msg += ' ' + sb.get_targeted_platform_variant()
    msg = '%s from %s' % (msg, str(buildinfo.BuildInfo()))
    cmd = 'bzr ci -m "%s"' % msg
    vprint(cmd, verbosity=1)
    err = 0
    if not dry_run:
        try:
            vcs.checkin(folder_to_publish, msg)
            push_loc = '%s%s/%s/built.%s' % (DEFAULT_ARCHIVE_REPO, sb.get_branch(),  # fix_julie repo structure knowledge
                                             sb.get_top_component(),
                                             sb.get_targeted_platform_variant())
            vcs.push(folder_to_publish, push_loc)
        except:
            txt = traceback.format_exc()
            if 'PointlessCommit' in txt:
                vprint('No changes need to be committed.', verbosity=1)
            else:
                raise
    return err
示例#7
0
 def test_get_default_platform_variant(self):
     self.assertTrue(buildinfo.get_natural_platform_variant() in buildinfo.get_known_platform_variants())
示例#8
0
 def test_get_built_root(self):
     root = _makeroot('/sandboxes/foo.trunk.quick/')
     x = sandbox.Sandbox(root)
     self.assertEqual(root + sandbox._BUILTROOT[0:-1] + '.' + buildinfo.get_natural_platform_variant() + '/', x.get_built_root())