#704 `mockbuild`: new argument --extra-pkgs
Merged a year ago by onosek. Opened 2 years ago by onosek.
onosek/rpkg mockbuild_extra_pkgs  into  master

file modified
+21
@@ -1152,6 +1152,9 @@ 

              '--use-local-mock-config', default=None, dest="local_mock_config",

              action='store_true',

              help="Enforce use of local Mock configuration.")

+         mockbuild_parser.add_argument(

+             '--extra-pkgs', action='append', nargs='*',

+             help="Install additional packages into chroot")

  

          mockbuild_parser.set_defaults(command=self.mockbuild)

  
@@ -2514,6 +2517,24 @@ 

                                                   "%s-%s-%s.src.rpm"

                                                   % (self.cmd.repo_name, self.cmd.ver, self.cmd.rel))

                  self.log.debug('Srpm generated: {0}'.format(self.cmd.srpmname))

+             if self.args.extra_pkgs:

+                 mockargs_extra_pkgs = []

+                 list_extra_pkgs = []

+                 # process possible multiple argument's occurrences

+                 for arg_arr in self.args.extra_pkgs:

+                     for additional_package in arg_arr:

+                         mockargs_extra_pkgs.extend(['--additional-package', additional_package])

+                         list_extra_pkgs.append(additional_package)

+                 # installation will run in separated mock process, so do not clean prepared chroot

+                 # before the main mock run

+                 mockargs_extra_pkgs.extend(['--no-cleanup-after'])

+                 self.log.info('Installing extra packages into the mock chroot: {}'.format(

+                     ', '.join(list_extra_pkgs)))

+                 self.cmd.mockbuild(mockargs_extra_pkgs, self.args.root,

+                                    hashtype=self.args.hash,

+                                    shell=None,  # nosec

+                                    force_local_mock_config=self.args.local_mock_config)

+ 

              self.cmd.mockbuild(mockargs, self.args.root,

                                 hashtype=self.args.hash,

                                 shell=self.args.shell,  # nosec

Added the new argument --extra-pkgs to mockbuild command.
It installs additional packages to mock's chroot. In some cases is
possible to use the current mechanism of extra args placed
after -- at the end of the command line instead of --extra-pkgs.

Example: fedpkg mockbuild -- --additional-package <pkg>

Argument(s) additional-package is passed to mock.
additional-package can't be used together with --shell.

JIRA: RHELCMP-11017
Fixes: https://pagure.io/fedpkg/issue/498

Signed-off-by: Ondřej Nosek onosek@redhat.com

Pull-Request has been merged by onosek

a year ago
Metadata