Add the version to the log (#1335456)
Log the version number as INFO and add -V version display to livemedia-creator. Resolves: rhbz#1335456
This commit is contained in:
parent
7aa71188b9
commit
1b29041089
@ -49,6 +49,14 @@ from treeinfo import TreeInfo
|
||||
from discinfo import DiscInfo
|
||||
from 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"
|
||||
@ -155,14 +163,6 @@ class Lorax(BaseLoraxClass):
|
||||
|
||||
installpkgs = installpkgs 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"])
|
||||
|
@ -48,7 +48,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
|
||||
from pylorax import ArchData, vernum
|
||||
from pylorax.base import DataHolder
|
||||
from pylorax.treebuilder import TreeBuilder, RuntimeBuilder, udev_escape
|
||||
from pylorax.treebuilder import findkernels
|
||||
@ -65,6 +65,8 @@ try:
|
||||
except ImportError:
|
||||
libvirt = None
|
||||
|
||||
VERSION = "{0}-{1}".format(os.path.basename(sys.argv[0]), vernum)
|
||||
|
||||
# Default parameters for rebuilding initramfs, override with --dracut-args
|
||||
DRACUT_DEFAULT = ["--xz", "--add", "livenet dmsquash-live convertfs pollcdrom",
|
||||
"--omit", "plymouth", "--no-hostonly", "--no-early-microcode"]
|
||||
@ -1136,10 +1138,16 @@ if __name__ == '__main__':
|
||||
parser.add_argument( "--squashfs_args",
|
||||
help="additional squashfs args" )
|
||||
|
||||
# add the show version option
|
||||
parser.add_argument("-V", help="show program's version number and exit",
|
||||
action="version", version=VERSION)
|
||||
|
||||
# parse the arguments
|
||||
opts = parser.parse_args()
|
||||
|
||||
setup_logging(opts)
|
||||
|
||||
log.info("livemedia-creator %s", vernum)
|
||||
log.debug( opts )
|
||||
|
||||
if os.getuid() != 0:
|
||||
|
@ -42,6 +42,8 @@ import yum
|
||||
yum.logginglevels._added_handlers = True
|
||||
import pylorax
|
||||
|
||||
VERSION = "{0}-{1}".format(os.path.basename(sys.argv[0]), pylorax.vernum)
|
||||
|
||||
def setup_logging(opts):
|
||||
# Setup logging to console and to logfile
|
||||
log.setLevel(logging.DEBUG)
|
||||
@ -77,14 +79,6 @@ def setup_logging(opts):
|
||||
|
||||
|
||||
def main(args):
|
||||
# get lorax version
|
||||
try:
|
||||
from pylorax import version
|
||||
vernum = version.num
|
||||
except ImportError:
|
||||
vernum = "devel"
|
||||
|
||||
version = "{0}-{1}".format(os.path.basename(args[0]), vernum)
|
||||
usage = "%prog -p PRODUCT -v VERSION -r RELEASE -s REPOSITORY OUTPUTDIR"
|
||||
|
||||
parser = OptionParser(usage=usage)
|
||||
@ -161,13 +155,13 @@ def main(args):
|
||||
|
||||
# add the show version option
|
||||
parser.add_option("-V", help="show program's version number and exit",
|
||||
action="store_true", default=False, dest="showver")
|
||||
action="store_true", dest="showver")
|
||||
|
||||
# parse the arguments
|
||||
opts, args = parser.parse_args()
|
||||
|
||||
if opts.showver:
|
||||
print(version)
|
||||
print(VERSION)
|
||||
sys.exit(0)
|
||||
|
||||
try:
|
||||
@ -190,6 +184,7 @@ def main(args):
|
||||
|
||||
setup_logging(opts)
|
||||
|
||||
log.info("Lorax %s", pylorax.vernum)
|
||||
tempfile.tempdir = opts.tmp
|
||||
|
||||
# create the temporary directory for lorax
|
||||
|
Loading…
Reference in New Issue
Block a user