[opensuse-buildservice] RPM %error does not stop build
Hello, in the buildservice, putting the %error macro in the spec file will emit an error into the "RPM build errors" section, but will not stop the build unless another error happens; on the contrary, if no other error happens, the package gets fully built. This is a problem for me because I'm trying to build a macro that detects a condition that does not prevent build now, but will cause problems in the future. Is there another option to stop the build, preferably from an arbitrary place in the spec file? thanks m.
Hi Jan, * jan matejek (jmatejek@suse.com) [20161201 18:34]:
Is there another option to stop the build, preferably from an arbitrary place in the spec file?
How about a plain 'exit 1'? Philipp -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
On Friday 2016-12-02 09:08, Philipp Thomas wrote:
Hi Jan,
* jan matejek (jmatejek@suse.com) [20161201 18:34]:
Is there another option to stop the build, preferably from an arbitrary place in the spec file?
How about a plain 'exit 1'?
Summary: exit 1 Sorry, does not work. SCNR :-) -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
On 12/02/2016 07:28 PM, Jan Engelhardt wrote:
On Friday 2016-12-02 09:08, Philipp Thomas wrote:
Hi Jan,
* jan matejek (jmatejek@suse.com) [20161201 18:34]:
Is there another option to stop the build, preferably from an arbitrary place in the spec file?
How about a plain 'exit 1'?
Summary: exit 1
Sorry, does not work. SCNR :-)
"foo-bar 1" probably exits with a "foo-bar command not found error" but this is likely not a sensible solution to the problem. -- Simon Lees (Simotek) http://simotek.net Emergency Update Team keybase.io/simotek SUSE Linux Adeliade Australia, UTC+9:30 GPG Fingerprint: 5B87 DB9D 88DC F606 E489 CEC5 0922 C246 02F0 014B
* Jan Engelhardt (jengelh@inai.de) [20161202 09:58]:
How about a plain 'exit 1'?
Summary: exit 1
;-))) OK, to be precise> 'exit 1' in any section that can contain code like %prep, %build or %install. Philipp -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
On 2.12.2016 11:27, Philipp Thomas wrote:
* Jan Engelhardt (jengelh@inai.de) [20161202 09:58]:
How about a plain 'exit 1'?
Summary: exit 1
;-)))
OK, to be precise> 'exit 1' in any section that can contain code like %prep, %build or %install.
Yeah, unfortunately these sections are not easily accessible to me, and emitting a second %prep will instead fail with "duplicate %prep", which is uninformative and misleading.
Philipp
On Thu, Dec 01, 2016 at 06:34:27PM +0100, jan matejek wrote:
in the buildservice, putting the %error macro in the spec file will emit an error into the "RPM build errors" section, but will not stop the build unless another error happens; on the contrary, if no other error happens, the package gets fully built.
How is this a build service error? That sounds like an rpm bug. Do you have an example somewhere in OBS? Cheers, Michael. -- Michael Schroeder mls@suse.de SUSE LINUX GmbH, GF Jeff Hawn, HRB 16746 AG Nuernberg main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);} -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
hello, as mls correctly pointed out, it is actually a bug in rpmbuild: it emits the error but returns success. I have filed bsc#1013275 https://bugzilla.suse.com/show_bug.cgi?id=1013275 In case anyone else runs into this, here's a solution I'm using now. Given that my macros are mostly in Lua, i can do this: %{lua: io.stderr:write("Here is the cause of the error.") os.exit(1)} To this, RPM reacts by declaring that "exit is not allowed in this context", but the stderr message remains directly above it. This is good enough for me and works from anywhere in the spec file, including Summary, %description, even comments :) With pure RPM macros, you can emit the following: %package -n errorpackage %{error:This is the cause of your error.} Error: error Again, RPM breaks on unknown tag Error, but the %error message is retained right above it. regards m. On 1.12.2016 18:34, jan matejek wrote:
Hello,
in the buildservice, putting the %error macro in the spec file will emit an error into the "RPM build errors" section, but will not stop the build unless another error happens; on the contrary, if no other error happens, the package gets fully built.
This is a problem for me because I'm trying to build a macro that detects a condition that does not prevent build now, but will cause problems in the future.
Is there another option to stop the build, preferably from an arbitrary place in the spec file?
thanks m.
participants (5)
-
Jan Engelhardt
-
jan matejek
-
Michael Schroeder
-
Philipp Thomas
-
Simon Lees