def constructPreBuiltYOMPFakeroot(self): """ Construct fakeroot from prebuilt YOMP :returns: SHA of the products repo in the fakeroot :rtype: tuple """ config = self.config logger = self.logger productsDirectory = self.productsDirectory logger.debug("Creating %s", productsDirectory) mkpath(productsDirectory) copy_tree(config.productsDir, productsDirectory) iteration = YOMP.getCommitCount(productsDirectory) with changeToWorkingDir(productsDirectory): actualSHA = YOMP.getCurrentSha() # Set extra python path self.setPythonPath() # Clean YOMP Scripts self.cleanScripts() # Purge anything not whitelisted self.purgeBlacklistedStuff() return (iteration, actualSHA)
def constructPreBuiltYOMPFakeroot(self): """ Construct fakeroot from prebuilt YOMP :returns: SHA of the products repo in the fakeroot :rtype: tuple """ config = self.config logger = self.logger productsDirectory = self.productsDirectory logger.debug("Creating %s", productsDirectory) mkpath(productsDirectory) copy_tree(config.productsDir, productsDirectory) iteration = YOMP.getCommitCount(productsDirectory) with changeToWorkingDir(productsDirectory): actualSHA = YOMP.getCurrentSha() # Set extra python path self.setPythonPath() # Clean YOMP Scripts self.cleanScripts() # Purge anything not whitelisted self.purgeBlacklistedStuff() return (iteration, actualSHA)
def YOMPCloneIntoFakeroot(fakeroot, installDirectory, repoDirectory, YOMPURL, sha=None, logger=None): """ Clone a YOMP repository into a specific path in a fakeroot @param fakeroot: path to the directory to use as the root of the RPM's install tree @param installDirectory: Where to put the new YOMP clone @param repoDirectory: what to name the cloned directory @param YOMPURL: YOMP URL used to clone @param sha (optional): SHA to checkout once we've cloned the repository @param logger - Optional logger object, will be used to output more debugging information. @returns the SHA of the resulting YOMP clone. We may not have been invoked with a specific SHA (we normally build tip of master, for example), but we always want to include the exact SHA packaged in our RPM descriptions. """ if logger: logger.debug("Prepping fakeroot in %s", fakeroot) installPath = "%s/%s" % (fakeroot, installDirectory) with changeToWorkingDir(installPath): if logger: logger.debug("Cloning %s into %s/%s/%s", YOMPURL, fakeroot, installDirectory, repoDirectory) YOMP.clone(YOMPURL, directory=repoDirectory) workDirectory = "%s/%s/%s" % (fakeroot, installDirectory, repoDirectory) with changeToWorkingDir(workDirectory): if sha: YOMP.resetHard() logger.debug("Checking out SHA %s in %s", sha, workDirectory) YOMP.checkout(sha) else: logger.debug("No SHA specified, using head of master") return YOMP.getCurrentSha()
def YOMPCloneIntoFakeroot(fakeroot, installDirectory, repoDirectory, YOMPURL, sha=None, logger=None): """ Clone a YOMP repository into a specific path in a fakeroot @param fakeroot: path to the directory to use as the root of the RPM's install tree @param installDirectory: Where to put the new YOMP clone @param repoDirectory: what to name the cloned directory @param YOMPURL: YOMP URL used to clone @param sha (optional): SHA to checkout once we've cloned the repository @param logger - Optional logger object, will be used to output more debugging information. @returns the SHA of the resulting YOMP clone. We may not have been invoked with a specific SHA (we normally build tip of master, for example), but we always want to include the exact SHA packaged in our RPM descriptions. """ if logger: logger.debug("Prepping fakeroot in %s", fakeroot) installPath = "%s/%s" % (fakeroot, installDirectory) with changeToWorkingDir(installPath): if logger: logger.debug("Cloning %s into %s/%s/%s", YOMPURL, fakeroot, installDirectory, repoDirectory) YOMP.clone(YOMPURL, directory=repoDirectory) workDirectory = "%s/%s/%s" % (fakeroot, installDirectory, repoDirectory) with changeToWorkingDir(workDirectory): if sha: YOMP.resetHard() logger.debug("Checking out SHA %s in %s", sha, workDirectory) YOMP.checkout(sha) else: logger.debug("No SHA specified, using head of master") return YOMP.getCurrentSha()