Ticket #11892: dry.3.patch

File dry.3.patch, 4.0 KB (added by gwhitney@…, 17 years ago)

slight further improvement: don't write variants into statefile in a dry run

  • src/port/port.1

     
    235235In batch and interactive mode, exit on the first error encountered. Otherwise, errors during batch execution are simply reported.
    236236.It Fl p
    237237Despite any errors encountered, proceed to process multiple ports and commands.
     238.It Fl y
     239Perform a dry run. All of the steps to build the ports and their dependencies are computed, but not actually performed. With the verbose flag, every step is reported; otherwise there is just one message per port, which allows you to easily determine the recursive deps of a port (and the order in which they will be built).
    238240.It Fl t
    239241enable trace mode debug facilities on platforms that support it (MacOS X). This feature is two-folded. It consists in automatically detecting and reporting undeclared dependencies based on what files the port reads or what programs the port executes. In verbose mode, it will also report unused dependencies for each stage of the port installation. It also consists in forbidding and reporting file creation and file writes outside allowed directories (temporary directories and ${workpath}).
    240242.El
  • src/port/port.tcl

     
    136136        global cmdname
    137137        global action_array
    138138       
    139         set syntax { [-bcdfiknopqRstuvx] [-D portdir] [-F cmdfile] action [privopts] [actionflags]
     139        set syntax { [-bcdfiknopqRstuvxy] [-D portdir] [-F cmdfile] action [privopts] [actionflags]
    140140[[portname|pseudo-portname|port-url] [@version] [+-variant]... [option=value]...]...
    141141}
    142142
     
    22492249                                        c { set global_options(ports_autoclean) yes             }
    22502250                                        k { set global_options(ports_autoclean) no              }
    22512251                                        t { set global_options(ports_trace) yes                 }
     2252                                        y { set global_options(ports_dryrun) yes                }
    22522253                                        F { # Name a command file to process
    22532254                                                advance
    22542255                                                if {[moreargs]} {
  • src/port1.0/portutil.tcl

     
    977977}
    978978
    979979########### Internal Dependency Manipulation Procedures ###########
     980global ports_dry_last_skipped
     981set ports_dry_last_skipped ""
    980982
    981983proc target_run {ditem} {
    982     global target_state_fd portpath portname portversion portrevision portvariants ports_force variations workpath ports_trace PortInfo
     984    global target_state_fd portpath portname portversion portrevision portvariants ports_force variations workpath ports_trace PortInfo ports_dryrun ports_dry_last_skipped
    983985    set result 0
    984986    set skipped 0
    985987    set procedure [ditem_key $ditem procedure]
     
    10481050                        }
    10491051                       
    10501052                }
     1053
     1054                # Of course, if this is a dry run, don't do the task:
     1055                if {[info exists ports_dryrun] && $ports_dryrun == "yes"} {
     1056                    # only one message per portname
     1057                    if {$portname != $ports_dry_last_skipped} {
     1058                            ui_msg "For $portname: skipping $name (dry run)"
     1059                            set ports_dry_last_skipped $portname
     1060                    } else {
     1061                        ui_info "    .. and skipping $name"
     1062                    }
     1063                    set skipped 1
     1064                }
    10511065                       
    10521066                # otherwise execute the task.
    10531067                if {$skipped == 0} {
     
    13681382}
    13691383
    13701384proc eval_variants {variations target} {
    1371     global all_variants ports_force PortInfo
     1385    global all_variants ports_force ports_dryrun PortInfo
    13721386    set dlist $all_variants
    13731387    set result 0
    13741388    upvar $variations upvariations
     
    14171431                if {[check_statefile_variants upvariations $state_fd]} {
    14181432                        ui_error "Requested variants do not match original selection.\nPlease perform 'port clean $portname' or specify the force option."
    14191433                        set result 1
    1420                 } else {
     1434                } elseif {!([info exists ports_dryrun]
     1435                            && $ports_dryrun == "yes")} {
    14211436                        # Write variations out to the statefile
    14221437                        foreach key [array names upvariations *] {
    14231438                        write_statefile variant $upvariations($key)$key $state_fd