Am 14.11.2015 um 14:29 schrieb Neal Gompa:
On Sat, Nov 14, 2015 at 7:12 AM, Stefan Seyfried <stefan.seyfried@gmail.com> wrote:
Hi,
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 +%endif
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 remove_from_specfile($i); fi done fi 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, seife -- 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@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org