Re: how to debug failures inside mock when building takes a long time?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09. 03. 22 8:57, Felix Schwarz wrote:
Hi Kevin,

Am 08.03.22 um 01:33 schrieb Kevin Kofler via devel:
There is actually a "mock shell" command that opens a shell inside the mock
chroot. You can also run arbitrary shell commands (including scripts that
you have previously manually copied in using the "copyin" command) in it.

I knew "mock shell" (via "fedpkg mockbuild --shell") but that only gave me a shell at the very beginning of the build process while (ideally) I wanted to set a kind of "breakpoint"+gdb/pdb at an arbitrary point in the build process. (For example most of the build process works just fine so I want all the %prep/%build steps to run automatically while only fiddling around inside %check.)

After reading your answer + mock manpages I discovered mock's "--no-cleanup-after" which could help inspecting the state after a failed run. That should be pretty helpful, I'll try that next time I need to figure out why some test suite is failing. :-)

When I do iterative changes, I generally always build with:

First build:

 $ mock -r ... clean && fedpkg --release rawhide mockbuild -N

Next build:

 $ fedpkg --release ... mockbuild -N

When the deps are unchanged:

 $ fedpkg --release ... mockbuild -N --disablerepo='*'

There is also the ccache plugin that might make things faster, but it breaks with --disablerepo='*' :(


My commands give me a mock environment where I can shell in an execute commands when failures happen. A good shell commands are

 $ mock -r ... shell --unpriv --cwd /builddir/build/BUILD/
 $ mock -r ... shell --unpriv --cwd /builddir/build/BUILD/foobar-6.6.6/


However, shelling in is useful but sometimes, when %build takes (a) hour(s), it is still tedious to do iterative changes in what is written in %install, %check or %files.


Mock has a --short-circuit option:

  --short-circuit {prep,install,build,binary}
                        Pass short-circuit option to rpmbuild to skip already
                        complete stages. Warning: produced packages are
                        unusable. Implies --no-clean. Valid options: build,
                        install, binary

It passes the following options to rpmbuild:

https://github.com/rpm-software-management/mock/blob/mock-2.16-1/mock/py/mockbuild/backend.py#L705

When the package build (with -N) fails in %check, %install or %files (but you assume the result of %build is correct), you can run:

 $ fedpkg --release rawhide mockbuild -N -- --short-circuit install

(The -- separates options that fedpkg understands from options that it just blindly passes down to mock.)

It will create a new SRPM, install any new deps added as BuildRequires (but I think it's skip %generate_buildrequires), cd to the right directory (no idea how it knows) and executes %install, %check and creates the RPM packages.

It is almost magical.

It can however, sometimes explode miserably. E.g. when %install actually moves files in builddir first and you try to do this twice.

Hope that helps.
--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux