Opened 11 years ago

Closed 11 years ago

#39785 closed defect (fixed)

netcdf fails to index

Reported by: neverpanic (Clemens Lang) Owned by: tenomoto (Takeshi Enomoto)
Priority: Normal Milestone:
Component: ports Version: 2.1.3
Keywords: Cc:
Port: netcdf

Description

When I try to generate PortIndex, I see:

Failed to parse file science/netcdf/Portfile: grep: /opt/local/lib/libhdf5.settings: No such file or directory

Please ensure the Portfile does execute correctly without the file /opt/local/lib/libhdf5.settings present (e.g. by wrapping the call to grep with a catch statement). If you want to change the default variants and/or throw an error depending on whether a certain variant is present in a dependent port, you can use the active_variants PortGroup (see source:trunk/dports/_resources/port1.0/group/active_variants-1.1.tcl, which has some documentation).

Change History (4)

comment:1 Changed 11 years ago by tenomoto (Takeshi Enomoto)

Resolution: fixed
Status: newclosed

Thank you for pointing this out. I didn't pay enough attention to what happens if hdf5-18 is not installed. Now the grep is called if netcdf4 variant (default), which defines the dependency to hdf5-18, is set.

comment:2 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: closedreopened

Not enough:

$ port info netcdf +netcdf4
Error: Unable to open port: grep: /opt/local/lib/libhdf5.settings: No such file or directory

You cannot be sure that the dependency has been installed by that time. You should use the active_variants 1.1 portgroup as already discussed in greater detail on the mailing list.

comment:3 Changed 11 years ago by tenomoto (Takeshi Enomoto)

I wrapped the call to grep with active_variants command.

if {[variant_isset netcdf4]} {
    if {[active_variants hdf5-18 hdf5-18 ""]} {
        set hdf5cc [exec grep "C Compiler" ${prefix}/lib/libhdf5.settings | awk {BEGIN{FS="/"}{print $NF}}]
 ....
    }
}

I get the following error with hdf5-18 deactivated and issue

$ port info netcdf +netcdf4
Error: Unable to open port: Registry error: hdf5-18 not registered as installed & active.

Is this the expected error?

comment:4 Changed 11 years ago by tenomoto (Takeshi Enomoto)

Resolution: fixed
Status: reopenedclosed

I used catch as in the example. Committed in r108320.

Note: See TracTickets for help on using tickets.