build progress bar

René J.V. Bertin rjvbertin at gmail.com
Sat Mar 11 19:16:27 UTC 2017


On Thursday March 09 2017 09:45:44 René J.V. Bertin wrote:

Hi,

I'm trying to implement the approach below, adding some code to proc ui_message in macports.tcl

{{{
            # progress reporting
            if {[may_have_progress_info]} {
                if {!${macports::portverbose}} {
                    ui_progress_display_from_message $string
                }
            } elseif {${_reporting_progress_}} {
                #puts "end progress reporting"
                if {[info exists $macports::ui_options(progress_generic)]} {
                    $macports::ui_options(progress_generic) finish
                }
                set _reporting_progress_ no
            }
}}}

but for the hell of me I cannot toggle the "may report progress" state from proc command_exec in portutil.tcl . I've tried global variables and now a proc (with accompanying setter) `may_have_progress_info` defined in macports_util.tcl:

{{{
# progress reporting
proc set_may_have_progress_info {val} {
    namespace upvar ::macports_util command_may_report_progress var
    set var [string is true -strict $val]
    puts "newvar=${var}"
    puts "newval=${macports_util::command_may_report_progress}"
    return ${var}
}
if {![info exists macports_util::command_may_report_progress]} {
    set macports_util::command_may_report_progress 0
}

proc may_have_progress_info {} {
    puts "val=${macports_util::command_may_report_progress}"
    return ${macports_util::command_may_report_progress}
}
}}}

It's as if the code in portutil.tcl and macports.tcl execute in completely different memory spaces; `macports_util::command_may_report_progress` will appear to be true from within portutil.tcl but will remain false from within macports.tcl .

IOW, I'm getting nowhere fast and the Tcl documentation I've consulted so far hasn't been of any help to understand what I'm doing wrong :-/

What am I missing?

Thanks,
R.


More information about the macports-dev mailing list