On Sun, Sep 1, 2024 at 5:31 PM Dridi Boukelmoune
<dridi.boukelmo...@gmail.com> wrote:
>
> > I made the scripts end with something written to stderr followed by an
> > explicit "exit 1", and I can see the error message, but then it just
> > succeeds. So my question is how to make RPM register that a dependency
> > generator failed and in turn fail the build?
>
> I tried following the rpmdeps code but I gave up after one indirection
> too many. I'm unfortunately unfamiliar with the RPM code base. I also
> tried to use the %error macro using parametric macros for my
> generators. I was able to get an error message but it wouldn't fail
> the build either. Eventually, I accidentally found a nasty dirty trick
> to fail the build:
>
>     echo '!error: something went wrong!'
>
> In the logs I get this:
>
> > RPM build errors:
> >    Dependency tokens must begin with alpha-numeric, '_' or '/': !error: 
> > something went wrong!
>
> I can't say I'm proud of this hack but at least, the error message
> shows up to give a clue. I can finally add some error handling to my
> dependency generators.

Yes, currently the exit code is ignored, and the only way to break the
build is to generate a line that does not parse as a valid RPM
dependency.

The Rust dependency generator does something similar, and the Python
generator does too, AFAIK.

Fabio
-- 
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to