Ticket #11892: dry.5.patch

File dry.5.patch, 7.5 KB (added by gwhitneycom1@…, 17 years ago)

Oops, port -y upgrade could still take a few actual actions. This fixes it, now applies to r25313

  • 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
     
    22792279                                        c { set global_options(ports_autoclean) yes             }
    22802280                                        k { set global_options(ports_autoclean) no              }
    22812281                                        t { set global_options(ports_trace) yes                 }
     2282                                        y { set global_options(ports_dryrun) yes                }
    22822283                                        F { # Name a command file to process
    22832284                                                advance
    22842285                                                if {[moreargs]} {
  • src/darwinports1.0/darwinports.tcl

     
    16151615        if {![string match "" $depscachename]} {
    16161616                upvar $depscachename depscache
    16171617        }
    1618 
     1618       
    16191619        # set to no-zero is epoch overrides version
    16201620        set epoch_override 0
     1621        # Is this a dry run?
     1622        set is_dryrun "no"
     1623        if {[info exists options(ports_dryrun)] && $options(ports_dryrun) eq "yes"} {
     1624                set is_dryrun "yes"
     1625        }
    16211626
    16221627        # check if the port is in tree
    16231628        if {[catch {dportsearch $portname false exact} result]} {
     
    17091714                        set isactive [lindex $i 4]
    17101715                        if {$isactive == 1 && [rpm-vercomp $version_installed $version] < 0 } {
    17111716                                # deactivate version
    1712                         if {[catch {portimage::deactivate $portname $version $optionslist} result]} {
     1717                            if {$is_dryrun eq "yes"} {
     1718                                ui_msg "Skipping deactivate $portname $version (dry run)"
     1719                            } elseif {[catch {portimage::deactivate $portname $version $optionslist} result]} {
    17131720                                        global errorInfo
    17141721                                        ui_debug "$errorInfo"
    1715                         ui_error "Deactivating $portname $version_installed failed: $result"
    1716                         return 1
    1717                         }
     1722                                        ui_error "Deactivating $portname $version_installed failed: $result"
     1723                                        return 1
     1724                            }
    17181725                        }
    17191726                }
    1720         if { [lindex $num 4] == 0 && 0 == [string compare "image" ${darwinports::registry.installtype}] } {
     1727                if { [lindex $num 4] == 0 && 0 == [string compare "image" ${darwinports::registry.installtype}] } {
    17211728                        # activate the latest installed version
    1722                         if {[catch {portimage::activate $portname $version_installed$variant $optionslist} result]} {
     1729                        if {$is_dryrun eq "yes"} {
     1730                                ui_msg "Skipping activate $portname $version_installed (dry run)"
     1731                        } elseif {[catch {portimage::activate $portname $version_installed$variant $optionslist} result]} {
    17231732                                global errorInfo
    17241733                                ui_debug "$errorInfo"
    1725                         ui_error "Activating $portname $version_installed failed: $result"
     1734                                ui_error "Activating $portname $version_installed failed: $result"
    17261735                                return 1
    17271736                        }
    17281737                }
     
    18531862    if {[info exists options(port_uninstall_old)] || $epoch_override == 1 || [info exists options(ports_force)] || 0 != [string compare "image" ${darwinports::registry.installtype}] } {
    18541863                # uninstall old
    18551864                ui_debug "Uninstalling $portname $version_installed$oldvariant"
    1856                 if {[catch {portuninstall::uninstall $portname $version_installed$oldvariant $optionslist} result]} {
     1865                if {$is_dryrun eq "yes"} {
     1866                        ui_msg "Skipping uninstall $portname $version_installed (dry run)"
     1867                } elseif {[catch {portuninstall::uninstall $portname $version_installed$oldvariant $optionslist} result]} {
    18571868                        global errorInfo
    18581869                        ui_debug "$errorInfo"
    1859                 ui_error "Uninstall $portname $version_installed$oldvariant failed: $result"
    1860                 return 1
    1861         }
     1870                        ui_error "Uninstall $portname $version_installed$oldvariant failed: $result"
     1871                        return 1
     1872                }
    18621873        } else {
    18631874                # XXX deactivate version_installed
    1864                 if {[catch {portimage::deactivate $portname $version_installed$oldvariant $optionslist} result]} {
     1875                if {$is_dryrun eq "yes"} {
     1876                        ui_msg "Skipping deactivate $portname $version_installed (dry run)"
     1877                } elseif {[catch {portimage::deactivate $portname $version_installed$oldvariant $optionslist} result]} {
    18651878                        global errorInfo
    18661879                        ui_debug "$errorInfo"
    18671880                        ui_error "Deactivating $portname $version_installed failed: $result"
  • src/port1.0/portutil.tcl

     
    10061006}
    10071007
    10081008########### Internal Dependency Manipulation Procedures ###########
     1009global ports_dry_last_skipped
     1010set ports_dry_last_skipped ""
    10091011
    10101012proc target_run {ditem} {
    1011     global target_state_fd portpath portname portversion portrevision portvariants ports_force variations workpath ports_trace PortInfo
     1013    global target_state_fd portpath portname portversion portrevision portvariants ports_force variations workpath ports_trace PortInfo ports_dryrun ports_dry_last_skipped
    10121014    set result 0
    10131015    set skipped 0
    10141016    set procedure [ditem_key $ditem procedure]
     
    10771079                        }
    10781080                       
    10791081                }
     1082
     1083                # Of course, if this is a dry run, don't do the task:
     1084                if {[info exists ports_dryrun] && $ports_dryrun == "yes"} {
     1085                    # only one message per portname
     1086                    if {$portname != $ports_dry_last_skipped} {
     1087                            ui_msg "For $portname: skipping $name (dry run)"
     1088                            set ports_dry_last_skipped $portname
     1089                    } else {
     1090                        ui_info "    .. and skipping $name"
     1091                    }
     1092                    set skipped 1
     1093                }
    10801094                       
    10811095                # otherwise execute the task.
    10821096                if {$skipped == 0} {
     
    14321446}
    14331447
    14341448proc check_variants {variations target} {
    1435     global ports_force PortInfo
     1449    global ports_force ports_dryrun PortInfo
    14361450    upvar $variations upvariations
    14371451    set result 0
    14381452    set portname $PortInfo(name)
     
    14521466                if {[check_statefile_variants upvariations $state_fd]} {
    14531467                        ui_error "Requested variants do not match original selection.\nPlease perform 'port clean $portname' or specify the force option."
    14541468                        set result 1
    1455                 } else {
     1469                } elseif {!([info exists ports_dryrun]
     1470                            && $ports_dryrun == "yes")} {
    14561471                        # Write variations out to the statefile
    14571472                        foreach key [array names upvariations *] {
    14581473                        write_statefile variant $upvariations($key)$key $state_fd