Changeset 54376


Ignore:
Timestamp:
Jul 25, 2009, 7:45:02 PM (10 years ago)
Author:
jmr@…
Message:

Add upgrade options --enforce-variants and --force. The former upgrades when the port is not outdated but the requested variants don't match those installed. The latter is now used instead of the global -f option to force rebuild. Closes #20156.

Location:
trunk/base
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/doc/port.1

    r53705 r54376  
    365365To force an upgrade (rebuild) use:
    366366.Pp
    367 .Dl "port -f upgrade vim"
     367.Dl "port upgrade --force vim"
    368368.Pp
    369369To upgrade
     
    380380finally the global variants specified in variants.conf, if any.  Note that
    381381upgrade will not normally rebuild a port only to change the selected
    382 variants; you can either specify -f, or deactivate the port and reinstall it
     382variants; you can either specify --enforce-variants, or deactivate the port and reinstall it
    383383with different variants.
    384384.Ss clean
  • trunk/base/src/macports1.0/macports.tcl

    r54352 r54376  
    24832483            || ([rpm-vercomp $version_installed $version_in_tree] == 0
    24842484                && [rpm-vercomp $revision_installed $revision_in_tree] >= 0 ))
    2485         && ![info exists options(ports_force)] } {
    2486         ui_debug "No need to upgrade! $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}"
    2487         if {[info exists portinfo(canonical_active_variants)]
    2488             && $portinfo(canonical_active_variants) != $oldvariant} {
    2489             ui_warn "Skipping upgrade since $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}, even though installed variants \"$oldvariant\" do not match \"$portinfo(canonical_active_variants)\". Specify -f to force upgrade."
    2490         }
    2491         if { $epoch_installed >= $epoch_in_tree } {
     2485        && ![info exists options(ports_upgrade_force)] } {
     2486        if { $epoch_installed < $epoch_in_tree } {
     2487            set epoch_override 1
     2488            ui_debug "epoch override ... upgrading!"
     2489        } elseif {[info exists options(ports_upgrade_enforce-variants)] && $options(ports_upgrade_enforce-variants) eq "yes"
     2490                  && [info exists portinfo(canonical_active_variants)] && $portinfo(canonical_active_variants) != $oldvariant} {
     2491            ui_debug "variant override ... upgrading!"
     2492        } else {
     2493            if {[info exists portinfo(canonical_active_variants)] && $portinfo(canonical_active_variants) != $oldvariant} {
     2494                ui_warn "Skipping upgrade since $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}, even though installed variants \"$oldvariant\" do not match \"$portinfo(canonical_active_variants)\". Use 'upgrade --enforce-variants' to switch to the requested variants."
     2495            } else {
     2496                ui_debug "No need to upgrade! $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}"
     2497            }
    24922498            # Check if we have to do dependents
    24932499            if {[info exists options(ports_do_dependents)]} {
     
    25132519            mportclose $workername
    25142520            return 0
    2515         } else {
    2516             set epoch_override 1
    2517             ui_debug "epoch override ... upgrading!"
    25182521        }
    25192522    }
     
    25282531
    25292532    # avoid building again unnecessarily
    2530     if {[info exists options(ports_force)] || $epoch_override == 1
     2533    if {[info exists options(ports_upgrade_force)] || $epoch_override == 1
    25312534        || ![registry::entry_exists $portname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]} {
    25322535        if {[catch {set result [mportexec $workername $upgrade_action]} result] || $result != 0} {
     
    25602563    } else {
    25612564        # are we installing an existing version due to force or epoch override?
    2562         if {[registry::entry_exists $portname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]} {
     2565        if {[registry::entry_exists $portname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]
     2566            && ([info exists options(ports_upgrade_force)] || $epoch_override == 1)} {
    25632567             ui_debug "Uninstalling $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants)"
    25642568            # we have to force the uninstall in case of dependents
  • trunk/base/src/port/port-help.tcl

    r53660 r54376  
    278278set porthelp(upgrade) {
    279279Upgrades the given ports to the latest version. Respects global options
    280 -n, -R, -u, and -f (see the port man page).  Note that in selecting variants
     280-n, -R, and -u (see the port man page).  Note that in selecting variants
    281281to use in the upgraded build of the port, the order of precedence is variants
    282282specified on the command line, then variants active in the latest installed
    283283version of the port, then the variants.conf file.
     284
     285--force             Ignore circumstances that would normally cause ports to be
     286                    skipped (e.g. not outdated).
     287--enforce-variants  If the installed variants do not match those requested,
     288                    upgrade even if the port is not outdated.
    284289}
    285290
  • trunk/base/src/port/port.tcl

    r53712 r54376  
    31163116    lint        {nitpick}
    31173117    select      {list set show}
     3118    upgrade     {force enforce-variants}
    31183119}
    31193120
Note: See TracChangeset for help on using the changeset viewer.