[opensuse-buildservice] Question about logic in an example spec file?
I'm getting started writing a spec file for use on OBS. I'm looking at some examples to help figure stuff out. In one pkg's spec file there's this piece of code %if 0%{?suse_version} >= 1210 || 0%{?fedora_version} (1) BuildRequires: systemd %{?systemd_requires} %define have_systemd 1 %else %if 0%{?suse_version} <= 1220 (2) PreReq: %fillup_prereq PreReq: %insserv_prereq %endif %if 0%{?suse_version} > 1220 (3) PreReq: %fillup_prereq Requires: /usr/sbin/service %endif %endif ------ The way I read that if the Suse version >= 1210, the (1) 'if' clause will exec, and (2) & (3) will be skipped. But (3) requires Suse version > 1220 to execute. So there's NO WAY for the (3) clause to ever be reached, right? Why's it in there? Jim -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
On Thu, Dec 31, 2015 at 2:37 PM, <jimssupp@rushpost.com> wrote:
I'm getting started writing a spec file for use on OBS.
I'm looking at some examples to help figure stuff out.
In one pkg's spec file there's this piece of code
%if 0%{?suse_version} >= 1210 || 0%{?fedora_version} (1) BuildRequires: systemd %{?systemd_requires} %define have_systemd 1 %else %if 0%{?suse_version} <= 1220 (2) PreReq: %fillup_prereq PreReq: %insserv_prereq %endif %if 0%{?suse_version} > 1220 (3) PreReq: %fillup_prereq Requires: /usr/sbin/service %endif %endif ------
The way I read that if the Suse version >= 1210, the (1) 'if' clause will exec, and (2) & (3) will be skipped.
But (3) requires Suse version > 1220 to execute.
So there's NO WAY for the (3) clause to ever be reached, right?
Why's it in there?
Jim
As a guess: A lot of spec files in OBS are updated via automated scripts. They aren't always the smartest. The code probably had: %if 0%{?suse_version} >= 1210 || 0%{?fedora_version} (1) BuildRequires: systemd %{?systemd_requires} %define have_systemd 1 %else (2) PreReq: %fillup_prereq PreReq: %insserv_prereq %endif Before an automated script came along and fixed the else clause. One way to tell is to look back at the revision history of the spec file. Hopefully the changes file will detail that an automated script made the change. Greg -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
As a guess:
A lot of spec files in OBS are updated via automated scripts. They aren't always the smartest.
The code probably had:
%if 0%{?suse_version} >= 1210 || 0%{?fedora_version} (1) BuildRequires: systemd %{?systemd_requires} %define have_systemd 1 %else (2) PreReq: %fillup_prereq PreReq: %insserv_prereq %endif
Before an automated script came along and fixed the else clause.
One way to tell is to look back at the revision history of the spec file. Hopefully the changes file will detail that an automated script made the change.
This example just happens to come from Shorewall. I wanted an example that had multiple subpackages & dealt with multiple distros. I have this one installed even though it doesn't look like it's being updated anymore. (Eventually I guess I'll get around to build something newer maybe.) Looking at its history, https://build.opensuse.org/package/revisions/openSUSE:Factory/shorewall I'm not even sure yet what I'm looking for in these to tell if this was automated. :-/ But your 'guess' sure sounds reasonable. Jim -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
On Thu, 2015-12-31 at 12:03 -0800, jimssupp@rushpost.com wrote:
As a guess:
A lot of spec files in OBS are updated via automated scripts. They aren't always the smartest.
The code probably had:
%if 0%{?suse_version} >= 1210 || 0%{?fedora_version} (1) BuildRequires: systemd %{?systemd_requires} %define have_systemd 1 %else (2) PreReq: %fillup_prereq PreReq: %insserv_prereq %endif
Before an automated script came along and fixed the else clause.
One way to tell is to look back at the revision history of the spec file. Hopefully the changes file will detail that an automated script made the change.
This example just happens to come from Shorewall. I wanted an example that had multiple subpackages & dealt with multiple distros. I have this one installed even though it doesn't look like it's being updated anymore. (Eventually I guess I'll get around to build something newer maybe.)
Looking at its history,
https://build.opensuse.org/package/revisions/openSUSE:Factory/shorewa ll
I'm not even sure yet what I'm looking for in these to tell if this was automated. :-/
But your 'guess' sure sounds reasonable.
Jim
This error actually happened in this request: https://build.opensuse.org/request/show/137409, just a bit over three years ago :) I doubt there was any automatism involved... Cheers, Dominique -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
participants (3)
-
Dominique Leuenberger / DimStar
-
Greg Freemyer
-
jimssupp@rushpost.com