How to abort a macports portfile on an error condition?

Ken Cunningham ken.cunningham.webuse at gmail.com
Mon Oct 5 04:01:28 UTC 2020


hey, thanks Ryan for taking care of this little detail.

K










On 2020-10-03, at 11:48 AM, Ken Cunningham wrote:

> Martin, I'm trying to understand how this is happening to you.
> 
> you should not need to be doing that in your Portfile, and users should never need to make that symlink.
> 
> The linuxdoc-tools port has this:
> 
> depends_build   bin:latex:texlive \
>                 path:bin/perl:perl5
> 
> 
> But it seems that you're saying that perl5 is not just a build dep, but also a runtime dep?
> 
> If so, if we change that part to:
> 
> depends_lib     path:bin/perl:perl5
> 
> Then that will force perl5 to be available at runtime as well.
> 
> Is that the proper fix?
> 
> Ken
> 
> 
>> That's. That worked. Preparing a pull request.
>> 
>> Eric F schrieb:
>> > 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
>> > 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20201004/669df6d6/attachment.htm>


More information about the macports-dev mailing list