示例#1
0
 def __applyIndividualPatch__(self, patchInfo):
   """ double check to see if patch is already installed """
   if self.__isPatchInstalled__(patchInfo):
     return 0
   if not self.__isPatchReadyToInstall__(patchInfo):
     return -1
   """ generate Sha1 Sum for patch Info """
   self.generateSha1SumForPatchInfo(patchInfo)
   """ install the Patch """
   result = self.__installPatch__(patchInfo)
   if not result:
     errorMsg = ("Failed to install patch %s: KIDS %s" %
                (patchInfo.installName, patchInfo.kidsFilePath))
     logger.error(errorMsg)
     raise Exception(errorMsg)
   else:
     # also need to reload the package patch hist
     self.__reloadPackagePatchHistory__(patchInfo)
     """ special logic to handle release code """
     installed = False
     namespace,ver,patch = extractInfoFromInstallName(patchInfo.installName)
     if not patch:
       if namespace and ver:
         updVer = getPackageLatestVersionByNamespace(namespace,
                                                     self._testClient)
         if updVer and updVer == ver:
           installed = True
     if not installed:
       assert self.__isPatchInstalled__(patchInfo)
   return 1
示例#2
0
 def __applyIndividualPatch__(self, patchInfo):
   """ double check to see if patch is already installed """
   if self.__isPatchInstalled__(patchInfo):
     return 0
   if not self.__isPatchReadyToInstall__(patchInfo):
     return -1
   """ generate Sha1 Sum for patch Info """
   self.generateSha1SumForPatchInfo(patchInfo)
   """ install the Patch """
   result = self.__installPatch__(patchInfo)
   if not result:
     errorMsg = ("Failed to install patch %s: KIDS %s" %
                (patchInfo.installName, patchInfo.kidsFilePath))
     logger.error(errorMsg)
     raise Exception(errorMsg)
   else:
     # also need to reload the package patch hist
     self.__reloadPackagePatchHistory__(patchInfo)
     """ special logic to handle release code """
     installed = False
     namespace,ver,patch = extractInfoFromInstallName(patchInfo.installName)
     if not patch:
       if namespace and ver:
         updVer = getPackageLatestVersionByNamespace(namespace,
                                                     self._testClient)
         if updVer and updVer == ver:
           installed = True
     if not installed:
       assert self.__isPatchInstalled__(patchInfo)
   return 1
示例#3
0
 def __isPatchReadyToInstall__(self, patchInfo, patchList=None):
     packageName = patchInfo.package
     ver = patchInfo.version
     patchHist = self._vistaPatchInfo.getPackagePatchHistByName(
         packageName, ver)
     if not patchHist or not patchHist.hasPatchHistory():
         logger.info("no patch hist for %s, ver: %s" % (packageName, ver))
         return True  # if no such an package or hist info, just return True
     """ check patch sequence no to see if it is out of order """
     if patchInfo.seqNo:
         seqNo = patchHist.getLatestSeqNo()
         if patchInfo.seqNo < seqNo:
             logger.error(
                 "SeqNo out of order, %s less than latest one %s" %
                 (patchInfo.seqNo), seqNo)
             return False
     # check all the dependencies
     for item in patchInfo.depKIDSBuild:
         if patchList and item in self._patchSet:  # we are going to install the dep patch
             logger.info("We are going to install the patch %s" % item)
             """ make sure installation is in the right order """
             itemIndex = self.indexInPatchList(item, patchList)
             patchIndex = self.indexInPatchList(patchInfo.installName,
                                                patchList)
             if itemIndex >= patchIndex:
                 logger.warn("%s is out of order with %s" %
                             (item, patchInfo))
                 return False
             else:
                 continue
         (namespace, ver, patch) = extractInfoFromInstallName(item)
         if self._vistaPatchInfo.hasPatchInstalled(item, namespace, ver,
                                                   patch):
             logger.debug("%s is arelady installed" % item)
             continue
         installStatus = self._vistaPatchInfo.getInstallationStatus(item)
         if self._vistaPatchInfo.isInstallCompleted(installStatus):
             continue
         elif item in patchInfo.optionalDepSet:
             logger.warn(
                 "Patch specified in KIDS info file %s is not installed for %s"
                 % (item, patchInfo.installName))
             continue
         else:
             logger.error(
                 "dep %s is not installed for %s %s" %
                 (item, patchInfo.installName, patchInfo.kidsFilePath))
             patchInfo.depKIDSBuild.remove(item)
             patchInfo.depKIDSBuild.add(item + " <---")
             return False
     return True
示例#4
0
 def __reloadPackagePatchHistory__(self, patchInfo):
   patchHistInfo = self._vistaPatchInfo
   installNameList = []
   if patchInfo.isMultiBuilds:
     installNameList = patchInfo.multiBuildsList
   else:
     installNameList.append(patchInfo.installName)
   for installName in installNameList:
     (namespace,ver,patch) = extractInfoFromInstallName(installName)
     if not patchHistInfo.hasNamespace(namespace):
       patchHistInfo.createAllPackageMapping()
     if patchHistInfo.hasNamespace(namespace):
       packageName = patchHistInfo.getPackageName(namespace)
       patchHistInfo.getPackagePatchHistory(packageName, namespace, ver)
示例#5
0
 def __reloadPackagePatchHistory__(self, patchInfo):
     patchHistInfo = self._vistaPatchInfo
     installNameList = []
     if patchInfo.isMultiBuilds:
         installNameList = patchInfo.multiBuildsList
     else:
         installNameList.append(patchInfo.installName)
     for installName in installNameList:
         (namespace, ver, patch) = extractInfoFromInstallName(installName)
         if not patchHistInfo.hasNamespace(namespace):
             patchHistInfo.createAllPackageMapping()
         if patchHistInfo.hasNamespace(namespace):
             packageName = patchHistInfo.getPackageName(namespace)
             patchHistInfo.getPackagePatchHistory(packageName, namespace,
                                                  ver)
示例#6
0
 def __isPatchReadyToInstall__(self, patchInfo, patchList = None):
   packageName = patchInfo.package
   ver = patchInfo.version
   patchHist = self._vistaPatchInfo.getPackagePatchHistByName(packageName, ver)
   if not patchHist or not patchHist.hasPatchHistory():
     logger.info("no patch hist for %s, ver: %s" % (packageName, ver))
     return True # if no such an package or hist info, just return True
   """ check patch sequence no to see if it is out of order """
   if patchInfo.seqNo:
     seqNo = patchHist.getLatestSeqNo()
     if patchInfo.seqNo < seqNo:
       logger.error("SeqNo out of order, %s less than latest one %s" % (patchInfo.seqNo, seqNo))
       return False
   # check all the dependencies
   for item in patchInfo.depKIDSBuild:
     if patchList and item in self._patchSet: # we are going to install the dep patch
       logger.info("We are going to install the patch %s" % item)
       """ make sure installation is in the right order """
       itemIndex = self.indexInPatchList(item, patchList)
       patchIndex = self.indexInPatchList(patchInfo.installName, patchList)
       if itemIndex >= patchIndex:
         logger.warn("%s is out of order with %s" % (item, patchInfo))
         return False
       else:
         continue
     (namespace,ver,patch) = extractInfoFromInstallName(item)
     if self._vistaPatchInfo.hasPatchInstalled(item, namespace, ver, patch):
       logger.debug("%s is arelady installed" % item)
       continue
     installStatus = self._vistaPatchInfo.getInstallationStatus(item)
     if self._vistaPatchInfo.isInstallCompleted(installStatus):
       continue
     elif item in patchInfo.optionalDepSet:
       logger.warn("Patch specified in KIDS info file %s is not installed for %s" %
                   (item, patchInfo.installName))
       continue
     else:
       logger.error("dep %s is not installed for %s %s" %
                   (item, patchInfo.installName, patchInfo.kidsFilePath))
       patchInfo.depKIDSBuild.remove(item)
       patchInfo.depKIDSBuild.add(item+" <---")
       return False
   return True