Example #1
0
    def _latestFedoraVariant(self):
        ret = None
        for var in osdict.sort_helper(osdict.OS_TYPES["linux"]["variants"]):
            if var.startswith("fedora"):
                # First fedora* occurence should be the newest
                ret = var
                break

        return ret, int(ret[6:])
Example #2
0
    def _latestFedoraVariant(self):
        ret = None
        for var in osdict.sort_helper(osdict.OS_TYPES["linux"]["variants"]):
            if var.startswith("fedora"):
                # First fedora* occurence should be the newest
                ret = var
                break

        return ret, int(ret[6:])
    def _update_manpages(self):
        # Update virt-install.1 with latest os type/variant values
        import virtinst.osdict as osdict

        # Build list first
        ret = []
        for t in osdict.sort_helper(osdict.OS_TYPES):
            for v in osdict.sort_helper(osdict.OS_TYPES[t]["variants"]):
                label = osdict.OS_TYPES[t]["variants"][v]["label"]
                if osdict.lookup_osdict_key(None, None, t, v, "supported"):
                    ret.append((v, label))

        output = ""
        output += "=over 2\n\n"

        for v, label in ret:
            output += "=item %-20s : %s\n\n" % (v, label)

        output += "=back\n\n"

        infile = "man/en/virt-install.pod.in"
        outfile = "man/en/virt-install.pod"

        outfd = open(outfile, "w+")
        origout = outfd.read()
        outfd.close()

        infd  = open(infile, "r")
        inp = infd.read()
        infd.close()

        outp = inp.replace("::VARIANT VALUES::", output)
        if outp != origout or not(os.path.exists(outfile)):
            outfd = open(outfile, "w")
            outfd.write(outp)
            outfd.close()

        # Generate new manpages
        if os.system("make -C man/en"):
            raise RuntimeError("Couldn't generate man pages.")

        if os.system("grep -IRq 'Hey!' man/en") == 0:
            raise RuntimeError("man pages have errors in them! "
                               "(grep for 'Hey!')")
Example #4
0
    def _update_manpages(self):
        # Update virt-install.1 with latest os type/variant values
        import virtinst.osdict as osdict

        # Build list first
        ret = []
        for t in osdict.sort_helper(osdict.OS_TYPES):
            for v in osdict.sort_helper(osdict.OS_TYPES[t]["variants"]):
                label = osdict.OS_TYPES[t]["variants"][v]["label"]
                if osdict.lookup_osdict_key(None, None, t, v, "supported"):
                    ret.append((v, label))

        output = ""
        output += "=over 2\n\n"

        for v, label in ret:
            output += "=item %-20s : %s\n\n" % (v, label)

        output += "=back\n\n"

        infile = "man/en/virt-install.pod.in"
        outfile = "man/en/virt-install.pod"

        outfd = open(outfile, "w+")
        origout = outfd.read()
        outfd.close()

        infd = open(infile, "r")
        inp = infd.read()
        infd.close()

        outp = inp.replace("::VARIANT VALUES::", output)
        if outp != origout or not (os.path.exists(outfile)):
            outfd = open(outfile, "w")
            outfd.write(outp)
            outfd.close()

        # Generate new manpages
        if os.system("make -C man/en"):
            raise RuntimeError("Couldn't generate man pages.")
Example #5
0
def _update_manpages():
    # Update virt-install.1 with latest os type/variant values
    import virtinst.osdict as osdict

    # Build list first
    ret = []
    for t in osdict.sort_helper(osdict.OS_TYPES):
        for v in osdict.sort_helper(osdict.OS_TYPES[t]["variants"]):
            label = osdict.OS_TYPES[t]["variants"][v]["label"]
            if osdict.lookup_osdict_key(None, None, t, v, "supported"):
                ret.append((v, label))

    output = ""
    output += "=over 2\n\n"

    for v, label in ret:
        output += "=item %-20s : %s\n\n" % (v, label)

    output += "=back\n\n"

    infile = "man/en/virt-install.pod.in"
    outfile = "man/en/virt-install.pod"

    outfd = open(outfile, "w+")
    origout = outfd.read()
    outfd.close()

    infd  = open(infile, "r")
    inp = infd.read()
    infd.close()

    outp = inp.replace("::VARIANT VALUES::", output)
    if outp != origout or not(os.path.exists(outfile)):
        outfd = open(outfile, "w")
        outfd.write(outp)
        outfd.close()

    _regenerate_manpages()
Example #6
0
    def _update_manpages(self):
        # Update virt-install.1 with latest os type/variant values
        import virtinst.osdict as osdict

        output = ""
        output += "=over 4\n\n"
        for t in osdict.sort_helper(osdict.OS_TYPES):
            output += "=item %s\n\n" % t

            output += "=over 4\n\n"
            for v in osdict.sort_helper(osdict.OS_TYPES[t]["variants"]):
                output += "=item %s\n\n" % v
                output += osdict.OS_TYPES[t]["variants"][v]["label"] + "\n\n"

            output += "=back\n\n"

        # Add special 'none' value
        output += "=item none\n\n"
        output += "No OS version specified (disables autodetect)\n\n"
        output += "=back\n\n"

        infile = "man/en/virt-install.pod.in"
        outfile = "man/en/virt-install.pod"

        infd  = open(infile, "r")
        outfd = open(outfile, "w")

        inp = infd.read()
        infd.close()

        outp = inp.replace("::VARIANT VALUES::", output)
        outfd.write(outp)
        outfd.close()

        # Generate new manpages
        if os.system("make -C man/en"):
            raise RuntimeError("Couldn't generate man pages.")
Example #7
0
def _check_osvariant_valid(os_type, os_variant):
    return bool(_check_ostype_valid(os_type) and os_variant in osdict.sort_helper(osdict.OS_TYPES[os_type]["variants"]))
Example #8
0
def _check_ostype_valid(os_type):
    return bool(os_type in osdict.sort_helper(osdict.OS_TYPES))
Example #9
0
def _check_osvariant_valid(os_type, os_variant):
    return bool(
        _check_ostype_valid(os_type) and os_variant in osdict.sort_helper(
            osdict.OS_TYPES[os_type]["variants"]))
Example #10
0
def _check_ostype_valid(os_type):
    return bool(os_type in osdict.sort_helper(osdict.OS_TYPES))