This avoids a FileNotFoundError when running build-rpms-local in a clean directory (with only container.yaml).
Thanks! I think it would be a bit better to move the call to self.base_workdir.mkdir() in build() up above the call to createrepo.
build() doesn't reference self.base_workdir until after the current mkdir() call (since self.mock_cfg_path is defined relative to self.base_workdir). createrepo does explicitly reference self.base_workdir, hence this patch. It is not clear to me the relationship between self.base_workdir and self.repo_path. Furthermore, this makes createrepo self-containing, as not every caller needs to remember to mkdir before calling it first.
self.base_workdir
build() is the wrapper function around the whole build process - build_item() and createrepo() can only occur within build().
So, what I'd expect is
def build(self): self.base_workdir.mkdir(parents=True, exist_ok=True) # The repo will be referenced in the mock config, since it # is a build-requirements source as well as a destination, # so we need to make sure it valid before we start building if not (self.repo_path / "repodata/repomd.xml").exists(): asyncio.run(self.createrepo()) with open(self.mock_cfg_path, "w") as f: f.write(self.mock_cfg) super().build()
and from my perspective, i just added the createrepo() call in the wrong place. If the call to self.base_workdir.mkdir() was specific to self.mock_cfg_path, I would have written: self.mock_cfg_path.parent.mkdir()
self.base_workdir.mkdir()
self.mock_cfg_path.parent.mkdir()
Of course, it doesn't really matter... your patch would work fine.
Merging, doesn't really matter. Thanks for the patch!
Pull-Request has been merged by otaylor
This avoids a FileNotFoundError when running build-rpms-local in a clean directory (with only container.yaml).