[108224] trunk/dports/science/netcdf/Portfile

Ryan Schmidt ryandesign at macports.org
Tue Jul 16 23:04:04 PDT 2013


On Jul 16, 2013, at 23:52, Lawrence Velázquez <larryv at macports.org> wrote:

> On Jul 16, 2013, at 4:48 PM, takeshi at macports.org wrote:
> 
>> Revision: 108224
>>         https://trac.macports.org/changeset/108224
>> Author:   takeshi at macports.org
>> Date:     2013-07-16 13:48:40 -0700 (Tue, 16 Jul 2013)
>> Log Message:
>> -----------
>> netcdf: force using +openmpi when hdf5-18 +openmpi is installed, closing #39529
>> 
>> Modified Paths:
>> --------------
>>   trunk/dports/science/netcdf/Portfile
>> 
>> Modified: trunk/dports/science/netcdf/Portfile
>> ===================================================================
>> --- trunk/dports/science/netcdf/Portfile	2013-07-16 20:46:30 UTC (rev 108223)
>> +++ trunk/dports/science/netcdf/Portfile	2013-07-16 20:48:40 UTC (rev 108224)
>> @@ -29,14 +29,12 @@
>> 
>> patchfiles          patch-configure.diff
>> 
>> -pre-configure {
>> -    if {[variant_isset openmpi]} {
>> -        set hdf5cc [exec grep "C Compiler" ${prefix}/lib/libhdf5.settings | awk {BEGIN{FS="/"}{print $NF}}]
>> -        if {${hdf5cc}!="openmpicc"} {
>> -            ui_error "Install hdf5-18 +openmpi"
>> -            return -code error "hdf5-18 +openmpi not installed"
>> -        }
>> -    }
>> +set hdf5cc [exec grep "C Compiler" ${prefix}/lib/libhdf5.settings | awk {BEGIN{FS="/"}{print $NF}}]
>> +if {${hdf5cc}=="openmpicc"} {
>> +    default_variants +openmpi
>> +} elseif {[variant_isset openmpi]} {
>> +    ui_error "Install hdf5-18 +openmpi"
>> +    return -code error "hdf5-18 +openmpi not installed"
>> }
> 
> This Portfile now fails to parse if hdf5-18 is not installed.
> 
>    % port -d sync
>    --->  Updating the ports tree
>    DEBUG: Skipping file:///Users/larryv/Projects/MacPorts/users/larryv/dports
>    Synchronizing local ports tree from file:///Users/larryv/Projects/MacPorts/trunk/dports
>    DEBUG: /opt/local/bin/svn update --non-interactive /Users/larryv/Projects/MacPorts/trunk/dports
>    Updating '/Users/larryv/Projects/MacPorts/trunk/dports':
>    At revision 108250.
>    Creating port index in /Users/larryv/Projects/MacPorts/trunk/dports
>    Failed to parse file science/netcdf/Portfile: grep: /opt/local/lib/libhdf5.settings: No such file or directory
> 
>    Total number of ports parsed:   1 
>    Ports successfully parsed:      0 
>    Ports failed:                   1 
>    Up-to-date ports skipped:       17361
> 
>    %

Right. You cannot be sure that the dependency is installed until you're in a phase, and by the time you're in a phase, it's too late to change variants.

If you really want to enforce the openmpi variants match between these two ports, you'll have to use the require_active_variants procedure from the active_variant 1.1 portgroup. If the openmpi variant of this port is selected, require that the openmpi variant of the dependency is selected, and if the openmpi variant of this port is not selected, require that the openmpi variant of the dependency is not selected.




More information about the macports-dev mailing list