From 0cd089802f7fed853bab114b80a6b834f8a8b830 Mon Sep 17 00:00:00 2001 From: Jiri Konecny Date: Fri, 12 Apr 2019 15:09:53 +0200 Subject: [PATCH] patch-iso supports multiple graft directories Pungi patch iso now supports multiple graft directories. This should make usage more comfortable. Signed-off-by: Jiri Konecny --- bin/pungi-patch-iso | 4 ++-- pungi_utils/patch_iso.py | 2 +- tests/test_patch_iso.py | 8 ++++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/pungi-patch-iso b/bin/pungi-patch-iso index 7a83e5e2..e7150c0f 100755 --- a/bin/pungi-patch-iso +++ b/bin/pungi-patch-iso @@ -40,8 +40,8 @@ def main(args=None): help='which file to write the result to') parser.add_argument('source', metavar='SOURCE_ISO', help='source ISO to work with') - parser.add_argument('dir', metavar='GRAFT_DIR', - help='extra directory to graft on the ISO') + parser.add_argument('dirs', nargs="+", metavar='GRAFT_DIR', + help='extra directories to graft on the ISO') opts = parser.parse_args(args) level = logging.DEBUG if opts.verbose else logging.INFO diff --git a/pungi_utils/patch_iso.py b/pungi_utils/patch_iso.py index 07f276fb..789bf8d9 100644 --- a/pungi_utils/patch_iso.py +++ b/pungi_utils/patch_iso.py @@ -92,7 +92,7 @@ def run(log, opts): volume_id = opts.volume_id or iso.get_volume_id(opts.source) # create graft points from mounted source iso + overlay dir - graft_points = iso.get_graft_points([work_dir, opts.dir]) + graft_points = iso.get_graft_points([work_dir] + opts.dirs) # if ks.cfg is detected, patch syslinux + grub to use it if 'ks.cfg' in graft_points: log.info('Adding ks.cfg to boot configs') diff --git a/tests/test_patch_iso.py b/tests/test_patch_iso.py index 0740cdfa..b327d43a 100644 --- a/tests/test_patch_iso.py +++ b/tests/test_patch_iso.py @@ -87,6 +87,7 @@ class TestPatchingIso(unittest.TestCase): source='source.iso', force_arch=None, volume_id='FOOBAR', + dirs=[] ) patch_iso.run(log, opts) @@ -124,7 +125,8 @@ class TestPatchingIso(unittest.TestCase): target='test.iso', source='source.iso', force_arch=None, - volume_id=None + volume_id=None, + dirs=[] ) patch_iso.run(log, opts) @@ -164,7 +166,8 @@ class TestPatchingIso(unittest.TestCase): target='test.iso', source='source.iso', force_arch=None, - volume_id=None + volume_id=None, + dirs=[] ) patch_iso.run(log, opts) @@ -206,6 +209,7 @@ class TestPatchingIso(unittest.TestCase): source='source.iso', force_arch='s390', volume_id='foobar', + dirs=[], ) patch_iso.run(log, opts)