Пример #1
0
    def _buildPackage(self):
        try:
            self.sandbox.create(self.package + "-" + self.version)

            tUtils = ToolChainUtils(self.logName, self.logPath)
            if self.sandbox.hasToolchain():
                tUtils.installExtraToolchainRPMS(self.sandbox, self.package,
                                                 self.version)
            else:
                tUtils.installToolchainRPMS(self.sandbox,
                                            self.package,
                                            self.version,
                                            availablePackages=self.doneList)

            self._installDependencies(constants.buildArch)
            if constants.crossCompiling:
                self._installDependencies(constants.targetArch)

            pkgUtils = PackageUtils(self.logName, self.logPath)
            pkgUtils.adjustGCCSpecs(self.sandbox, self.package, self.version)
            pkgUtils.buildRPMSForGivenPackage(self.sandbox, self.package,
                                              self.version, self.logPath)
            self.logger.debug("Successfully built the package: " +
                              self.package)
        except Exception as e:
            self.logger.error("Failed while building package: " + self.package)
            self.logger.debug("Sandbox: " + self.sandbox.getID() +
                              " not deleted for debugging.")
            logFileName = os.path.join(self.logPath, self.package + ".log")
            fileLog = os.popen('tail -n 100 ' + logFileName).read()
            self.logger.info(fileLog)
            raise e
        if self.sandbox:
            self.sandbox.destroy()
Пример #2
0
    def _buildPackage(self):
        try:
            self.sandbox.create(self.package + "-" + self.version)

            tUtils = ToolChainUtils(self.logName, self.logPath)
            if self.sandbox.hasToolchain():
                tUtils.installExtraToolchainRPMS(self.sandbox, self.package, self.version)
            else:
                tUtils.installToolchainRPMS(self.sandbox, self.package, self.version, availablePackages=self.doneList)

            listDependentPackages, listTestPackages, listInstalledPackages, listInstalledRPMs = (
                self._findDependentPackagesAndInstalledRPM(self.sandbox))

            pkgUtils = PackageUtils(self.logName, self.logPath)

            if listDependentPackages:
                self.logger.debug("Installing the build time dependent packages......")
                for pkg in listDependentPackages:
                    packageName, packageVersion = StringUtils.splitPackageNameAndVersion(pkg)
                    self._installPackage(pkgUtils, packageName, packageVersion, self.sandbox, self.logPath,listInstalledPackages, listInstalledRPMs)
                for pkg in listTestPackages:
                    flag = False
                    packageName, packageVersion = StringUtils.splitPackageNameAndVersion(pkg)
                    for depPkg in listDependentPackages:
                        depPackageName, depPackageVersion = StringUtils.splitPackageNameAndVersion(depPkg)
                        if depPackageName == packageName:
                            flag = True
                            break;
                    if flag == False:
                        self._installPackage(pkgUtils, packageName,packageVersion, self.sandbox, self.logPath,listInstalledPackages, listInstalledRPMs)
                pkgUtils.installRPMSInOneShot(self.sandbox)
                self.logger.debug("Finished installing the build time dependent packages....")

            pkgUtils.adjustGCCSpecs(self.sandbox, self.package, self.version)
            pkgUtils.buildRPMSForGivenPackage(self.sandbox, self.package, self.version,
                                              self.logPath)
            self.logger.debug("Successfully built the package: " + self.package)
        except Exception as e:
            self.logger.error("Failed while building package: " + self.package)
            self.logger.debug("Sandbox: " + self.sandbox.getID() +
                              " not deleted for debugging.")
            logFileName = os.path.join(self.logPath, self.package + ".log")
            fileLog = os.popen('tail -n 100 ' + logFileName).read()
            self.logger.info(fileLog)
            raise e
        if self.sandbox:
            self.sandbox.destroy()