#1316 rpmbuild: adding scrub bootstrap and scrub chroot
Merged 2 months ago by praiskup. Opened 2 months ago by schlupov.
copr/ schlupov/copr add_scrub  into  master

rpmbuild: do not scrub cache
Silvie Chlupova • 2 months ago  

@@ -42,7 +42,7 @@ 

              srpm = locate_srpm(self.resultdir)

              self.produce_rpm(srpm, self.resultdir)

          finally:

-             self.clean_cache()

+             self.mock_clean()

this belongs to first commit

              self.archive_configs()

  

      def prepare_configs(self):

@@ -96,11 +96,13 @@ 

          if process.returncode != 0:

              raise RuntimeError("Mock build failed")

  

-     def clean_cache(self):

+     def mock_clean(self):

          """ Do best effort /var/mock/cache cleanup. """

          cmd = MOCK_CALL + [

              "-r", self.mock_config_file,

-             "--scrub", "cache", "--quiet",

+             "--scrub", "bootstrap",

+             "--scrub", "chroot",

+             "--quiet",

          ]

          subprocess.call(cmd) # ignore failure here, if any

  

file modified
-2

@@ -1,7 +1,5 @@ 

  include('/etc/mock/{{ chroot }}.cfg')

  

- config_opts['root'] = '{{ task_id }}'

- 

  {% if buildroot_pkgs %}

  config_opts['chroot_additional_packages'] = '{{ buildroot_pkgs| join(" ") }}'

  {% endif %}

file modified
+1 -4

@@ -22,7 +22,7 @@ 

      p_popen = mock.patch('copr_rpmbuild.builders.mock.GentlyTimeoutedPopen')

  

      dummy_patchers = [

-         mock.patch('copr_rpmbuild.builders.mock.MockBuilder.clean_cache'),

+         mock.patch('copr_rpmbuild.builders.mock.MockBuilder.mock_clean'),

          mock.patch('copr_rpmbuild.builders.mock.shutil'),

          mock.patch('copr_rpmbuild.builders.mock.locate_spec',

                     new=mock.MagicMock(return_value='spec')),

@@ -121,7 +121,6 @@ 

          code = compile(cfg, "/tmp/foobar", 'exec')

          exec(code)

  

-         assert config_opts["root"] == "10-fedora-24-x86_64"

          assert config_opts["chroot_additional_packages"] == "pkg1 pkg2 pkg3"

          assert config_opts["rpmbuild_networking"]

          assert not config_opts["use_bootstrap"]

@@ -140,8 +139,6 @@ 

          assert config == """\

  include('/etc/mock/fedora-24-x86_64.cfg')

  

- config_opts['root'] = '10-fedora-24-x86_64'

- 

  

  config_opts['chroot_additional_packages'] = 'pkg1 pkg2 pkg3'

  

I don't think three --scrub options will work. Did you check that? IMO we'll have to have 3 commands instead, and rename the function to something like s/cleanup_cache/mock_cleanup/ ...

While we are on this ....

I added the cache scrub in 03e8e84. That
was done under assumption that we have to clean all the caches anyways because
we do --uniqueext. But I was wrong.

The reason why we have to clean the caches is because we have "per-build" unique
config_opts['root'] variable. I think that we can calmly go and
- stop re-defining the config_opts['root] option and
- stop cleaning the caches
.. and make the consequtive builds much faster, because we wouldn't have to
re-download everything.

Ok, it probably isn't good idea to share yum/dnf caches across several projects,
but builders aren't shared for cross-project builds ... (builder sandboxing). So
I think we can clearly keep root as mock defines it by default.

rebased onto 59a19986f99cdd1698d77d79d2938b88e93f42c8

2 months ago

Can you please use the format

component: topic

longer story why we think we can do this change, e.g.
- we can have max O(N) directories in /var/lib/mock for N enabled chroots in the corresponding project
- each directory should be small enough, but we plan to #787

Relates: PR#1316

Metadata Update from @praiskup:
- Pull-request tagged with: needs-work

2 months ago

2 new commits added

  • rpmbuild: adding scrub bootstrap and scrub chroot
  • rpmbuild: adding scrub bootstrap and scrub chroot
2 months ago

Metadata Update from @schlupov:
- Pull-request untagged with: needs-work

2 months ago

2 new commits added

  • rpmbuild: do not scrub cache
  • rpmbuild: adding scrub bootstrap and scrub chroot
2 months ago

Metadata Update from @praiskup:
- Pull-request tagged with: needs-work

2 months ago

2 new commits added

  • rpmbuild: do not scrub cache
  • rpmbuild: adding scrub bootstrap and scrub chroot
2 months ago

2 new commits added

  • rpmbuild: do not scrub cache
  • rpmbuild: adding scrub bootstrap and scrub chroot
2 months ago

please comment in commit msg that because we have VM sandboxes we never build into more projects on one builder

Ping on those two points above ^^^.

rebased onto 0a2a780

2 months ago

Nothing changed since the last time, just docs. +1, merging, thanks.

Commit eae418d fixes this pull-request

Pull-Request has been merged by praiskup

2 months ago

Metadata Update from @praiskup:
- Pull-request untagged with: needs-work

2 months ago