#2833 Add squashfs-only and compress-arg options to livemedia
Merged 4 years ago by tkopecek. Opened 4 years ago by jcupova.
jcupova/koji issue-2476  into  master

file modified
+6
@@ -3569,6 +3569,12 @@ 

              templates_dir = self.fetch_lorax_templates_from_scm(broot)

              cmd.extend(['--lorax-templates', templates_dir])

  

+         if self.opts.get('squashfs_only'):

+             cmd.append('--squashfs-only')

+ 

+         if isinstance(self.opts.get('compress_arg'), (list, tuple)):

+             for com_arg in self.opts['compress_arg']:

+                 cmd.extend(['--compress-arg', com_arg])

          # Run livemedia-creator

          rv = broot.mock(['--cwd', broot.tmpdir(within=True), '--chroot', '--'] + cmd)

  

file modified
+5 -2
@@ -5796,6 +5796,10 @@ 

                        help=_("Pass the nomacboot option to livemedia-creator"))

      parser.add_option('--ksrepo', action="store_true",

                        help=_("Do not overwrite repos in the kickstart"))

+     parser.add_option('--squashfs-only', action="store_true",

+                       help=_("Use a plain squashfs filesystem."))

+     parser.add_option('--compress-arg', action="append", default=[], metavar="ARG OPT",

+                       help=_("List of compressions."))

      (task_options, args) = parser.parse_args(args)

  

      # Make sure the target and kickstart is specified.
@@ -6177,6 +6181,7 @@ 

          'ksversion', 'release', 'repo', 'scratch', 'skip_tag',

          'specfile', 'vcpu', 'vmem', 'volid', 'optional_arches',

          'lorax_dir', 'lorax_url', 'nomacboot', 'ksrepo',

+         'squashfs_only', 'compress_arg',

      ]

      for opt in passthru_opts:

          val = getattr(task_opts, opt, None)
@@ -6185,7 +6190,6 @@ 

  

      if 'optional_arches' in hub_opts:

          hub_opts['optional_arches'] = hub_opts['optional_arches'].split(',')

- 

      # finally, create the task.

      task_id = session.buildImage(args[0], args[1], arch, target, ksfile,

                                   img_type, opts=hub_opts, priority=priority)
@@ -6253,7 +6257,6 @@ 

          val = getattr(task_opts, opt, None)

          if val is not None:

              hub_opts[opt] = val

- 

      # finally, create the task.

      task_id = session.buildImageOz(args[0], args[1], arches, target, args[3],

                                     opts=hub_opts, priority=priority)

@@ -5,7 +5,8 @@ 

  import unittest

  

  import koji

- from koji_cli.commands import handle_spin_livecd, handle_spin_livemedia, handle_spin_appliance, _build_image

+ from koji_cli.commands import handle_spin_livecd, handle_spin_livemedia, handle_spin_appliance, \

+     _build_image

  from . import utils

  

  
@@ -41,6 +42,8 @@ 

      "ksrepo": False,

      "optional_arches": None,

      "volid": None,

+     "squashfs_only": None,

+     "compress_arg": None,

  }

  

  APPLIANCE_OPTIONS = {
@@ -352,6 +355,7 @@ 

          args, kwargs = build_image_mock.call_args

          empty_opts = dict((k, None) for k in LIVEMEDIA_OPTIONS)

          empty_opts['optional_arches'] = ''

+         empty_opts['compress_arg'] = []

          self.assertDictEqual(empty_opts, args[1].__dict__)

          self.assertEqual(args[-1], 'livemedia')

  
@@ -426,6 +430,9 @@ 

                          templates.

    --nomacboot           Pass the nomacboot option to livemedia-creator

    --ksrepo              Do not overwrite repos in the kickstart

+   --squashfs-only       Use a plain squashfs filesystem.

+   --compress-arg=ARG OPT

+                         List of compressions.

  """ % (self.progname))

  

  

Better to have if self.opts.get('squashfs_only') (user can send here squashfs_only = False via API which is semantically correct)

Will fail with compress_arg = None

'%s' % com_arg is redundant. Simple com_arg is sufficient here.

rebased onto 24a11641abdb548728ce6641652834d55fdb98aa

4 years ago

rebased onto 93b8c6d8702c433f8f82bbfde51ea1812bac1ca4

4 years ago

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

4 years ago

rebased onto f94b5eacdd814dc4eabd2deb6bded51c2c5604b9

4 years ago

rebased onto a6830daedc5f58d1fb94f0a73fd99ceb0ec8fa2b

4 years ago

@jcupova I've noticed now, that you expect all the options for --compress-arg in one point:
--compress-arg="arg1 opt1, arg2 opt2", while better (same as for other similar cases) would be to use --compress-arg="arg1 opt1" --compress-arg="arg2 opt2". (action="append", default=[] and updating rest of CLI code.
Note, that all compress args are two part options: https://www.mankier.com/1/mksquashfs

rebased onto d0581ee638d9e9b324b8303a66ebcc6b3cc05376

4 years ago

rebased onto 917ce501ba7022bcd691af03276b5261877299b3

4 years ago

rebased onto da9df7075fa5ef81953719df005a7502ec756c94

4 years ago

rebased onto 2a6156b

4 years ago

Metadata Update from @mfilip:
- Pull-request tagged with: testing-done

4 years ago

Commit 70d69cd fixes this pull-request

Pull-Request has been merged by tkopecek

4 years ago