def main():
  testClientParser = createTestClientArgParser()
  parser = argparse.ArgumentParser(description='Default KIDS Installer',
                                   parents=[testClientParser])
  parser.add_argument('kidsFile', help='path to KIDS Build file')
  parser.add_argument('-l', '--logFile', default=None, help='path to logFile')
  parser.add_argument('-r', '--reinstall', default=False, action='store_true',
                help='whether re-install the KIDS even it is already installed')
  parser.add_argument('-g', '--globalFiles', default=None, nargs='*',
                      help='list of global files that need to import')

  result = parser.parse_args();
  print (result)
  testClient = VistATestClientFactory.createVistATestClientWithArgs(result)
  assert testClient
  initConsoleLogging()
  with testClient:
    kidsFile = os.path.abspath(result.kidsFile)
    from KIDSBuildParser import KIDSBuildParser
    kidsParser = KIDSBuildParser(None)
    kidsParser.unregisterSectionHandler(KIDSBuildParser.ROUTINE_SECTION)
    kidsParser.parseKIDSBuild(kidsFile)
    installNameList = kidsParser.installNameList
    installName = installNameList[0]
    multiBuildList = installNameList
    if len(installNameList) == 1:
      multiBuildList = None
    defaultKidsInstall = DefaultKIDSBuildInstaller(kidsFile,
                                           installName,
                                           logFile=result.logFile,
                                           multiBuildList=multiBuildList,
                                           globals=result.globalFiles)
    defaultKidsInstall.runInstallation(testClient, result.reinstall)
Exemple #2
0
  def __parseAllKIDSBuildFilesList__(self):
    for basename in self._kidsBuildFileDict.iterkeys():
      kidsFile, sha1Path = self._kidsBuildFileDict[basename]
      if kidsFile == None:
        logger.error("No KIDS file available for name %s" % basename)
        continue
      installNameList, seqNo, kidsBuilds = None, None, None
      if isValidKIDSBuildHeaderSuffix(kidsFile):
        from KIDSBuildParser import loadMetaDataFromJSON
        #continue
        installNameList, seqNo, kidsBuilds = loadMetaDataFromJSON(kidsFile)
      else:
        kidsParser = KIDSBuildParser(None)
        kidsParser.unregisterSectionHandler(KIDSBuildParser.ROUTINE_SECTION)
        kidsParser.parseKIDSBuild(kidsFile)
        installNameList = kidsParser.installNameList
        logger.debug("install name list is %s" % installNameList)
        seqNo = kidsParser.seqNo
        kidsBuilds = kidsParser.kidsBuilds
      if len(installNameList) > 1:
        if not self._multiBuildDict.get(kidsFile):
          self._multiBuildDict[kidsFile] = installNameList
        else:
          assert self._multiBuildDict[kidsFile] == installNameList
      elif seqNo:
        if installNameList[0] not in self._installNameSeqMap:
          self._installNameSeqMap[installNameList[0]] = seqNo
        else:
          logger.error("Duplicated KIDS build file %s" % kidsFile)
      for installName in installNameList:
        if installName in self._kidsInstallNameDict:
          logger.warn("%s is already in the dict %s" % (installName, kidsFile))
        logger.debug("Added installName %s, file %s" % (installName, kidsFile))
        self._kidsInstallNameDict[installName] = os.path.normpath(kidsFile)
        """ handle KIDS sha1 file Path """
        if sha1Path:
          if installName in self._kidsInstallNameSha1Dict:
            logger.warn("%s is already in the dict %s" % (installName, sha1Path))
          self._kidsInstallNameSha1Dict[installName] = sha1Path
        """ update kids dependency """
        if installName in self._kidsDepBuildDict:
          logger.warn("%s already has the dep map %s" %
                      (installName, self._kidsDepBuildDict[installName]))
        if kidsBuilds:
          for kidsBuild in kidsBuilds:
            if kidsBuild.installName == installName:
              depList = kidsBuild.dependencyList
              if depList:
                self._kidsDepBuildDict[installName] = set([x[0] for x in
                  depList])
                logger.info("%s: %s" % (installName,
                  self._kidsDepBuildDict[installName]))

    logger.debug("%s" % sorted(self._kidsInstallNameDict.keys()))
    logger.info("Total # of install name %d" % len(self._kidsInstallNameDict))
 def convertKIDSBuildFile(self, kidsFile):
   from KIDSBuildParser import KIDSBuildParser, outputMetaDataInJSON
   assert os.path.exists(kidsFile)
   """ write KIDS metadata file """
   kidsParser = KIDSBuildParser(None)
   """ do not parse the routine part """
   kidsParser.unregisterSectionHandler(KIDSBuildParser.ROUTINE_SECTION)
   kidsParser.parseKIDSBuild(kidsFile)
   logger.info("output meta data as %s" % (kidsFile+".json"))
   outputMetaDataInJSON(kidsParser, kidsFile+".json")
   self.convertToSha1File(kidsFile)
def main():
    testClientParser = createTestClientArgParser()
    parser = argparse.ArgumentParser(description="Default KIDS Installer", parents=[testClientParser])
    parser.add_argument("kidsFile", help="path to KIDS Build file")
    parser.add_argument("-l", "--logFile", default=None, help="path to logFile")
    parser.add_argument(
        "-r",
        "--reinstall",
        default=False,
        action="store_true",
        help="whether re-install the KIDS even it is already installed",
    )
    parser.add_argument(
        "-t", "--tglobalprint", default=None, help="folder to hold a printout of Transport global information"
    )
    parser.add_argument("-g", "--globalFiles", default=None, nargs="*", help="list of global files that need to import")
    parser.add_argument("-d", "--duz", default=DEFAULT_INSTALL_DUZ, type=int, help="installer's VistA instance's DUZ")

    result = parser.parse_args()
    print(result)
    testClient = VistATestClientFactory.createVistATestClientWithArgs(result)
    assert testClient
    initConsoleLogging()
    with testClient:
        kidsFile = os.path.abspath(result.kidsFile)
        from KIDSBuildParser import KIDSBuildParser

        kidsParser = KIDSBuildParser(None)
        kidsParser.unregisterSectionHandler(KIDSBuildParser.ROUTINE_SECTION)
        kidsParser.parseKIDSBuild(kidsFile)
        installNameList = kidsParser.installNameList
        installName = installNameList[0]
        multiBuildList = installNameList
        if len(installNameList) == 1:
            multiBuildList = None
        defaultKidsInstall = DefaultKIDSBuildInstaller(
            kidsFile,
            installName,
            logFile=result.logFile,
            multiBuildList=multiBuildList,
            duz=result.duz,
            globals=result.globalFiles,
            printTG=result.tglobalprint,
        )
        defaultKidsInstall.runInstallation(testClient, result.reinstall)
Exemple #5
0
def main():
    testClientParser = createTestClientArgParser()
    parser = argparse.ArgumentParser(description='Default KIDS Installer',
                                     parents=[testClientParser])
    parser.add_argument('kidsFile', help='path to KIDS Build file')
    parser.add_argument('-l',
                        '--logFile',
                        default=None,
                        help='path to logFile')
    parser.add_argument(
        '-r',
        '--reinstall',
        default=False,
        action='store_true',
        help='whether re-install the KIDS even it is already installed')
    parser.add_argument(
        '-t',
        '--tglobalprint',
        default=None,
        help='folder to hold a printout of Transport global information')
    parser.add_argument('-g',
                        '--globalFiles',
                        default=None,
                        nargs='*',
                        help='list of global files that need to import')
    parser.add_argument('-d',
                        '--duz',
                        default=DEFAULT_INSTALL_DUZ,
                        type=int,
                        help='installer\'s VistA instance\'s DUZ')

    result = parser.parse_args()
    print(result)
    testClient = VistATestClientFactory.createVistATestClientWithArgs(result)
    assert testClient
    initConsoleLogging()
    with testClient:
        kidsFile = os.path.abspath(result.kidsFile)
        from KIDSBuildParser import KIDSBuildParser
        kidsParser = KIDSBuildParser(None)
        kidsParser.unregisterSectionHandler(KIDSBuildParser.ROUTINE_SECTION)
        kidsParser.parseKIDSBuild(kidsFile)
        installNameList = kidsParser.installNameList
        installName = installNameList[0]
        multiBuildList = installNameList
        if len(installNameList) == 1:
            multiBuildList = None
        defaultKidsInstall = DefaultKIDSBuildInstaller(
            kidsFile,
            installName,
            logFile=result.logFile,
            multiBuildList=multiBuildList,
            duz=result.duz,
            globals=result.globalFiles,
            printTG=result.tglobalprint)
        defaultKidsInstall.runInstallation(testClient, result.reinstall)
Exemple #6
0
  def __parseAllKIDSBuildFilesList__(self):
    for basename in self._kidsBuildFileDict.iterkeys():
      kidsFile, sha1Path = self._kidsBuildFileDict[basename]
      if kidsFile == None:
        logger.error("No KIDS file available for name %s" % basename)
        continue
      installNameList, seqNo, kidsBuilds = None, None, None
      if isValidKIDSBuildHeaderSuffix(kidsFile):
        from KIDSBuildParser import loadMetaDataFromJSON
        #continue
        installNameList, seqNo, kidsBuilds = loadMetaDataFromJSON(kidsFile)
      else:
        kidsParser = KIDSBuildParser(None)
        kidsParser.unregisterSectionHandler(KIDSBuildParser.ROUTINE_SECTION)
        kidsParser.parseKIDSBuild(kidsFile)
        installNameList = kidsParser.installNameList
        logger.debug("install name list is %s" % installNameList)
        seqNo = kidsParser.seqNo
        kidsBuilds = kidsParser.kidsBuilds
      if len(installNameList) > 1:
        if not self._multiBuildDict.get(kidsFile):
          self._multiBuildDict[kidsFile] = installNameList
        else:
          assert self._multiBuildDict[kidsFile] == installNameList
      elif seqNo:
        if installNameList[0] not in self._installNameSeqMap:
          self._installNameSeqMap[installNameList[0]] = seqNo
        else:
          logger.error("Duplicated KIDS build file %s" % kidsFile)
      for installName in installNameList:
        if installName in self._kidsInstallNameDict:
          logger.warn("%s is already in the dict %s" % (installName, kidsFile))
        logger.debug("Added installName %s, file %s" % (installName, kidsFile))
        self._kidsInstallNameDict[installName] = os.path.normpath(kidsFile)
        """ handle KIDS sha1 file Path """
        if sha1Path:
          if installName in self._kidsInstallNameSha1Dict:
            logger.warn("%s is already in the dict %s" % (installName, sha1Path))
          self._kidsInstallNameSha1Dict[installName] = sha1Path
        """ update kids dependency """
        if installName in self._kidsDepBuildDict:
          logger.warn("%s already has the dep map %s" %
                      (installName, self._kidsDepBuildDict[installName]))
        if kidsBuilds:
          for kidsBuild in kidsBuilds:
            if kidsBuild.installName == installName:
              depList = kidsBuild.dependencyList
              if depList:
                self._kidsDepBuildDict[installName] = set([x[0] for x in
                  depList])
                logger.info("%s: %s" % (installName,
                  self._kidsDepBuildDict[installName]))

    logger.debug("%s" % sorted(self._kidsInstallNameDict.keys()))
    logger.info("Total # of install name %d" % len(self._kidsInstallNameDict))
Exemple #7
0
 def convertKIDSBuildFile(self, kidsFile):
     from KIDSBuildParser import KIDSBuildParser, outputMetaDataInJSON
     assert os.path.exists(kidsFile)
     """ write KIDS metadata file """
     kidsParser = KIDSBuildParser(None)
     """ do not parse the routine part """
     kidsParser.unregisterSectionHandler(KIDSBuildParser.ROUTINE_SECTION)
     kidsParser.parseKIDSBuild(kidsFile)
     logger.info("output meta data as %s" % (kidsFile + ".json"))
     outputMetaDataInJSON(kidsParser, kidsFile + ".json")
     self.convertToSha1File(kidsFile)
Exemple #8
0
                    help='Path to the .KIDS file')
parser.add_argument('-o',
                    required=True,
                    dest='outputDir',
                    help='Path to folder to store output files')
#parser.add_argument('-find', required=False, dest='Ffile',
#                    help='Filepath to the Output file of the RFind function.')
#parser.add_argument('-check', required=False, dest='Cfile',
#                    help='Filepath to the Output file of the RCheck function.')
result = parser.parse_args()

# Create a test client and run the KIDSBuildParser on the supplied KIDS build
testClient = VistATestClientFactory.createVistATestClientWithArgs(result)
assert testClient
with testClient:
    KIDSParser = KIDSBuildParser(result.outputDir)
    KIDSParser.parseKIDSBuild(result.KIDSbuild)
    KIDSParser.printResult()
    for root, dirnames, filenames in os.walk(result.outputDir):
        for filename in fnmatch.filter(filenames, '*.m'):
            name, ext = filename.split('.')
            routineset.append(name)
    print "Writing out intial XINDEX information: Start"
    FullXINDEX(testClient, result.outputDir, routineset)
    print "Writing out intial XINDEX information: Done"
    resultsfolder = os.path.join(result.outputDir, "RCheck_RFind")
    try:
        os.mkdir(resultsfolder)
    except:
        pass
    if testClient.isCache():
                                 parents=[testClientParser])
parser.add_argument('-kb', required=True, dest='KIDSbuild',
                    help='Path to the .KIDS file')
parser.add_argument('-o', required=True, dest='outputDir',
                    help='Path to folder to store output files')
#parser.add_argument('-find', required=False, dest='Ffile',
#                    help='Filepath to the Output file of the RFind function.')
#parser.add_argument('-check', required=False, dest='Cfile',
#                    help='Filepath to the Output file of the RCheck function.')
result = parser.parse_args()

# Create a test client and run the KIDSBuildParser on the supplied KIDS build
testClient = VistATestClientFactory.createVistATestClientWithArgs(result)
assert testClient
with testClient:
  KIDSParser = KIDSBuildParser(result.outputDir)
  KIDSParser.parseKIDSBuild(result.KIDSbuild)
  KIDSParser.printResult()
  for root,dirnames,filenames in os.walk(result.outputDir):
    for filename in fnmatch.filter(filenames,'*.m'):
      name,ext = filename.split('.')
      routineset.append(name)
  print "Writing out intial XINDEX information: Start"
  FullXINDEX(testClient,result.outputDir,routineset)
  print "Writing out intial XINDEX information: Done"
  resultsfolder = os.path.join(result.outputDir,"RCheck_RFind")
  try:
    os.mkdir(resultsfolder)
  except:
    pass
  if testClient.isCache():