-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Hi fellow packagers,
I'm attempting to add a conditional in spec for running tests in a package. The goal is to have an option to disable the tests in %check and conditionally removing the related build requirements. The example is a python package [1].
The conditional is "%bcond_without test" and the test requirements are wrapped in an if clause like:
%if %{with test} BuildRequires: %{python_module blinker} ... %endif
Similarly the %check section looks like:
%if %{with test} %pytest %endif
I've added the following to the project config:
Macros: %_without_test 1 :Macros
However, OBS does not respect the conditonal and complains that some of the BuildRequires inside the if block are unresolvable. I've tested this with another package where there are no missing build requirements and OBS skips the tests as expected.
Is there a way to have OBS ignore the BuildRequires inside a conditional like this?
[1] https://build.opensuse.org/package/show/home:seanmarlow:branches:devel:langu...
Thanks,
- -- Sean Marlow Public Cloud Developer sean.marlow@suse.com
N�����r��y隊Z)z{.��ZrF��x>�{.n�+������Ǩ��r��i�m��0��ޙ���������$j���0�����Ǩ�
Hello,
Am Mittwoch, 31. Juli 2019, 17:39:05 CEST schrieb Sean Marlow:
I'm attempting to add a conditional in spec for running tests in a package. The goal is to have an option to disable the tests in %check and conditionally removing the related build requirements. The example is a python package [1].
The conditional is "%bcond_without test" and the test requirements are wrapped in an if clause like:
I'll copy&paste a comment I added to apparmor.spec years ago:
# warning - confusing syntax ahead ;-) # bcond_with means "disable" # bcond_without means "enable"
So to disable the tests, you'll need %bcond_with test
Regards,
Christian Boltz
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
On Wed, 2019-07-31 at 18:56 +0200, Christian Boltz wrote:
Hello,
Hi,
Am Mittwoch, 31. Juli 2019, 17:39:05 CEST schrieb Sean Marlow:
I'm attempting to add a conditional in spec for running tests in a package. The goal is to have an option to disable the tests in %check and conditionally removing the related build requirements. The example is a python package [1].
The conditional is "%bcond_without test" and the test requirements are wrapped in an if clause like:
I'll copy&paste a comment I added to apparmor.spec years ago:
# warning - confusing syntax ahead ;-) # bcond_with means "disable" # bcond_without means "enable"
So to disable the tests, you'll need %bcond_with test
This is not what I understood from reading the docs even though they are very confusing [2].
"That is, if you defined --with, and now you want to use --without, the right way to do is do nothing, because if you define --with, the default will leave as without."
- From the docs it seems bcond_with is ignored by default so tests would not run. To enable tests you add the with macro to the project conf. The bcond_without is enabled by default. To disable tests you add the without macro to the project conf.
The tests should be enabled by default so that's why I chose the bcond_without option.
The %check section seems to work as expected when the without macro is added to project conf. The tests are not run. However, even though the BuildRequires are in a similar if clause OBS still picks those up and expects them to resolve even when tests are disabled.
The information on setting the macro value I found at [3].
Regards,
Christian Boltz
Und wie nennt man das Gegenteil von Durstig?
Besoffen. [Kai Poehlmann & Mickey Kottenhahn in detebe]
[2] https://en.opensuse.org/openSUSE:RPM_conditional_builds [3] https://en.opensuse.org/openSUSE:Build_Service_prjconf
Thanks,
- -- Sean Marlow Public Cloud Developer sean.marlow@suse.com
On Wednesday, 31 July 2019 18.56.48 CEST Christian Boltz wrote:
Hello,
Am Mittwoch, 31. Juli 2019, 17:39:05 CEST schrieb Sean Marlow:
I'm attempting to add a conditional in spec for running tests in a package. The goal is to have an option to disable the tests in %check and conditionally removing the related build requirements. The example is a python package [1].
The conditional is "%bcond_without test" and the test requirements
are wrapped in an if clause like:
I'll copy&paste a comment I added to apparmor.spec years ago:
# warning - confusing syntax ahead ;-) # bcond_with means "disable" # bcond_without means "enable"
So to disable the tests, you'll need %bcond_with test
Correct: Read "bcond_with" as "only define the following if set as build condition, which is not set by default.