Ignore:
Timestamp:
May 27, 2011, 5:52:35 PM (9 years ago)
Author:
derek@…
Message:

Added port stats action.

This action takes one optional argument - submit

If no argument is given then port stats displays (in human readable form) the
information that will be submitted to MacPorts. As of now only information
relevant to building ports is displayed.

The submit subcommand will initiate the actual upload. Right now it exists
only as a placeholder and outputs the text "Will submit collected data"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gsoc11-statistics/base/src/port/port.tcl

    r78621 r78936  
    24782478}
    24792479
     2480proc action_stats { action portlist opts } {   
     2481
     2482    # If no subcommands are given (portlist is empty) print out OS information
     2483    if {$portlist == ""} {
     2484        # Print information
     2485        puts "Build Information"
     2486        puts "- MacPorts Version [macports::version]"
     2487        puts "- Mac OS X Version ${macports::macosx_version}"
     2488        puts "- Platform ${macports::os_arch} ${macports::os_platform}"
     2489        puts "- Build Arch is ${macports::build_arch}"
     2490        puts "- XCode Version ${macports::xcodeversion}"
     2491        return 0
     2492    }
     2493
     2494    # Make sure there aren't too many subcommands
     2495    if {[llength $portlist] > 1} {
     2496        puts "Please select only one subcommand. See port help stats"
     2497        return 0
     2498    }
     2499
     2500    # Get the command
     2501    set cmd [lindex $portlist 0]
     2502       
     2503    switch $cmd {
     2504        "submit" {
     2505            # Only submit if the user is participating
     2506            if {[string equal ${macports::stats_participate} "yes"]} {
     2507                # TODO: proc call which will submit data
     2508                puts "Will submit collected data"
     2509            }
     2510        }
     2511        default {
     2512            puts "Unknown subcommand. See port help stats"
     2513        }
     2514    }
     2515   
     2516    return 0
     2517}
    24802518
    24812519proc action_dependents { action portlist opts } {
     
    37833821    version     [list action_version        [ACTION_ARGS_NONE]] \
    37843822    platform    [list action_platform       [ACTION_ARGS_NONE]] \
     3823    stats       [list action_stats          [ACTION_ARGS_STRINGS]] \
    37853824    \
    37863825    uninstall   [list action_uninstall      [ACTION_ARGS_PORTS]] \
Note: See TracChangeset for help on using the changeset viewer.