示例#1
0
  def constructInfrastructureFakeroot(self):
    """
    Construct our fakeroot directory tree

    :returns: (iteration, fakerootSHA) where iteration is the total commit count
    in the repository and fakerootSHA is the SHA in the fakeroot. If we're
    packaging a branch or tip of master, we're still going to want to know what
    the SHA was so we can include it in the RPM description.

    :rtype: tuple
    """

    config = self.config
    fakeroot = self.fakeroot
    logger = self.logger
    productsDirectory = self.productsDirectory
    srvPath = os.path.join(fakeroot, "opt", "numenta")
    logger.debug("Creating %s", srvPath)
    mkpath(srvPath)

    logger.debug("Cloning %s into %s...", fakeroot, config.gitURL)

    # Collect the SHA from the fakeroot. This way we can put the SHA into
    # the RPM information even if we are packaging tip of a branch and not
    # a specific SHA
    installDirectory = os.path.join("opt", "numenta")
    fakerootSHA = rpm.gitCloneIntoFakeroot(fakeroot=fakeroot,
                                           installDirectory=installDirectory,
                                           repoDirectory="products",
                                           gitURL=config.gitURL,
                                           logger=logger,
                                           sha=config.sha)

    # Capture the commit count since we're going to trash products once we pull
    # out the saltcellar
    iteration = git.getCommitCount(productsDirectory, logger=logger)
    logger.debug("Commit count in %s is %s", productsDirectory, iteration)
    logger.debug("SHA in %s is %s", productsDirectory, fakerootSHA)

    # Clean everything not whitelisted out of products so we don't conflict
    # with htm-it or taurus rpms
    purgeDirectory(path=productsDirectory,
                   whitelist=["__init__.py",
                              "infrastructure" ],
                   logger=logger)

    # Clean out infrastructure, too - we only want the utilities
    infraPath = os.path.join(productsDirectory, "infrastructure")
    purgeDirectory(path=infraPath,
                   whitelist=["__init__.py",
                              "DEPENDENCIES.md",
                              "infrastructure",
                              "LICENSE",
                              "README.md",
                              "requirements.txt",
                              "setup.py"],
                   logger=logger)

    return (iteration, fakerootSHA)
示例#2
0
    def constructInfrastructureFakeroot(self):
        """
    Construct our fakeroot directory tree

    :returns: (iteration, fakerootSHA) where iteration is the total commit count
    in the repository and fakerootSHA is the SHA in the fakeroot. If we're
    packaging a branch or tip of master, we're still going to want to know what
    the SHA was so we can include it in the RPM description.

    :rtype: tuple
    """

        config = self.config
        fakeroot = self.fakeroot
        logger = self.logger
        productsDirectory = self.productsDirectory
        srvPath = os.path.join(fakeroot, "opt", "numenta")
        logger.debug("Creating %s", srvPath)
        mkpath(srvPath)

        logger.debug("Cloning %s into %s...", fakeroot, config.gitURL)

        # Collect the SHA from the fakeroot. This way we can put the SHA into
        # the RPM information even if we are packaging tip of a branch and not
        # a specific SHA
        installDirectory = os.path.join("opt", "numenta")
        fakerootSHA = rpm.gitCloneIntoFakeroot(
            fakeroot=fakeroot,
            installDirectory=installDirectory,
            repoDirectory="products",
            gitURL=config.gitURL,
            logger=logger,
            sha=config.sha)

        # Capture the commit count since we're going to trash products once we pull
        # out the saltcellar
        iteration = git.getCommitCount(productsDirectory)
        logger.debug("Commit count in %s is %s", productsDirectory, iteration)
        logger.debug("SHA in %s is %s", productsDirectory, fakerootSHA)

        # Clean everything not whitelisted out of products so we don't conflict
        # with grok or taurus rpms
        purgeDirectory(path=productsDirectory,
                       whitelist=["__init__.py", "infrastructure"],
                       logger=logger)

        # Clean out infrastructure, too - we only want the utilities
        infraPath = os.path.join(productsDirectory, "infrastructure")
        purgeDirectory(path=infraPath,
                       whitelist=[
                           "__init__.py", "DEPENDENCIES.md", "infrastructure",
                           "LICENSE", "README.md", "requirements.txt",
                           "setup.py"
                       ],
                       logger=logger)

        return (iteration, fakerootSHA)
示例#3
0
  def installProductsIntoHTMITFakeroot(self):
    """
    Clone our git repo into the fakeroot directory tree.

    If we're configured to use a site-packages tarball; burst it.

    :returns: SHA of the products repo in the fakeroot
    """

    config = self.config
    fakeroot = self.fakeroot
    logger = self.logger
    numentaPath = os.path.join(fakeroot, "opt", "numenta")
    logger.debug("Creating %s", numentaPath)
    mkpath(numentaPath)

    logger.debug("Cloning...")
    realSHA = rpm.gitCloneIntoFakeroot(fakeroot=fakeroot,
                                       installDirectory="opt/numenta",
                                       repoDirectory="products",
                                       gitURL=config.gitURL,
                                       logger=logger,
                                       sha=config.sha)

    logger.debug("Creating site-packages if required")
    libPython = os.path.join(fakeroot,
                             "opt",
                             "numenta",
                             "products",
                             "htm-it",
                             "lib",
                             "python2.7")

    mkpath(os.path.join(libPython, "site-packages"))

    # Burst site-packages tarball if set on command line
    if config.sitePackagesTarball:
      with changeToWorkingDir(libPython):
        logger.debug("Bursting %s in %s",
                     config.sitePackagesTarball,
                     libPython)
        runWithOutput("tar xf %s" % config.sitePackagesTarball)

    return realSHA
示例#4
0
    def installProductsIntoGrokFakeroot(self):
        """
    Clone our git repo into the fakeroot directory tree.

    If we're configured to use a site-packages tarball; burst it.

    :returns: SHA of the products repo in the fakeroot
    """

        config = self.config
        fakeroot = self.fakeroot
        logger = self.logger
        numentaPath = os.path.join(fakeroot, "opt", "numenta")
        logger.debug("Creating %s", numentaPath)
        mkpath(numentaPath)

        logger.debug("Cloning...")
        realSHA = rpm.gitCloneIntoFakeroot(fakeroot=fakeroot,
                                           installDirectory="opt/numenta",
                                           repoDirectory="products",
                                           gitURL=config.gitURL,
                                           logger=logger,
                                           sha=config.sha)

        logger.debug("Creating site-packages if required")
        libPython = os.path.join(fakeroot, "opt", "numenta", "products",
                                 "grok", "lib", "python2.7")

        mkpath(os.path.join(libPython, "site-packages"))

        # Burst site-packages tarball if set on command line
        if config.sitePackagesTarball:
            with changeToWorkingDir(libPython):
                logger.debug("Bursting %s in %s", config.sitePackagesTarball,
                             libPython)
                runWithOutput("tar xf %s" % config.sitePackagesTarball)

        return realSHA
示例#5
0
    def constructSaltcellarFakeroot(self):
        """
    Make a saltcellar fakeroot

    :returns: (iteration, fakerootSHA) where iteration is the total commit count
    in the repository and fakerootSHA is the SHA in the fakeroot. If we're
    packaging a branch or tip of master, we're still going to want to know what
    the SHA was so we can include it in the RPM description.

    :rtype: tuple
    """

        config = self.config
        fakeroot = self.fakeroot
        logger = self.logger
        srvPath = os.path.join(fakeroot, "srv")
        logger.debug("Creating saltcellar fakeroot in %s", srvPath)
        productsPath = os.path.join(fakeroot, "products")
        mkpath(srvPath)

        logger.debug("Cloning...")

        # Collect the SHA from the fakeroot. This way we can put the SHA into
        # the RPM information even if we are packaging tip of a branch and not
        # a specific SHA
        fakerootSHA = rpm.gitCloneIntoFakeroot(fakeroot=fakeroot,
                                               installDirectory="/",
                                               repoDirectory="products",
                                               gitURL=config.gitURL,
                                               logger=logger,
                                               sha=config.sha)

        # Capture the commit count since we're going to trash products once we pull
        # out the saltcellar
        iteration = git.getCommitCount(productsPath)
        logger.debug("Commit count in %s is %s", productsPath, iteration)

        # Move the saltcellar to /srv/salt
        logger.debug("Moving saltcellar to %s/salt", srvPath)
        logger.debug("srvPath: %s", srvPath)
        logger.debug("productsPath: %s", productsPath)
        logger.debug("%s/infrastructure/saltcellar", productsPath)

        logger.debug("Checking for %s/infrastructure/saltcellar", productsPath)
        logger.debug(
            os.path.exists("%s/infrastructure/saltcellar" % productsPath))

        os.rename(os.path.join(productsPath, "infrastructure", "saltcellar"),
                  os.path.join(srvPath, "salt"))

        # Now that we have the salt formulas, nuke the rest of products out of
        # the fakeroot
        logger.debug("Deleting products from fakeroot")
        rmrf(productsPath)

        # Finally, scrub the private data out of /srv/salt
        if not config.numenta_internal_only:
            logger.debug("Sanitizing /srv/salt")
            self.sanitizeSrvSalt("%s/srv/salt" % fakeroot)
        else:
            logger.critical(
                "Baking numenta-internal rpm, not sanitizing /srv/salt")
        return (iteration, fakerootSHA)
示例#6
0
  def constructSaltcellarFakeroot(self):
    """
    Make a saltcellar fakeroot

    :returns: (iteration, fakerootSHA) where iteration is the total commit count
    in the repository and fakerootSHA is the SHA in the fakeroot. If we're
    packaging a branch or tip of master, we're still going to want to know what
    the SHA was so we can include it in the RPM description.

    :rtype: tuple
    """

    config = self.config
    fakeroot = self.fakeroot
    logger = self.logger
    srvPath = os.path.join(fakeroot, "srv")
    logger.debug("Creating saltcellar fakeroot in %s", srvPath)
    productsPath = os.path.join(fakeroot, "products")
    mkpath(srvPath)

    logger.debug("Cloning...")

    # Collect the SHA from the fakeroot. This way we can put the SHA into
    # the RPM information even if we are packaging tip of a branch and not
    # a specific SHA
    fakerootSHA = rpm.gitCloneIntoFakeroot(fakeroot=fakeroot,
                                           installDirectory="/",
                                           repoDirectory="products",
                                           gitURL=config.gitURL,
                                           logger=logger,
                                           sha=config.sha)

    # Capture the commit count since we're going to trash products once we pull
    # out the saltcellar
    iteration = git.getCommitCount(productsPath, logger=logger)
    logger.debug("Commit count in %s is %s", productsPath, iteration)

    # Move the saltcellar to /srv/salt
    logger.debug("Moving saltcellar to %s/salt", srvPath)
    logger.debug("srvPath: %s", srvPath)
    logger.debug("productsPath: %s", productsPath)
    logger.debug("%s/infrastructure/saltcellar", productsPath)

    logger.debug("Checking for %s/infrastructure/saltcellar",
                 productsPath)
    logger.debug(os.path.exists("%s/infrastructure/saltcellar" %
                                productsPath))

    os.rename(os.path.join(productsPath, "infrastructure",
                           "saltcellar"),
              os.path.join(srvPath, "salt"))

    # Now that we have the salt formulas, nuke the rest of products out of
    # the fakeroot
    logger.debug("Deleting products from fakeroot")
    rmrf(productsPath)

    # Finally, scrub the private data out of /srv/salt
    if not config.numenta_internal_only:
      logger.debug("Sanitizing /srv/salt")
      self.sanitizeSrvSalt("%s/srv/salt" % fakeroot)
    else:
      logger.critical("Baking numenta-internal rpm, not sanitizing /srv/salt")
    return (iteration, fakerootSHA)
示例#7
0
    If we're configured to use a site-packages tarball; burst it.

    :returns: SHA of the products repo in the fakeroot
    """

    config = self.config
    fakeroot = self.fakeroot
    logger = self.logger
    numentaPath = os.path.join(fakeroot, "opt", "numenta")
    logger.debug("Creating %s", numentaPath)
    mkpath(numentaPath)

    logger.debug("Cloning...")
    realSHA = rpm.gitCloneIntoFakeroot(fakeroot=fakeroot,
                                       installDirectory="opt/numenta",
                                       repoDirectory="products",
                                       gitURL=config.gitURL,
                                       logger=logger,
                                       sha=config.sha)

    logger.debug("Creating site-packages if required")
    libPython = os.path.join(fakeroot,
                             "opt",
                             "numenta",
                             "products",
                             "htm-it",
                             "lib",
                             "python2.7")

    mkpath(os.path.join(libPython, "site-packages"))

    # Burst site-packages tarball if set on command line