Write the --variant string to .buildstamp as 'Variant='
This commit is contained in:
parent
b3eb4fa8a4
commit
dc635a97f6
@ -281,7 +281,8 @@ class Lorax(BaseLoraxClass):
|
||||
|
||||
# write .buildstamp
|
||||
buildstamp = BuildStamp(self.product.name, self.product.version,
|
||||
self.product.bugurl, self.product.isfinal, self.arch.buildarch)
|
||||
self.product.bugurl, self.product.isfinal,
|
||||
self.arch.buildarch, self.product.variant)
|
||||
|
||||
buildstamp.write(joinpaths(self.inroot, ".buildstamp"))
|
||||
|
||||
|
@ -27,11 +27,12 @@ import datetime
|
||||
|
||||
class BuildStamp(object):
|
||||
|
||||
def __init__(self, product, version, bugurl, isfinal, buildarch):
|
||||
def __init__(self, product, version, bugurl, isfinal, buildarch, variant=""):
|
||||
self.product = product
|
||||
self.version = version
|
||||
self.bugurl = bugurl
|
||||
self.isfinal = isfinal
|
||||
self.variant = variant
|
||||
|
||||
now = datetime.datetime.now()
|
||||
now = now.strftime("%Y%m%d%H%M")
|
||||
@ -54,5 +55,7 @@ class BuildStamp(object):
|
||||
fobj.write("BugURL={0.bugurl}\n".format(self))
|
||||
fobj.write("IsFinal={0.isfinal}\n".format(self))
|
||||
fobj.write("UUID={0.uuid}\n".format(self))
|
||||
if self.variant:
|
||||
fobj.write("Variant={0.variant}\n".format(self))
|
||||
fobj.write("[Compose]\n")
|
||||
fobj.write("Lorax={0}\n".format(vernum))
|
||||
|
@ -46,7 +46,7 @@ def lorax_parser():
|
||||
optional.add_argument("-m", "--mirrorlist",
|
||||
help="mirrorlist repository (may be listed multiple times)",
|
||||
metavar="REPOSITORY", action="append", default=[])
|
||||
optional.add_argument("-t", "--variant",
|
||||
optional.add_argument("-t", "--variant", default="",
|
||||
help="variant name", metavar="VARIANT")
|
||||
optional.add_argument("-b", "--bugurl",
|
||||
help="bug reporting URL for the product", metavar="URL",
|
||||
|
@ -11,7 +11,8 @@ class BuildStampTestCase(unittest.TestCase):
|
||||
'0.1',
|
||||
'https://github.com/rhinstaller/lorax/issues',
|
||||
True,
|
||||
'noarch'
|
||||
'noarch',
|
||||
'Server'
|
||||
)
|
||||
|
||||
def test_write_produces_file_with_expected_content(self):
|
||||
@ -19,5 +20,6 @@ class BuildStampTestCase(unittest.TestCase):
|
||||
with patch.object(out_file, 'close'):
|
||||
with patch.object(buildstamp, 'open', return_value=out_file):
|
||||
self.bstamp.write('/tmp/stamp.ini')
|
||||
self.assertIn("[Main]\nProduct=Lorax Tests\nVersion=0.1\nBugURL=https://github.com/rhinstaller/lorax/issues\nIsFinal=True", out_file.getvalue())
|
||||
self.assertIn("[Compose]\nLorax=devel", out_file.getvalue())
|
||||
self.assertIn("[Main]\nProduct=Lorax Tests\nVersion=0.1\nBugURL=https://github.com/rhinstaller/lorax/issues\nIsFinal=True\n", out_file.getvalue())
|
||||
# Skip UUID which is between IsFinal and Variant
|
||||
self.assertIn("Variant=Server\n[Compose]\nLorax=devel", out_file.getvalue())
|
||||
|
Loading…
Reference in New Issue
Block a user