Ejemplo n.º 1
0
    def apt_repo_adder(self, distro):
        self.logger.info("adding apt repo for %s" % distro.name)
        # Obtain repo mirror from APT if available
        mirror = False
        if apt_available:
            # Example returned URL: http://us.archive.ubuntu.com/ubuntu
            mirror = self.get_repo_mirror_from_apt()
        if not mirror:
            mirror = "http://archive.ubuntu.com/ubuntu"

        repo = item_repo.Repo(self.collection_mgr)
        repo.set_breed("apt")
        repo.set_arch(distro.arch)
        repo.set_keep_updated(True)
        repo.set_apt_components("main universe")        # TODO: make a setting?
        repo.set_apt_dists("%s %s-updates %s-security" % ((distro.os_version,) * 3))
        repo.set_name(distro.name)
        repo.set_os_version(distro.os_version)

        if distro.breed == "ubuntu":
            repo.set_mirror(mirror)
        else:
            # NOTE : The location of the mirror should come from timezone
            repo.set_mirror("http://ftp.%s.debian.org/debian/dists/%s" % ('us', distro.os_version))

        self.logger.info("Added repos for %s" % distro.name)
        repos = self.collection_mgr.repos()
        repos.add(repo, save=True)
Ejemplo n.º 2
0
 def factory_produce(self, config, item_dict):
     """
     Return a Distro forged from item_dict
     """
     new_repo = repo.Repo(config)
     new_repo.from_dict(item_dict)
     return new_repo
Ejemplo n.º 3
0
    def apt_repo_adder(self, distribution: distro.Distro):
        """
        Automatically import apt repositories when importing signatures.

        :param distribution: The distribution to scan for apt repositories.
        """
        self.logger.info("adding apt repo for %s" % distribution.name)
        # Obtain repo mirror from APT if available
        mirror = ""
        if apt_available:
            # Example returned URL: http://us.archive.ubuntu.com/ubuntu
            mirror = self.get_repo_mirror_from_apt()
        if not mirror:
            mirror = "http://archive.ubuntu.com/ubuntu"

        repo = item_repo.Repo(self.collection_mgr)
        repo.breed = enums.RepoBreeds.APT
        repo.arch = distribution.arch
        repo.keep_updated = True
        repo.apt_components = "main universe"  # TODO: make a setting?
        repo.apt_dists = "%s %s-updates %s-security" % (
            (distribution.os_version, ) * 3)
        repo.name = distribution.name
        repo.os_version = distribution.os_version

        if distribution.breed == "ubuntu":
            repo.mirror = mirror
        else:
            # NOTE : The location of the mirror should come from timezone
            repo.mirror = "http://ftp.%s.debian.org/debian/dists/%s" % (
                'us', distribution.os_version)

        self.logger.info("Added repos for %s" % distribution.name)
        repos = self.collection_mgr.repos()
        repos.add(repo, save=True)
Ejemplo n.º 4
0
    def apt_repo_adder(self, distribution: distro.Distro):
        """
        Automatically import apt repositories when importing signatures.

        :param distribution: The distribution to scan for apt repositories.
        """
        self.logger.info("adding apt repo for %s" % distribution.name)
        # Obtain repo mirror from APT if available
        mirror = ""
        if apt_available:
            # Example returned URL: http://us.archive.ubuntu.com/ubuntu
            mirror = self.get_repo_mirror_from_apt()
        # If the mirror is only whitespace then use the default one.
        if mirror.isspace():
            mirror = "http://archive.ubuntu.com/ubuntu"

        repo = item_repo.Repo(self.collection_mgr)
        repo.set_breed("apt")
        repo.set_arch(distribution.arch)
        repo.set_keep_updated(True)
        repo.set_apt_components("main universe")  # TODO: make a setting?
        repo.set_apt_dists("%s %s-updates %s-security" %
                           ((distribution.os_version, ) * 3))
        repo.set_name(distribution.name)
        repo.set_os_version(distribution.os_version)

        if distribution.breed == "ubuntu":
            repo.set_mirror(mirror)
        else:
            # NOTE : The location of the mirror should come from timezone
            repo.set_mirror("http://ftp.%s.debian.org/debian/dists/%s" %
                            ('us', distribution.os_version))

        self.logger.info("Added repos for %s" % distribution.name)
        repos = self.collection_mgr.repos()
        repos.add(repo, save=True)
Ejemplo n.º 5
0
 def new_repo(self, is_subobject=False):
     self.log("new_repo", [is_subobject])
     return repo.Repo(self._collection_mgr, is_subobject=is_subobject)