port.tcl new actions logpath openlogpath

Bradley Giesbrecht pixilla at macports.org
Fri Jul 22 14:49:50 PDT 2011


To help people attach logs to trac tickets would port benefit from having a command like one or both of these?

logpath: returns path to log file for given port(s)
openlogpath: opens logpath in Finder for given port(s)

Essence of attached patch for base/src/port/port.tcl:
# logpath basically copied from logfile
                logpath {
                    set logpath [file join [macports::getportlogpath $portdir $portname]]
                    if {[file isdirectory $logpath]} {
                        puts $logpath
                    } else {
                        ui_error "Log file path not found for port in $portdir"
                    }
                }

# openlogpath basically copied from gohome
                openlogpath {
                    set logpath [file join [macports::getportlogpath $portdir $portname]]
                    if {[file isdirectory $logpath]} {
                        if {[catch {system "${macports::autoconf::open_path} '$logpath'"} result]} {
                            global errorInfo
                            ui_debug "$errorInfo"
                            break_softcontinue "unable to open path using ${macports::autoconf::open_path}: $result" 1 status
                        }
                    } else {
                        ui_error "Log file path not found for port in $portdir"
                    }
                }


These port actions could make it easier to explaining to MP users how to attach logs to trac tickets. This action idea came to mind from reading a MP user say they couldn't navigate to the logfile with Safari.

1. Click the "Attach file" button.
2. Click the "Choose File" button.
3. In Terminal do:
		$ open $(port logpath portname)
	or
		$ port openlogpath portname
4. From the newly opened Finder window, drag the main.log file into the Safari "Choose File" sheet(?).


Regards,
Bradley Giesbrecht (pixilla)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-base-src-port-port.tcl.diff
Type: application/octet-stream
Size: 1875 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20110722/57ac837d/attachment.obj>


More information about the macports-dev mailing list