Example #1
0
def get_extra_pkgs(dbo, share_dir, compose_type):
    """Return extra packages needed for the output type

    :param dbo: dnf base object
    :type dbo: dnf.Base
    :param share_dir: Path to the top level share directory
    :type share_dir: str
    :param compose_type: The type of output to create from the recipe
    :type compose_type: str
    :returns: List of package names (name only, not NEVRA)
    :rtype: list

    Currently this is only needed by live-iso, it reads ./live/live-install.tmpl and
    processes only the installpkg lines. It lists the packages needed to complete creation of the
    iso using the templates such as x86.tmpl

    Keep in mind that the live-install.tmpl is shared between livemedia-creator and lorax-composer,
    even though the results are applied differently.
    """
    if compose_type != "live-iso":
        return []

    # get the arch information to pass to the runner
    arch = ArchData(get_buildarch(dbo))
    defaults = DataHolder(basearch=arch.basearch)
    templatedir = joinpaths(find_templates(share_dir), "live")
    runner = LiveTemplateRunner(dbo,
                                templatedir=templatedir,
                                defaults=defaults)
    runner.run("live-install.tmpl")
    log.debug("extra pkgs = %s", runner.pkgs)

    return runner.pkgnames
Example #2
0
    def test_live_install(self):
        """Check that live-install.tmpl is parsed correctly"""
        # A package for each arch to test for
        arch_pkg = {
            "aarch64":  "shim-aa64",
            "arm":      "grub2-efi-arm-cdboot",
            "armhfp":   "grub2-efi-arm-cdboot",
            "x86_64":   "shim-x64",
            "i386":     "memtest86+",
            "ppc64le":  "powerpc-utils",
            "s390x":    "s390utils-base"
        }

        extra_pkgs = get_extra_pkgs(self.dbo, "./share/", "live-iso")
        self.assertTrue(len(extra_pkgs) > 0)

        # Results depend on arch
        arch = get_buildarch(self.dbo)
        self.assertTrue(arch_pkg[arch] in extra_pkgs)