Example #1
0
  def __getAllKIDSBuildInfoAndOtherFileList__(self, patchDir):
    assert os.path.exists(patchDir)
    absPatchDir = os.path.abspath(patchDir)
    for (root, dirs, files) in os.walk(absPatchDir):
      lastDir = os.path.split(root)[-1]
      for fileName in files:
        absFilename = os.path.join(root, fileName)
        if not isValidPatchRelatedFiles(absFilename, True):
          continue
        """ Handle KIDS build files """
        if isValidKIDSBuildSuffix(fileName):
          logger.debug("Adding %s KIDS file to dict" % absFilename)
          self.__addKidsBuildFileToDict__(fileName, absFilename,
                                          KIDS_BUILD_FILE_TYPE_KIDS)
          continue
        """ Handle KIDS build HEADER files """
        if isValidKIDSBuildHeaderSuffix(fileName):
          logger.debug("Adding %s KIDS header to dict" % absFilename)
          kidsFileName = fileName[0:fileName.rfind('.')]
          self.__addKidsBuildFileToDict__(kidsFileName, absFilename,
                                          KIDS_BUILD_FILE_TYPE_HEADER)
          continue
        """ Handle KIDS build Sha1 files """
        if isValidKIDSBuildSha1Suffix(fileName):
          logger.debug("Adding %s KIDS info to dict" % absFilename)
          kidsFileName = fileName[0:fileName.rfind('.')]
          self.__addKidsBuildFileToDict__(kidsFileName, absFilename,
                                          KIDS_BUILD_FILE_TYPE_SHA1)
          continue
        """ Handle KIDS Info/Sha1 files """
        if ( isValidPatchInfoSuffix(fileName) or
             isValidPatchInfoSha1Suffix(fileName) ):
          self._kidsInfoFileList.append(absFilename)
          continue
        """ Handle Global/Sha1 Files """
        if ( isValidGlobalFileSuffix(fileName) or
             isValidGlobalSha1Suffix(fileName) ):
          logger.debug("Adding %s Global files to list" % absFilename)
          self._globalFilesSet.add(absFilename)
          continue
        """ handle all csv files """
        if isValidCSVSuffix(fileName):
          if isValidOrderCSVFile(absFilename):
            self._csvOrderFileList.append(absFilename)
            continue
        """ Handle .py files """
        if isValidPythonSuffix(fileName):
          logger.debug("Adding %s python script to list" % absFilename)
          self._pythonScriptList.append(absFilename)
          continue

    logger.info("Total # of KIDS Builds are %d" % len(self._kidsBuildFileDict))
    logger.info("Total # of KIDS Info are %d" % len(self._kidsInfoFileList))
    logger.info("Total # of Global files are %d" % len(self._globalFilesSet))
    logger.info("Total # of Python files are %d" % len(self._pythonScriptList))
    logger.info("Total # of CSV files are %d" % len(self._csvOrderFileList))
Example #2
0
  def __getAllKIDSBuildInfoAndOtherFileList__(self, patchDir):
    assert os.path.exists(patchDir)
    absPatchDir = os.path.abspath(patchDir)
    for (root, dirs, files) in os.walk(absPatchDir):
      lastDir = os.path.split(root)[-1]
      for fileName in files:
        absFilename = os.path.join(root, fileName)
        if not isValidPatchRelatedFiles(absFilename, True):
          continue
        """ Handle KIDS build files """
        if isValidKIDSPatchSuffix(fileName):
          logger.debug("Adding %s KIDS file to dict" % absFilename)
          self.__addKidsBuildFileToDict__(fileName, absFilename,
                                          KIDS_BUILD_FILE_TYPE_KIDS)
          continue
        """ Handle KIDS build HEADER files """
        if isValidKIDSPatchHeaderSuffix(fileName):
          logger.debug("Adding %s KIDS header to dict" % absFilename)
          kidsFileName = fileName[0:fileName.rfind('.')]
          self.__addKidsBuildFileToDict__(kidsFileName, absFilename,
                                          KIDS_BUILD_FILE_TYPE_HEADER)
          continue
        """ Handle KIDS build Sha1 files """
        if isValidKIDSPatchSha1Suffix(fileName):
          logger.debug("Adding %s KIDS info to dict" % absFilename)
          kidsFileName = fileName[0:fileName.rfind('.')]
          self.__addKidsBuildFileToDict__(kidsFileName, absFilename,
                                          KIDS_BUILD_FILE_TYPE_SHA1)
          continue
        """ Handle KIDS Info/Sha1 files """
        if ( isValidKIDSInfoSuffix(fileName) or
             isValidKIDSInfoSha1Suffix(fileName) ):
          self._kidsInfoFileList.append(absFilename)
          continue
        """ Handle Global/Sha1 Files """
        if ( isValidGlobalFileSuffix(fileName) or
             isValidGlobalSha1Suffix(fileName) ):
          logger.debug("Adding %s Global files to list" % absFilename)
          self._globalFilesSet.add(absFilename)
          continue
        """ handle all csv files """
        if isValidCSVSuffix(fileName):
          if isValidOrderCSVFile(absFilename):
            self._csvOrderFileList.append(absFilename)
            continue
        """ Handle .py files """
        if isValidPythonSuffix(fileName):
          logger.debug("Adding %s python script to list" % absFilename)
          self._pythonScriptList.append(absFilename)
          continue

    logger.info("Total # of KIDS Builds are %d" % len(self._kidsBuildFileDict))
    logger.info("Total # of KIDS Info are %d" % len(self._kidsInfoFileList))
    logger.info("Total # of Global files are %d" % len(self._globalFilesSet))
    logger.info("Total # of Python files are %d" % len(self._pythonScriptList))
    logger.info("Total # of CSV files are %d" % len(self._csvOrderFileList))
    def __getGlobalFileList__(self):
        globalFiles = []
        if self._globalFiles is None or len(self._globalFiles) == 0:
            return globalFiles
        for gFile in self._globalFiles:
            if isValidGlobalFileSuffix(gFile):
                globalFiles.append(gFile)
                continue
            if isValidGlobalSha1Suffix(gFile):  # external file
                sha1Sum = readSha1SumFromSha1File(gFile)
                (result, path) = obtainKIDSBuildFileBySha1(gFile, sha1Sum, DEFAULT_CACHE_DIR)
                if not result:
                    logger.error("Could not obtain global file for %s" % gFile)
                    raise Exception("Error getting global file for %s" % gFile)
                globalFiles.append(path)

        if len(globalFiles) > 0:
            logger.info("global file lists %s" % globalFiles)
        return globalFiles
Example #4
0
    def __getGlobalFileList__(self):
        globalFiles = []
        if self._globalFiles is None or len(self._globalFiles) == 0:
            return globalFiles
        for gFile in self._globalFiles:
            if isValidGlobalFileSuffix(gFile):
                globalFiles.append(gFile)
                continue
            if isValidGlobalSha1Suffix(gFile):  # external file
                sha1Sum = readSha1SumFromSha1File(gFile)
                (result,
                 path) = obtainKIDSPatchFileBySha1(gFile, sha1Sum,
                                                   DEFAULT_CACHE_DIR)
                if not result:
                    logger.error("Could not obtain global file for %s" % gFile)
                    raise Exception("Error getting global file for %s" % gFile)
                globalFiles.append(path)

        if len(globalFiles) > 0:
            logger.info("global file lists %s" % globalFiles)
        return globalFiles