Ejemplo n.º 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))
Ejemplo n.º 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 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))
Ejemplo n.º 3
0
def downloadAllKIDSSha1File(topDir, cacheDir):
  from ConvertToExternalData import isValidKIDSBuildSha1Suffix
  from ConvertToExternalData import readSha1SumFromSha1File
  import shutil
  initConsoleLogging()
  absCurDir = os.path.abspath(topDir)
  for (root, dirs, files) in os.walk(absCurDir):
    for f in files:
      if not isValidKIDSBuildSha1Suffix(f):
        continue
      filePath = os.path.join(root, f)
      sha1Sum = readSha1SumFromSha1File(filePath)
      result, extFilePath = obtainKIDSBuildFileBySha1(filePath, sha1Sum, cacheDir)
      if result:
        destFile = filePath[:filePath.rfind('.')]
        if os.path.exists(destFile) and generateSha1Sum(destFile) == sha1Sum:
          logger.info("%s is already current" % destFile)
          continue
        logger.info("%s => %s" % (extFilePath, destFile))
        shutil.copyfile(extFilePath, destFile)