#609 Add option to mockbuild use default resultdir of mock (v3)
Closed 2 years ago by sergiomb. Opened 2 years ago by sergiomb.
sergiomb/rpkg master  into  master

file modified
+4 -2
@@ -3007,7 +3007,7 @@ 

          return root, config_dir

  

      def mockbuild(self, mockargs=[], root=None, hashtype=None, shell=None,

-                   force_local_mock_config=None, srpm_mock=False):

+                   force_local_mock_config=None, srpm_mock=False, default_mock_resultdir=False):

          """Build the package in mock, using mockargs

  

          Log the output and returns nothing
@@ -3047,7 +3047,9 @@ 

          if config_dir:

              cmd.extend(['--configdir', config_dir])

  

-         cmd += ['-r', root, '--resultdir', self.mock_results_dir]

+         cmd += ['-r', root]

+         if default_mock_resultdir is not True:

+             cmd += ['--resultdir', self.mock_results_dir]

  

          if shell:

              cmd.append('--shell')

file modified
+5 -1
@@ -1142,6 +1142,10 @@ 

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

              action='store_true',

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

+         mockbuild_parser.add_argument(

+             '--default-mock-resultdir', default=None, dest="default_mock_resultdir",

+             action='store_true',

+             help="Don't modify Mock resultdir.")

  

          mockbuild_parser.set_defaults(command=self.mockbuild)

  
@@ -2422,7 +2426,7 @@ 

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

                                 hashtype=self.args.hash,

                                 shell=self.args.shell,  # nosec

-                                force_local_mock_config=self.args.local_mock_config)

+                                force_local_mock_config=self.args.local_mock_config, default_mock_resultdir=self.args.default_mock_resultdir)

          except Exception as e:

              raise rpkgError(e)

  

with this option we can avoid on every build of a different package or
version etc, create a new directory with builds results, the goal is save
disk space

Signed-off-by: Sérgio M. Basto sergio@serjux.com

Hi.
I haven't tested it yet, but when I am looking at the code, I am afraid that the use of --no-local-resultsdir would possibly disrupt --srpm-mock functionality:
https://docs.pagure.org/rpkg/releases/1.64.html#support-building-srpms-in-target-mock
It requires results in the self.cmd.mock_results_dir.

rfpkg mockbuild -N --srpm-mock

rfpkg mockbuild -N --srpm-mock --no-local-resultsdir

both worked

rebased onto ab7d9057b6cdbdedd7e1d8dd8a06a734848545d1

2 years ago

rebased onto 79fb1055d7e30f86674b4bcaa3c7e485e40ffae0

2 years ago

pretty please pagure-ci rebuild

2 years ago

rebased onto c622ef754b58469f39c39817cbf83ebb2f4c35aa

2 years ago

fedpkg mockbuild -N --srpm-mock --no-local-resultsdir works in my F35 box

rebased onto 9f64f2d8b69753818db03b2652ab25b4b06cb44f

2 years ago

rebased onto 55cdb19e2e1aad9e9dc2b67874f95e737623a48d

2 years ago

rebased onto ae3fcd6c2b3dae30fb4c2ee9c361a08d38360ea5

2 years ago

rebased onto d64cb85ed9b5c838077e306f7583f38b1771d491

2 years ago

@onosek , ok I just did a very simplified thing , if we have --srpm-mock option, --default-mock-resultdir won't be applied because only on self.cmd.mockbuild we add this opinion .

he have only 4 cmd.mockbuild, 3 got srpm_mock=True the other one have default_mock_resultdir=self.args.default_mock_resultdir

command example :

fedpkg mockbuild -N  --root epel-9-x86_64 --default-mock-resultdir

rebased onto cd6ffe47033da0bbab1e61c4586cba3eea934804

2 years ago

rebased onto 35ec8c4

2 years ago

Pull-Request has been closed by sergiomb

2 years ago
Metadata