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.
--- src/pylorax/__init__.py | 4 ++++ src/pylorax/buildstamp.py | 8 +------- src/sbin/lorax | 12 +++++++----- 3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 069628e..295ae53 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -142,6 +142,8 @@ class Lorax(BaseLoraxClass):
assert self._configured
+ from pylorax.version import num as vernum + if domacboot: try: runcmd(["rpm", "-q", "hfsplus-tools"]) @@ -161,6 +163,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))
diff --git a/src/pylorax/buildstamp.py b/src/pylorax/buildstamp.py index 6953a6c..fbc7ff9 100644 --- a/src/pylorax/buildstamp.py +++ b/src/pylorax/buildstamp.py @@ -38,13 +38,7 @@ class BuildStamp(object): self.uuid = "{0}.{1}".format(now, buildarch)
def write(self, outfile): - # get lorax version - try: - import pylorax.version - except ImportError: - vernum = "devel" - else: - vernum = pylorax.version.num + from pylorax.version import num as vernum
logger.info("writing .buildstamp file") with open(outfile, "w") as fobj: diff --git a/src/sbin/lorax b/src/sbin/lorax index d831b97..61b518f 100755 --- a/src/sbin/lorax +++ b/src/sbin/lorax @@ -76,7 +76,9 @@ def setup_logging(opts):
def main(args): - version = "{0} 0.1".format(os.path.basename(args[0])) + from pylorax.version import num as vernum + + 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 +138,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:
On Thu, 2013-03-28 at 13:38 -0500, Mark Hamzy wrote:
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.
src/pylorax/__init__.py | 4 ++++ src/pylorax/buildstamp.py | 8 +------- src/sbin/lorax | 12 +++++++----- 3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 069628e..295ae53 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -142,6 +142,8 @@ class Lorax(BaseLoraxClass):
assert self._configured
from pylorax.version import num as vernumif domacboot: try: runcmd(["rpm", "-q", "hfsplus-tools"])@@ -161,6 +163,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))diff --git a/src/pylorax/buildstamp.py b/src/pylorax/buildstamp.py index 6953a6c..fbc7ff9 100644 --- a/src/pylorax/buildstamp.py +++ b/src/pylorax/buildstamp.py @@ -38,13 +38,7 @@ class BuildStamp(object): self.uuid = "{0}.{1}".format(now, buildarch)
def write(self, outfile):
# get lorax versiontry:import pylorax.versionexcept ImportError:vernum = "devel"else:vernum = pylorax.version.num
from pylorax.version import num as vernum
Maybe I'm missing something, but isn't the try-except still needed?
anaconda-patches@lists.fedorahosted.org