Ejemplo n.º 1
0
 def getPR_CCB(self,
               cr_status="",
               for_review=False,
               cr_with_parent=False,
               cr_type="",
               list_cr_type=[],
               list_cr_status=[],
               list_cr_doamin=[]):
     """
     Create CR table for CCB minutes from Synergy query
     Useful Change keywords:
         %CR_detected_on
         %CR_implemented_for
         %problem_number
         %problem_synopsis
         %crstatus
         %CR_ECE_classification => Showstopper, etc.
         %CR_request_type => Defect or Evolution
         %CR_type => SW_ENM, SW_BITE, SW_WHCC, SW_PLAN etc...
         %CR_domain => EXCR, SCR, PLCDCR etc.
         %modify_time
     :param cr_status:
     :param for_review:
     :param cr_with_parent:
     :param cr_type:
     :return: tableau_pr,found_cr
     """
     tableau_pr = []
     found_cr = False
     # Header
     if cr_status is not None:
         query = 'query -sby crstatus  '
         if 0==1:
             condition,detect_attribut = self.new_createConditionStatus(detect_release=self.detect_release,
                                                                         impl_release=self.impl_release,
                                                                         cr_type=cr_type,
                                                                         old_cr_workflow=self.old_cr_workflow,
                                                                         cr_status=cr_status)
         else:
             condition,detect_attribut = self.new_createConditionStatus(old_cr_workflow=False,
                                                                    detect_release = self.detect_release,
                                                                    impl_release = self.impl_release,
                                                                    cr_type = cr_type,
                                                                    list_cr_type=list_cr_type,
                                                                    list_cr_status=list_cr_status,
                                                                    list_cr_doamin=list_cr_doamin,
                                                                    cr_status=cr_status
                                                                    )
         # Ajouter la gestion de l'ancien workflow
         classification = self.getClassif(self.old_cr_workflow)
         detect_attribut_tag = re.sub(r";","</cell><cell>",detect_attribut)
         attributes = '-f "<cell>%problem_number</cell>' \
                      '<cell>%CR_type</cell>' \
                      '<cell>%problem_synopsis</cell>' \
                      '<cell>%crstatus</cell>' \
                      '<cell>{:s}</cell>' \
                      '<cell>%CR_request_type</cell>' \
                      '<cell>%CR_domain</cell>' \
                      '<cell>{:s}</cell>' \
                      '<cell>%impact_analysis</cell>' \
                      '"'.format(classification,detect_attribut_tag)
         query += " {:s} {:s} ".format(condition,attributes)
         print "QUERY:",query
         stdout,stderr = self.ccm_query(query,"Get PRs")
         self.ihm.log(query + " completed.")
         self.list_change_requests = []
         if stdout != "":
             output = stdout.splitlines()
             for line in output:
                 line = re.sub(r"<void>",r"",line)
                 cr_decod = self._parseCRCell(line)
                 if cr_decod != []:
                     found_cr = True
                     dico = {}
                     dico["cr_id"] = cr_decod[0]
                     dico["cr_type"] = cr_decod[1]
                     # remove ASCI control character
                     dico["cr_synopsis"] = filter(string.printable[:-5].__contains__,cr_decod[2])
                     dico["status"] = self.discardCRPrefix(cr_decod[3])
                     dico["cr_request_type"] = cr_decod[5]
                     dico["cr_domain"] = cr_decod[6]
                     dico["cr_detected_on"] = cr_decod[7]
                     dico["cr_implemented_for"] = cr_decod[8]
                     #dico["impact_analysis"] = cr_decod[9]
                     impact_analysis = self.replaceBeacon(cr_decod[9])
                     impact_analysis = Tool.adjustCR(impact_analysis)
                     #print "impact_analysis",impact_analysis
                     # Impact Sw,HW or PLD
                     impact_match = re.findall(r'(SW|HW|PLD) impact ?: ?([Y|y][E|e][S|s]|[N|n][O|o]n?e?)',impact_analysis)
                     # Result example: [('SW', 'yes'), ('HW', 'no'), ('PLD', 'yes')]
                     dico["impact_analysis"] = impact_match
                     #print "IMPACT",dico["impact_analysis"]
                     severity = re.sub(r"<void>",r"",cr_decod[4])
                     dico["cr_severity"] = severity
                     dico["info_parent_cr"] = ""
                     self.createCRlist(dico["cr_id"],
                                       dico["cr_synopsis"],
                                       self.list_change_requests)
                     # Get User selection ?
                     if self.list_cr_for_ccb_available:
                         if dico["cr_id"] in self.list_cr_for_ccb:
                             if cr_with_parent:
                                 info_parent_cr = self.getParentCR(dico["cr_id"])
                                 dico["info_parent_cr"] = info_parent_cr
                             result = self.fillPRTable(for_review,
                                                       cr_with_parent,
                                                       dico)
                             tableau_pr.append(result)
                         else:
                             print "CR discarded",dico["cr_id"]
                     else:
                         # No, get all CR from query
                         self.list_cr_for_ccb.append(dico["cr_id"])
                         if cr_with_parent:
                             info_parent_cr = self.getParentCR(dico["cr_id"])
                             dico["info_parent_cr"] = info_parent_cr
                         result = self.fillPRTable(for_review,
                                                         cr_with_parent,
                                                         dico)
                         tableau_pr.append(result)
                 else:
                     # Remove ASCII control characters
                     filtered_line = filter(string.printable[:-5].__contains__,line)
                     print "Functional impact:",filtered_line
                     result = self.fillPRTable(for_review,
                                               cr_with_parent)
                     tableau_pr.append(result)
             self.list_cr_for_ccb.sort()
             self.list_change_requests.sort()
     if len(tableau_pr) == 0:
         result = self.fillPRTable(for_review,
                                   cr_with_parent)
         tableau_pr.append([result])
     # Set scrollbar at the bottom
     self.ihm.defill()
     return tableau_pr,found_cr