Пример #1
0
    def tarExternals(self, releaseVersion):
        externalsVersion = self.relConf.getExtenalsVersion(releaseVersion)
        platform = Platform.getPlatformString()
        availableExternals = self.getAvailableExternals()

        if not externalsVersion:
            gLogger.notice("Externals is not defined for release %s" %
                           releaseVersion)
            return False

        for externalType in self.cliParams.externalsBuildType:
            requestedExternals = (externalType, externalsVersion, platform,
                                  'python%s' % self.cliParams.externalsPython)
            requestedExternalsString = "-".join(list(requestedExternals))
            gLogger.notice("Trying to compile %s externals..." %
                           requestedExternalsString)
            if not self.cliParams.forceExternals and requestedExternals in availableExternals:
                gLogger.notice(
                    "Externals %s is already compiled, skipping..." %
                    (requestedExternalsString))
                continue
            compileScript = os.path.join(os.path.dirname(__file__),
                                         "dirac-compile-externals")
            if not os.path.isfile(compileScript):
                compileScript = os.path.join(os.path.dirname(__file__),
                                             "dirac-compile-externals.py")
            compileTarget = os.path.join(self.cliParams.destination, platform)
            cmdArgs = []
            cmdArgs.append("-D '%s'" % compileTarget)
            cmdArgs.append("-t '%s'" % externalType)
            cmdArgs.append("-v '%s'" % externalsVersion)
            cmdArgs.append("-i '%s'" % self.cliParams.externalsPython)
            if cliParams.externalsLocation:
                cmdArgs.append("-e '%s'" % self.cliParams.externalsLocation)
            if cliParams.makeJobs:
                cmdArgs.append("-j '%s'" % self.cliParams.makeJobs)
            compileCmd = "%s %s" % (compileScript, " ".join(cmdArgs))
            gLogger.info(compileCmd)
            if os.system(compileCmd):
                gLogger.error("Error while compiling externals!")
                sys.exit(1)
            tarfilePath = os.path.join(
                self.cliParams.destination,
                "Externals-%s.tar.gz" % (requestedExternalsString))
            result = Distribution.createTarball(
                tarfilePath, compileTarget,
                os.path.join(self.cliParams.destination, "mysql"))
            if not result['OK']:
                gLogger.error(
                    "Could not generate tarball for package %s" % package,
                    result['Error'])
                sys.exit(1)
            os.system("rm -rf '%s'" % compileTarget)

        return True
Пример #2
0
  def tarExternals(self, releaseVersion):
    externalsVersion = self.relConf.getExtenalsVersion(releaseVersion)
    platform = Platform.getPlatformString()
    availableExternals = self.getAvailableExternals()

    if not externalsVersion:
      gLogger.notice("Externals is not defined for release %s" % releaseVersion)
      return False

    for externalType in self.cliParams.externalsBuildType:
      requestedExternals = (externalType, externalsVersion, platform, 'python%s' % self.cliParams.externalsPython)
      requestedExternalsString = "-".join(list(requestedExternals))
      gLogger.notice("Trying to compile %s externals..." % requestedExternalsString)
      if not self.cliParams.forceExternals and requestedExternals in availableExternals:
        gLogger.notice("Externals %s is already compiled, skipping..." % (requestedExternalsString))
        continue
      compileScript = os.path.join(os.path.dirname(__file__), "dirac-compile-externals")
      if not os.path.isfile(compileScript):
        compileScript = os.path.join(os.path.dirname(__file__), "dirac-compile-externals.py")
      compileTarget = os.path.join(self.cliParams.destination, platform)
      cmdArgs = []
      cmdArgs.append("-D '%s'" % compileTarget)
      cmdArgs.append("-t '%s'" % externalType)
      cmdArgs.append("-v '%s'" % externalsVersion)
      cmdArgs.append("-i '%s'" % self.cliParams.externalsPython)
      if cliParams.externalsLocation:
        cmdArgs.append("-e '%s'" % self.cliParams.externalsLocation)
      if cliParams.makeJobs:
        cmdArgs.append("-j '%s'" % self.cliParams.makeJobs)
      compileCmd = "%s %s" % (compileScript, " ".join(cmdArgs))
      gLogger.info(compileCmd)
      if os.system(compileCmd):
        gLogger.error("Error while compiling externals!")
        sys.exit(1)
      tarfilePath = os.path.join(self.cliParams.destination, "Externals-%s.tar.gz" % (requestedExternalsString))
      result = Distribution.createTarball(tarfilePath,
                                          compileTarget,
                                          os.path.join(self.cliParams.destination, "mysql"))
      if not result['OK']:
        gLogger.error("Could not generate tarball for package %s" % requestedExternalsString, result['Error'])
        sys.exit(1)
      os.system("rm -rf '%s'" % compileTarget)

    return True