Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep re-creating the root directory #1227

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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).