How to abort a macports portfile on an error condition?
Nils Breunese
nils at breun.nl
Sat Oct 3 10:42:04 UTC 2020
There is also ‘known_fail yes’, which I see getting combined with ‘return -code error’: https://trac.macports.org/ticket/60566
I’m not familiar with the precise differences between known_fail, ui_error and return -code error.
Nils.
> Op 3 okt. 2020, om 12:30 heeft Eric F <eric at iefdev.se> het volgende geschreven:
>
> Try using “return -code error”, something like:
>
> ```tlc
> if {![file exists ${prefix}/bin/perl]} {
> ui_error "
> «${prefix}/bin/perl» is missing but the linuxdoc-tools depends on it.
>
> Please create an appropriate symbolic link for linuxdoc-tools to work.
> "
> return -code error "missing dependency"
> }
> ```
>
> · Eric
>
> On 10/3/20 11:15 , Martin Krischik wrote:
>> Hello,
>>
>> I working on a version bump on the **cc65** and encountered a problem
>> with the **linuxdoc-tools**. Since I can't fix the **linuxdoc-tools**
>> and there is a simple workaround possible I decided to add an if
>> statement to inform the user together with the workaround:
>>
>> ```tlc
>> if {! [file exists ${prefix}/bin/perl] } {
>> ui_error "
>> «${prefix}/bin/perl» is missing but the linuxdoc-tools depends on it.
>>
>> Please create an appropriate symbolic link for linuxdoc-tools to work.
>> "
>> exit 1
>> }
>> ```
>>
>> Crude but the best I can do since I'm neither the **perl5** nor the
>> **linuxdoc-tools** maintainer and I don't want to spend to much time on
>> a otherwise simple version bump.
>>
>> However, the MacPorts doesn't understand `exit 1` and `ui_error` won't
>> stop execution on its own.
>>
>> How do I stop the execution so not to waste the users time on a build
>> which will otherwise fail right at the end.
>>
>> Regards
>>
>> Martin
>>
>
More information about the macports-dev
mailing list