Exemplo n.º 1
0
    def _buildPackage(self):
        chroot = None
        try:
            chroot = Chroot(self.logger)
            chroot.create(self.package + "-" + self.version)

            tUtils = ToolChainUtils(self.logName, self.logPath)
            tUtils.installToolChainRPMS(chroot, self.package, self.version,
                                        self.logPath)

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

            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,
                                         chroot, 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, chroot,
                                             self.logPath,
                                             listInstalledPackages,
                                             listInstalledRPMs)
                pkgUtils.installRPMSInOneShot(chroot)
                self.logger.debug(
                    "Finished installing the build time dependent packages...."
                )

            pkgUtils.adjustGCCSpecs(chroot, self.package, self.version)
            pkgUtils.buildRPMSForGivenPackage(chroot, 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("Chroot: " + chroot.getPath() +
                              " 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 chroot:
            chroot.destroy()
Exemplo n.º 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()
Exemplo n.º 3
0
    def _installDependencies(self, arch, deps=[]):
        listDependentPackages, listTestPackages, listInstalledPackages, listInstalledRPMs = (
            self._findDependentPackagesAndInstalledRPM(self.sandbox, arch))

        # PackageUtils should be initialized here - as per arch basis
        # Do not move it to __init__
        pkgUtils = PackageUtils(self.logName, self.logPath)

        if listDependentPackages:
            self.logger.debug(
                "Installing the build time dependent packages for " + arch)
            for pkg in listDependentPackages:
                packageName, packageVersion = StringUtils.splitPackageNameAndVersion(
                    pkg)
                self._installPackage(pkgUtils, packageName, packageVersion,
                                     self.sandbox, self.logPath,
                                     listInstalledPackages, listInstalledRPMs,
                                     arch)
            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, arch)
            pkgUtils.installRPMSInOneShot(self.sandbox, arch)
            self.logger.debug(
                "Finished installing the build time dependent packages for " +
                arch)
Exemplo n.º 4
0
    def _buildPackage(self):
        #should initialize a logger based on package name
        containerTaskName = "build-" + self.package + "-" + self.version
        container = None
        try:
            container = Container(self.logger)
            container.create(containerTaskName)

            tcUtils = ToolChainUtils(self.logName, self.logPath)
            tcUtils.installCustomToolChainRPMS(container, self.package,
                                               self.version)

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

            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,
                                         container, 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, container,
                                             self.logPath,
                                             listInstalledPackages,
                                             listInstalledRPMs)
                pkgUtils.installRPMSInOneShot(container)
                self.logger.debug(
                    "Finished installing the build time dependent packages...."
                )

            self.logger.debug(
                "BuildContainer-buildPackage: Start building the package: " +
                self.package)
            pkgUtils.adjustGCCSpecs(container, self.package, self.version)
            pkgUtils.buildRPMSForGivenPackage(container, self.package,
                                              self.version, self.logPath)
            self.logger.debug(
                "BuildContainer-buildPackage: Successfully built the package: "
                + self.package)
        except Exception as e:
            self.logger.error("Failed while building package:" + self.package)
            if container is not None:
                self.logger.debug("Container " + container.getID() +
                                  " retained for debugging.")
            logFileName = os.path.join(self.logPath, self.package + ".log")
            fileLog = os.popen('tail -n 20 ' + logFileName).read()
            self.logger.debug(fileLog)
            raise e

        # Remove the container
        if container:
            container.destroy()