Mailinglist Archive: opensuse-packaging (118 mails)

< Previous Next >
Re: [opensuse-packaging] suse_version handling troubles/solutions

Hello,

On Jun 11 15:55 Jan Engelhardt wrote (excerpt):
On Thursday 2015-06-11 15:52, Johannes Meixner wrote:

I would prefer if I could test for the actual requirement like
------------------------------------------------------------------
%if %build_system_package_version foo >= 1.2.3
BuildRequires: foo
%endif

But exactly that was already identified to be a problem of its own.
In one repository, you have foo>= 1.2.3, and in another you don't,
making the whole thing not as reproducible as one would want to.

Yes I know.

If I want to ensure it is compiled "--with-something"
for openSUSE >= 13.2 I would specify that as my actual condition
if the plain version value is actually the real requirement
(but see what I wrote at the end):
-------------------------------------------------------------------------
# Since openSUSE 13.2 compile it "--with-something":
%if 0%{?suse_version} >= 1320
BuildRequires: something
%endif
.
.
.
# Since openSUSE 13.2 compile it "--with-something":
%configure \
%if 0%{?suse_version} >= 1320
--with-something \
%endif
-------------------------------------------------------------------------
I don't remember if "BuildRequires: any_RPM_capability"
works - i.e. when package foo provides something that
then "BuildRequires: something" installs package foo.

But again the test for the product version does not tell why
for openSUSE >= 13.2 it must be compiled "--with-something".

Assume for openSUSE >= 13.2 it must be compiled "--with-something"
because for openSUSE >= 13.2 there the dependant package bar >= 1.2.3
which requires it to be compiled "--with-something" then
I would like to specify the actual requirement like:
-------------------------------------------------------------------------
%if %package_version bar >= 1.2.3
BuildRequires: something
Essentialfor: bar >= 1.2.3
%else
Conflicts: bar >= 1.2.3
%endif
.
.
.
%configure \
%if %package_version bar >= 1.2.3
--with-something \
%endif
-------------------------------------------------------------------------

Again the test for the package bar version does not tell why
that version makes a difference so that even this version test
should be ideally replaced with an actual requirement like:
-------------------------------------------------------------------------
%if %package_requires bar something_related
BuildRequires: something
Essentialfor: bar requires something_related
%else
Conflicts: bar requires something_related
%endif
.
.
.
%configure \
%if %package_requires bar something_related
--with-something \
%endif
-------------------------------------------------------------------------
An obvious precondition is that package bar >= 1.2.3 has a RPM
requirement for something_related.

It depends what something_related is.
It could be even the same as "something".

E.g. assume "something_related" is "/usr/bin/fancy_tool"
which is provided by the package foo.

Then package bar >= 1.2.3 could have
-------------------------------------------------------------------------
Requires: /usr/bin/fancy_tool
-------------------------------------------------------------------------
and the tests could look like
-------------------------------------------------------------------------
%if %package_requires bar /usr/bin/fancy_tool
BuildRequires: /usr/bin/fancy_tool
Essentialfor: bar requires /usr/bin/fancy_tool
%define with_or_without_fancy_tool_support --with-fancy-tool-support
%else
Conflicts: bar requires /usr/bin/fancy_tool
%define with_or_without_fancy_tool_support --without-fancy-tool-support
%endif
.
.
.
%configure \
%with_or_without_fancy_tool_support \
-------------------------------------------------------------------------

In the end what I like to tell is that tests for versions
result meaningless code in the spec files.

Therefore I think it would be good if tests for versions could
be in the future replaced by tests for actual requirements
except the plain version value is the actual requirement.

For example assume in a future product openSUSE 42.0
support for /usr/bin/fancy_tool in package bar is wanted.
Then a patterns RPM spec file for openSUSE 42.0 could
contain something like
-------------------------------------------------------------------------
%if 0%{?suse_version} >= 4200
Requires: bar requires /usr/bin/fancy_tool
%endif
-------------------------------------------------------------------------
instead of a meaningless
-------------------------------------------------------------------------
%if 0%{?suse_version} >= 4200
Requires: bar >= 1.2.3
%endif
-------------------------------------------------------------------------


Kind Regards
Johannes Meixner
--
SUSE LINUX GmbH - GF: Felix Imendoerffer, Jane Smithard,
Dilip Upmanyu, Graham Norton - HRB 21284 (AG Nuernberg)

--
To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-packaging+owner@xxxxxxxxxxxx

< Previous Next >