Ejemplo n.º 1
0
    def _create_base():
        """Create a new DNF base."""
        base = dnf.Base()
        base.conf.cachedir = DNF_CACHE_DIR
        base.conf.pluginconfpath = DNF_PLUGINCONF_DIR
        base.conf.logdir = '/tmp/'
        base.conf.releasever = get_product_release_version()
        base.conf.installroot = conf.target.system_root
        base.conf.prepend_installroot('persistdir')
        # Load variables substitutions configuration (rhbz#1920735)
        base.conf.substitutions.update_from_etc("/")

        # Set the platform id based on the /os/release present
        # in the installation environment.
        platform_id = get_os_release_value("PLATFORM_ID")

        if platform_id is not None:
            base.conf.module_platform_id = platform_id

        # Start with an empty comps so we can go ahead and use
        # the environment and group properties. Unset reposdir
        # to ensure dnf has nothing it can check automatically.
        base.conf.reposdir = []
        base.read_comps(arch_filter=True)
        base.conf.reposdir = DNF_REPO_DIRS

        log.debug("The DNF base has been created.")
        return base
Ejemplo n.º 2
0
    def _reset_substitution(cls, base):
        """Reset substitution variables of the given DNF base."""
        # Set the default release version.
        base.conf.releasever = get_product_release_version()

        # Load variables from the host (rhbz#1920735).
        base.conf.substitutions.update_from_etc("/")
Ejemplo n.º 3
0
    def _get_release_version(self, url):
        """Return the release version of the tree at the specified URL."""
        log.debug("getting release version from tree at %s", url)

        if self._install_tree_metadata:
            version = self._install_tree_metadata.get_release_version()
            log.debug("using treeinfo release version of %s", version)
        else:
            version = get_product_release_version()
            log.debug("using default release version of %s", version)

        return version
Ejemplo n.º 4
0
 def get_product_release_version_dot_test(self):
     """Test the get_product_release_version function with a dot."""
     self.assertEqual(get_product_release_version(), "7.4")
Ejemplo n.º 5
0
 def get_product_release_version_number_test(self):
     """Test the get_product_release_version function with a valid number."""
     self.assertEqual(get_product_release_version(), "28")
Ejemplo n.º 6
0
 def get_product_release_version_invalid_test(self):
     """Test the get_product_release_version function with an invalid value."""
     self.assertEqual(get_product_release_version(), "rawhide")
Ejemplo n.º 7
0
 def test_get_product_release_version_dot(self):
     """Test the get_product_release_version function with a dot."""
     assert get_product_release_version() == "7.4"
Ejemplo n.º 8
0
 def test_get_product_release_version_number(self):
     """Test the get_product_release_version function with a valid number."""
     assert get_product_release_version() == "28"
Ejemplo n.º 9
0
 def test_get_product_release_version_invalid(self):
     """Test the get_product_release_version function with an invalid value."""
     assert get_product_release_version() == "rawhide"