Add version output (#1335456)

Add -V to livemedia-creator, and log the running version when lorax or
lmc is started.
This commit is contained in:
Brian C. Lane 2017-08-08 15:14:15 -07:00
parent 8154b3f7a3
commit e3dcb1e329
4 changed files with 22 additions and 18 deletions

View File

@ -49,6 +49,15 @@ from pylorax.treeinfo import TreeInfo
from pylorax.discinfo import DiscInfo
from pylorax.executils import runcmd, runcmd_output
# get lorax version
try:
import pylorax.version
except ImportError:
vernum = "devel"
else:
vernum = pylorax.version.num
# List of drivers to remove on ppc64 arch to keep initrd < 32MiB
REMOVE_PPC64_DRIVERS = "floppy scsi_debug nouveau radeon cirrus mgag200"
REMOVE_PPC64_MODULES = "drm plymouth"
@ -178,14 +187,6 @@ class Lorax(BaseLoraxClass):
installpkgs = installpkgs or []
excludepkgs = excludepkgs or []
# get lorax version
try:
import pylorax.version
except ImportError:
vernum = "devel"
else:
vernum = pylorax.version.num
if domacboot:
try:
runcmd(["rpm", "-q", "hfsplus-tools"])

View File

@ -22,18 +22,13 @@ import os
import sys
import argparse
from pylorax import vernum
version = "{0}-{1}".format(os.path.basename(sys.argv[0]), vernum)
def lorax_parser():
""" Return the ArgumentParser for lorax"""
# get lorax version
try:
from pylorax import version
vernum = version.num
except ImportError:
vernum = "devel"
version = "{0}-{1}".format(os.path.basename(sys.argv[0]), vernum)
parser = argparse.ArgumentParser(description="Create the Anaconda boot.iso")
# required arguments for image creation
@ -290,4 +285,8 @@ def lmc_parser(dracut_default=""):
parser.add_argument("--timeout", default=None, type=int,
help="Cancel installer after X minutes")
# add the show version option
parser.add_argument("-V", help="show program's version number and exit",
action="version", version=version)
return parser

View File

@ -44,7 +44,7 @@ from mako.template import Template
from mako.exceptions import text_error_template
# Use the Lorax treebuilder branch for iso creation
from pylorax import ArchData, setup_logging, find_templates
from pylorax import ArchData, setup_logging, find_templates, vernum
from pylorax.base import DataHolder
from pylorax.treebuilder import TreeBuilder, RuntimeBuilder, udev_escape
from pylorax.treebuilder import findkernels
@ -1199,6 +1199,8 @@ def main():
log.debug( opts )
log.info("livemedia-creator v%s", vernum)
# Find the lorax templates
opts.lorax_templates = find_templates(opts.lorax_templates or "/usr/share/lorax")

View File

@ -54,6 +54,8 @@ def main():
parser = lorax_parser()
opts = parser.parse_args()
log.info("Lorax v%s", pylorax.vernum)
if not opts.source and not opts.repos:
parser.error("--source, --repo, or both are required.")