fix version query and add one to the log file
Fix "lorax -V" and add a "version is ???" to the log file so we can easily know what version of lorax is used to build an iso. Changed to try/import for versioning because the version file is autogenerated.
This commit is contained in:
parent
e3432dcde7
commit
52070f045c
@ -142,6 +142,14 @@ class Lorax(BaseLoraxClass):
|
||||
|
||||
assert self._configured
|
||||
|
||||
# get lorax version
|
||||
try:
|
||||
import pylorax.version
|
||||
except ImportError:
|
||||
vernum = "devel"
|
||||
else:
|
||||
vernum = pylorax.version.num
|
||||
|
||||
if domacboot:
|
||||
try:
|
||||
runcmd(["rpm", "-q", "hfsplus-tools"])
|
||||
@ -161,6 +169,8 @@ class Lorax(BaseLoraxClass):
|
||||
|
||||
self.init_stream_logging()
|
||||
self.init_file_logging(logdir)
|
||||
|
||||
logger.debug("version is {0}".format(vernum))
|
||||
logger.debug("using work directory {0.workdir}".format(self))
|
||||
logger.debug("using log directory {0}".format(logdir))
|
||||
|
||||
|
@ -76,7 +76,15 @@ def setup_logging(opts):
|
||||
|
||||
|
||||
def main(args):
|
||||
version = "{0} 0.1".format(os.path.basename(args[0]))
|
||||
# get lorax version
|
||||
try:
|
||||
import pylorax.version
|
||||
except ImportError:
|
||||
vernum = "devel"
|
||||
else:
|
||||
vernum = pylorax.version.num
|
||||
|
||||
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)
|
||||
@ -136,15 +144,15 @@ def main(args):
|
||||
# parse the arguments
|
||||
opts, args = parser.parse_args()
|
||||
|
||||
if opts.showver:
|
||||
print(version)
|
||||
sys.exit(0)
|
||||
|
||||
try:
|
||||
outputdir = os.path.abspath(args[0])
|
||||
except IndexError:
|
||||
parser.error("missing one or more required arguments")
|
||||
|
||||
if opts.showver:
|
||||
print(version)
|
||||
sys.exit(0)
|
||||
|
||||
# check for the required arguments
|
||||
if not opts.product or not opts.version or not opts.release \
|
||||
or not opts.source or not outputdir:
|
||||
|
Loading…
Reference in New Issue
Block a user