Mailinglist Archive: opensuse-buildservice (137 mails)

< Previous Next >
Re: [opensuse-buildservice] Patch: drop "Suggests:" and "Recommends:" if rpm does not know them
Am 14.11.2015 um 14:29 schrieb Neal Gompa:
On Sat, Nov 14, 2015 at 7:12 AM, Stefan Seyfried
<stefan.seyfried@xxxxxxxxx> wrote:

I'm running an OBS instance, used amongst others to build stuff for
multiple distributions (SLES and RHEL, mostly).

Now if I import packages from openSUSE OBS, I often have to patch the
spec file. 95% of these patches are like this:

+%if 0%{?suse_version}
Recommends: not_really_necessary_thing_1
Suggests: totally_unnecessary_thing_2

I automated this task in build-recipe-spec: If the target's RPM does not
know "Recommends:" or "Suggests:", just drop these lines.

This is made configurable with the following prjconf
Buildflags: dropunknownrpmtags

here is the patch for discussion, if this would be interesting for
upstream, I'll prepare a proper pull request.

Your patch assumes that only SUSE would support weak dependencies.

No, it does not.
The only thing that it does assume (maybe wrong, this comes from the
initial version which was not configurable via prjconf) is, that every
SUSE version's rpm supports Suggests: and Recommends.

However this is not the case. While it is true SUSE's patched RPM has
had it for quite a while, it was upstreamed into mainline RPM for RPM
4.12. In the current supported distribution selection list, Fedora 21
and newer (as well as Mageia 5 and newer) have support for it.

The patch does the following (pseudo code):

if ! building_for_suse() and buildflags[dropunknownrpmtags]; then
for i in Suggests: Recommends; do
if ! fancy_code_to_check_if_targets_rpm_supports($i); then

The "building_for_suse()" could actually go away. It was originally
there to make sure to not break things that were working before.

And if they are building with debbuild (which can use RPM spec to
produce native Debian packages), the tags are supported as well for
all Debian targets.

And? Does my patch change this? I can't imagine how, but then I never
tried to build debian packages from rpm specs.

My suggestion: add a check for the BuildEngine so that it doesn't do
anything when debbuild is being used and also ask RPM what version it
is if it isn't SUSE or debbuild and evaluate based on that.

Version checks are unreliable. I check if the target rpm knows the tag,
which is much better. I really don't like magic version numbers hard
coded into this. What if someone uses a prerelease of rpm with an older
number, but the feature supported? What if a distribution decides to
backport one of those tags to their released product? My code does catch
all those cases.
And even if debbuild would use the code in "build-recipe-spec", then I
still believe it could just work anyway.

Best regards,

Stefan Seyfried

"For a successful technology, reality must take precedence over
public relations, for nature cannot be fooled." -- Richard Feynman
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-buildservice+owner@xxxxxxxxxxxx

< Previous Next >