def approved(self):
     try:
         self.underlayer.format_patch(self)
         self.backport_change.topic ='automated_proposal'
         self.backport_change.upload(reviewers=self.backport_change.reviewers, successremove=False)
     except UploadError:
         log.error("Mannaggai")
     message = self.backport_change.post_create_comment['message']
     self.backport_change.comment(message, code_review=self.backport_change.post_create_comment['Code-Review'], verified=self.backport_change.post_create_comment['Verified'])
     self.comment("backport-id: %s" % self.backport_change.uuid)
 def approved(self):
     try:
         self.sync_replica()
     except RecombinationSyncReplicaError:
         log.error("Replica could not be synced")
     self.update_target_branch()
     try:
         self.submit()
     except RecombinationSubmitError:
         log.error("Recombination not submitted")
示例#3
0
 def poll_replica(self, patches_branch=None):
     log.info("Scanning replica repos for new patches")
     for project_name in self.projects:
         try:
             project = self.projects[project_name]
             project.scan_replica_patches(patches_branch=patches_branch)
         except Exception, e:
             traceback.print_exc(file=sys.stdout)
             log.error(e)
             logsummary.error("Project %s skipped, reason: %s" %
                              (project_name, e))
 def missing(self):
     try:
         self.attempt()
     except AttemptError:
         log.error("Recombination attempt unsuccessful")
         raise UploadError
     try:
         self.upload()
     except UploadError:
         log.error("upload of recombination with change %s did not succeed. Exiting" % self.uuid)
         raise UploadError
 def follow_backport_status(self):
     if self.backport_change.remote_status == "MERGED":
         try:
             self.submit()
         except RecombinationSubmitError:
             log.error("Recombination not submitted")
     elif self.backport_change.remote_status == "ABANDONED":
         try:
             self.abandon()
         except RecombinationAbandonedError:
             log.error("Recombination not abandoned")
示例#6
0
 def check_approved_recombinations(self, recomb_id=None):
     log.info("Checking for approved recombinations to handle")
     for project_name in self.projects:
         try:
             log.info("Checking project '%s'" % project_name)
             project = self.projects[project_name]
             project.check_approved_recombinations(recomb_id=recomb_id)
         except Exception, e:
             traceback.print_exc(file=sys.stdout)
             log.error(e)
             logsummary.error("Project %s skipped, reason: %s" %
                              (project_name, e))
示例#7
0
 def poll_original(self):
     logsummary.info(
         'Polling original for new changes. Checking status of all changes.'
     )
     for project_name in self.projects:
         try:
             logsummary.info('Polling project: %s' % project_name)
             project = self.projects[project_name]
             project.poll_original_branches()
         except Exception, e:
             traceback.print_exc(file=sys.stdout)
             log.error(e)
             logsummary.error("Project %s skipped, reason: %s" %
                              (project_name, e))
 def approved(self):
     if self.mutation_change.remote_status != "MERGED":
         try:
             self.mutation_change.approve()
             self.mutation_change.submit()
         except RecombinationApproveError:
             log.error("Originating change approval failed")
         except RecombinationSubmitError:
             log.error("Originating change submission failed")
     self.update_target_branch()
     if self.remote_status != "MERGED":
         self.submit()
     else:
         log.warning("Recombination already submitted")
 def load_change_data(self, change_data):
     """ Common load operations for all recombination types """
     self.load_data(change_data)
     log.debug(self.commit_message)
     try:
         metadata = yaml.load(self.commit_message)
     except (ValueError, yaml.scanner.ScannerError,yaml.parser.ParserError):
         log.error("commit message not in yaml")
         raise DecodeError
     header = metadata['Recombination']
     recomb_header = header.split('~')[0]
     metadata['recomb-type'] = re.sub(':[a-zA-Z0-9]{6}', '',recomb_header)
     if 'recombine-status' in metadata:
         self.status = metadata['recombine-status']
     metadata.update(self.analyze_comments())
     self.set_status(metadata=metadata)
     return metadata
示例#10
0
    def __init__(self,
                 projects_conf,
                 base_dir,
                 filter_projects=None,
                 filter_method=None,
                 filter_branches=None,
                 fetch=True):
        self.projects = dict()
        self.projects_conf = projects_conf
        self.base_dir = base_dir
        # extract reverse dependencies
        for project in self.projects_conf:
            self.projects_conf[project]["rev-deps"] = {}
        for project in self.projects_conf:
            if "test-teps" in self.projects_conf[project]:
                for test_dep in self.projects_conf[project]["test-deps"]:
                    rev_dep = {
                        project: {
                            "tags":
                            self.projects_conf[project]["test-deps"][test_dep],
                            "tests":
                            self.projects_conf[project]["replica"]["tests"]
                        }
                    }
                    self.projects_conf[test_dep]["rev-deps"].update(rev_dep)

        # restrict project to operate on
        projects = copy.deepcopy(projects_conf)
        project_list = list(projects)
        if filter_method:
            new_projects = dict()
            log.info('Filtering projects with watch method: %s' %
                     filter_method)
            for project_name in projects:
                if projects[project_name]['original'][
                        'watch-method'] == filter_method:
                    new_projects[project_name] = projects[project_name]
            projects = new_projects
        if filter_projects:
            new_projects = dict()
            log.info('Filtering projects with names: %s' % filter_projects)
            project_names = filter_projects.split(',')
            for project_name in project_names:
                if project_name not in project_list:
                    log.error(
                        "Project %s is not present in projects configuration" %
                        project_name)
                try:
                    new_projects[project_name] = projects[project_name]
                except KeyError:
                    log.warning(
                        "Project %s already discarded by previous filter" %
                        project_name)
            projects = new_projects
        if filter_branches:
            log.info("Filtering branches: %s" % filter_branches)
            branches = filter_branches.split(',')
            for project_name in projects:
                projects[project_name]['original']['watch-branches'] = branches

        if not projects:
            log.error("Project list to operate on is empty")
            raise ValueError
        log.debugvar('projects')

        logsummary.info(
            "initializing and updating local repositories for relevant projects"
        )

        for project_name in projects:
            try:
                self.projects[project_name] = Project(project_name,
                                                      projects[project_name],
                                                      self.base_dir + "/" +
                                                      project_name,
                                                      fetch=fetch)
                logsummary.info("Project: %s initialized" % project_name)
            except Exception, e:
                traceback.print_exc(file=sys.stdout)
                log.error(e)
                logsummary.error("Project %s skipped, reason: %s" %
                                 (project_name, e))