Mailinglist Archive: opensuse-buildservice (177 mails)

< Previous Next >
[opensuse-buildservice] Re: RPM %error does not stop build
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.



< Previous Next >
List Navigation
References