Skip to content

Commit

Permalink
Keep re-creating the root directory for each build
Browse files Browse the repository at this point in the history
  • Loading branch information
praiskup committed Sep 18, 2023
1 parent a2e6198 commit c068147
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mock/py/mockbuild/buildroot.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ def _setup_basedir(self):
mockgid = grp.getgrnam('mock').gr_gid
os.chown(self.basedir, os.getuid(), mockgid)
os.chmod(self.basedir, 0o775)
file_util.mkdirIfAbsent(self.make_chroot_path())

@traceLog()
def _setup_result_dir(self):
Expand Down Expand Up @@ -276,6 +275,7 @@ def _fallback(message):
def _init(self, prebuild):
self.state.start("chroot init")
self._setup_basedir()
file_util.mkdirIfAbsent(self.make_chroot_path())
self.plugins.call_hooks('mount_root')
# intentionally we do not call bootstrap hook here - it does not have sense
self._setup_nosync()
Expand Down
1 change: 1 addition & 0 deletions releng/generate-release-notes
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ TRANSFORM = {
"issue": "https://github.com/rpm-software-management/mock/issues/{id}",
"PR": "https://github.com/rpm-software-management/mock/pull/{id}",
"commit": "https://github.com/rpm-software-management/mock/commit/{id}",
"copr_issue": "https://github.com/fedora-copr/copr/issues/{id}",
}

TEMP_FILE = ".Release-Notes-Next.md"
Expand Down
17 changes: 17 additions & 0 deletions releng/release-notes-next/create-rootdir-for-each-build.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[commit#1e13b56ce3c0efdf81][] caused "basedir" to be created only once per Mock
run, but likewise directory "rootdir" was created only once.

Since Mock automatically unmounts rootdir **after each build** and then
also **removes the rootdir** directory to finish the cleanup tasks (at
least if tmpfs or other "root" plugin is in use, --resultdir is in
use, ...), subsequent builds failed to re-mount the rootdir with, e.g.:

ERROR: Command failed:
$ mount -n -t tmpfs -o mode=0755 -o nr_inodes=0 -o size=140g mock_chroot_tmpfs /var/lib/mock/fedora-37-x86_64-1694797505.326095/root

This caused problems e.g. [in Fedora Copr][copr_issue#2916] where each
Mock build is actually a two-step build done like:

mock --spec foo.spec --sources . --resultdir ...

So Mock first builds SRPM, and then builds RPMs (two builds in one run).

0 comments on commit c068147

Please sign in to comment.