On Sunday, January 31, 2021 4:17:04 PM CET Miro HronĨok wrote:
On 31. 01. 21 15:35, Pavel Raiskup wrote:
> I don't know, perhaps we could have some configurable coefficient for
> timeout_in Copr_ for emulated architectures? If that was say "3", and
> the --timeout was 3600s, emulated arches would get 10800s instead?
There can be a macro that you would use like this:
--timeout %{adjust_timeout 3600}
Currently the environment (the copr-rpmbuild wrapper script) guards that mock
doesn't run longer than expected (it is not a mock built-in timeout).
Not saying it is not possible to do this in Copr, but it wouldn't be an easy
thing to implement. Much easier would be something like --timeout 3600
--timeout-armhfp=7200, or --timeout-forcearch=300%, or something alike.
Pavel
And the macro would:
Check if %__timeout_coefficient is set. If not, evaluate to the first argument
as is. If set, multiply the two numbers and evaluate to that.
The emulated copr chroots would define the %__timeout_coefficient macro to a
value provided by the admins (via an educated guess).
-----
A proof of concept macro definition (requires RPM 4.16+ == Fedora 33+):
%adjust_timeout() %[%{?__timeout_coefficient}%{?!__timeout_coefficient:1} * %1]
(It would require a rewrite to Lua / Shell if we want to support float values as
well, as RPM expressions AFAIK only know integers.)
-----
Obviously, there is a downside. If we go this way and define %adjust_timeout in
Fedora and/or upstream RPM, spec files with --timeout %{adjust_timeout 3600}
will only work on new enough Fedoras. There is an ugly way to actually make the
spec file compatible with past versions:
--timeout %{?adjust_timeout:%{adjust_timeout 3600}}%{?!adjust_timeout:3600}
Since this is hideous, I would prefer to backport the macro wherever possible :/