Beispiel #1
0
def push_component(comp, sb, to, validate_status=True):
    if validate_status and _complain_component_not_clean(comp, sb, 'push'):
        return
    aspects = get_vcs_component_aspects(comp, sb)
    wr = vcs.get_working_repository()
    for a in aspects:
        if a.startswith(component.BUILT_ASPECT_NAME) or a == component.REPORT_ASPECT_NAME:
            continue
        path = sb.get_component_path(comp, a)
        if to:
            location=BranchInfo(branchname=to, componentname=comp, aspectname=a).get_branchdir(wr.master_reporoot)
        else:
            location=BranchInfo(branchname=sb.get_branch(), componentname=comp, aspectname=a).get_branchdir(wr.master_reporoot)
        print('  ' + _get_relative_path(sb, comp, a))
        vcs.push(path, location=location)
Beispiel #2
0
def push_component(comp, sb, to, validate_status=True):
    if validate_status and _complain_component_not_clean(comp, sb, 'push'):
        return
    aspects = get_vcs_component_aspects(comp, sb)
    wr = vcs.get_working_repository()
    for a in aspects:
        if a.startswith(component.BUILT_ASPECT_NAME
                        ) or a == component.REPORT_ASPECT_NAME:
            continue
        path = sb.get_component_path(comp, a)
        if to:
            location = BranchInfo(branchname=to,
                                  componentname=comp,
                                  aspectname=a).get_branchdir(
                                      wr.master_reporoot)
        else:
            location = BranchInfo(branchname=sb.get_branch(),
                                  componentname=comp,
                                  aspectname=a).get_branchdir(
                                      wr.master_reporoot)
        print('  ' + _get_relative_path(sb, comp, a))
        vcs.push(path, location=location)
Beispiel #3
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
Beispiel #4
0
def report(sb, state):
    rr = sb.get_report_root()
    root = sb.get_root()
    need_checkin = vcs.folder_is_tied_to_vcs(rr)
    try:
        # Get latest version of reports so we are less likely to cause merge
        # conflicts.
        wr = vcs.get_working_repository()
        use_master = False
        if not need_checkin:
            url = os.path.join(
                wr.master_reporoot,
                sb.get_branch(),
                sb.get_top_component(),
                'report',
            ).replace('\\', '/')
            publish.create_branch(url, False)
            use_master = True
        wr.create_or_update_checkout(rr,
                                     sb.get_top_component(),
                                     'report',
                                     sb.get_branch(),
                                     None,
                                     use_master=use_master)
        need_checkin = vcs.folder_is_tied_to_vcs(rr)
        # Report our results.
        bi = buildinfo.BuildInfo()
        machineFolder = os.path.join(rr, bi.host).replace('\\', '/')
        summary = EvalSummary(sb.get_build_id(),
                              sb.get_sandboxtype().get_style(), bi.host,
                              state.phase, state.reason, state.start_time,
                              state.timestamps,
                              sb.get_targeted_platform_variant(), bi.os,
                              bi.bitness, bi.version)
        db = Dashboard(rr)
        db.add_summary(summary)
        if os.path.exists(os.path.join(root, 'eval-log.txt')):
            shutil.copy2(os.path.join(root, 'eval-log.txt'), machineFolder)
        # Check in our changes.
        if need_checkin:
            status = vcs.get_status(rr)
            if 'unknown' in status:
                vcs.add(rr)
            vcs.checkin(rr, msg="update dashboard", quiet_stderr=True)
            try:
                vcs.push(rr)
            except BzrCommandError, e:
                if 'diverged' in ("%s" % e):
                    print "\nAttemping to resolve diverged report aspect"
                    print "\nNuking report dir %s" % rr
                    if not ioutil.nuke(rr):
                        print "\nAuto resolving diverged report aspect failed!"

                    bi = BranchInfo(branchname=sb.get_branch(),
                                    componentname=sb.get_top_component(),
                                    aspectname='report')
                    aspectdir = bi.get_branchdir(wr.local_reporoot)
                    print "\nNuking report repo %s" % aspectdir
                    if not ioutil.nuke(aspectdir):
                        print "\nAuto resolving diverged report aspect failed!"

                    # Use the master because we have a problem here.
                    wr.create_local_branch(sb.get_top_component(),
                                           'report',
                                           sb.get_branch(),
                                           use_master=True)
                    wr.create_or_update_checkout(rr,
                                                 sb.get_top_component(),
                                                 'report',
                                                 sb.get_branch(),
                                                 None,
                                                 use_master=True)

                    db = Dashboard(rr)
                    db.add_summary(summary)
                    if os.path.exists(os.path.join(root, 'eval-log.txt')):
                        shutil.copy2(os.path.join(root, 'eval-log.txt'),
                                     machineFolder)

                    status = vcs.get_status(rr)
                    if 'unknown' in status:
                        vcs.add(rr)
                    vcs.checkin(rr, msg="update dashboard", quiet_stderr=True)
                    vcs.push(rr)
                    print "\nAuto resolve diverged report aspect success!"
                else:
                    raise e
    except:
        traceback.print_exc()
Beispiel #5
0
def report(sb, state):
    rr = sb.get_report_root()
    root = sb.get_root()
    need_checkin = vcs.folder_is_tied_to_vcs(rr)
    try:
        # Get latest version of reports so we are less likely to cause merge
        # conflicts.
        wr = vcs.get_working_repository()
        use_master = False
        if not need_checkin:
            url = os.path.join(wr.master_reporoot, sb.get_branch(), sb.get_top_component(), 'report', ). replace('\\', '/')
            publish.create_branch(url, False)
            use_master = True
        wr.create_or_update_checkout(rr, sb.get_top_component(), 'report', sb.get_branch(), None, use_master=use_master)
        need_checkin = vcs.folder_is_tied_to_vcs(rr)
        # Report our results.
        bi = buildinfo.BuildInfo()
        machineFolder = os.path.join(rr, bi.host).replace('\\', '/')
        summary = EvalSummary(sb.get_build_id(), sb.get_sandboxtype().get_style(), bi.host,
                              state.phase, state.reason, state.start_time,
                              state.timestamps, sb.get_targeted_platform_variant(),
                              bi.os, bi.bitness, bi.version)
        db = Dashboard(rr)
        db.add_summary(summary)
        if os.path.exists(os.path.join(root, 'eval-log.txt')):
            shutil.copy2(os.path.join(root, 'eval-log.txt'), machineFolder)
        # Check in our changes.
        if need_checkin:
            status = vcs.get_status(rr)
            if 'unknown' in status:
                vcs.add(rr)
            vcs.checkin(rr, msg="update dashboard", quiet_stderr=True)
            try:
                vcs.push(rr)
            except BzrCommandError, e:
                if 'diverged' in ("%s" % e):
                    print "\nAttemping to resolve diverged report aspect"
                    print "\nNuking report dir %s" % rr
                    if not ioutil.nuke(rr):
                        print "\nAuto resolving diverged report aspect failed!"

                    bi = BranchInfo(branchname=sb.get_branch(), componentname=sb.get_top_component(), aspectname='report')
                    aspectdir = bi.get_branchdir(wr.local_reporoot)
                    print "\nNuking report repo %s" % aspectdir
                    if not ioutil.nuke(aspectdir):
                        print "\nAuto resolving diverged report aspect failed!"

                    # Use the master because we have a problem here.
                    wr.create_local_branch(sb.get_top_component(), 'report', sb.get_branch(), use_master=True)
                    wr.create_or_update_checkout(rr, sb.get_top_component(), 'report', sb.get_branch(), None, use_master=True)

                    db = Dashboard(rr)
                    db.add_summary(summary)
                    if os.path.exists(os.path.join(root, 'eval-log.txt')):
                        shutil.copy2(os.path.join(root, 'eval-log.txt'), machineFolder)

                    status = vcs.get_status(rr)
                    if 'unknown' in status:
                        vcs.add(rr)
                    vcs.checkin(rr, msg="update dashboard", quiet_stderr=True)
                    vcs.push(rr)
                    print "\nAuto resolve diverged report aspect success!"
                else:
                    raise e
    except:
        traceback.print_exc()