Opened 16 years ago

Closed 16 years ago

Last modified 14 years ago

#16146 closed defect (fixed)

port gohome spews lots of errors if port doesn't have homepage variable

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: raimue (Rainer Müller)
Priority: Normal Milestone: MacPorts 1.7.0
Component: base Version: 1.7.0
Keywords: Cc:
Port:

Description

port gohome returns lots of lines of errors if the port doesn't define the homepage variable. Yes, that variable is required according to port lint, but it would still be nice if this error spew could be reduced down to just one line:

$ port gohome arts
can't read "portinfo(homepage)": no such element in array
    while executing
"set homepage $portinfo(homepage)"
    ("gohome" arm line 5)
    invoked from within
"switch -- $action {
                cat {
                    # Copy the portfile to standard output
                    set f [open $portfile RDONLY]..."
    invoked from within
"if {[file readable $portfile]} {
            switch -- $action {
                cat {
                    # Copy the portfile to standard output
    ..."
    ("uplevel" body line 25)
    invoked from within
"uplevel 1 $block"
    (procedure "foreachport" line 16)
    invoked from within
"foreachport $portlist {
        # If we have a url, use that, since it's most specific, otherwise try to map the portname to a url
        if {$portur..."
    (procedure "action_portcmds" line 12)
    invoked from within
"$action_proc $action $portlist [array get global_options]"
    (procedure "process_cmd" line 86)
    invoked from within
"process_cmd $remaining_args"
    invoked from within
"if { [llength $remaining_args] > 0 } {

    # If there are remaining arguments, process those as a command

    # Exit immediately, by default, unless..."
    (file "/mp/bin/port" line 3207)

I'm using MacPorts trunk @38780.

Attachments (1)

patch-port-gohome.diff (1.4 KB) - added by raimue (Rainer Müller) 16 years ago.

Download all attachments as: .zip

Change History (6)

Changed 16 years ago by raimue (Rainer Müller)

Attachment: patch-port-gohome.diff added

comment:1 Changed 16 years ago by raimue (Rainer Müller)

Owner: changed from macports-tickets@… to raimue@…
Status: newassigned

I have a question about its implementation, currently it is opening the Portfile to find out the homepage. Wouldn't it be sufficient to rely on the value in the PortIndex and only open the Portfile if the value is not available there? This would make the command run faster.

Attached is a patch for port/port.tcl to implement this behavior. It also fixes the errors if no homepage is available as reported originally.

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

The patch looks good! Please commit.

comment:3 Changed 16 years ago by raimue (Rainer Müller)

Resolution: fixed
Status: assignedclosed

Committed in r39036 with a slight change to the error message.

comment:4 Changed 15 years ago by tobypeterson

Milestone: MacPorts base bugsMacPorts Future

Milestone MacPorts base bugs deleted

comment:5 Changed 14 years ago by jmroot (Joshua Root)

Milestone: MacPorts FutureMacPorts 1.7.0
Note: See TracTickets for help on using tickets.