Skip to content
Permalink
Browse files

obsolete-1.0.tcl: Allow replaced_by to be set later

Previously, replaced_by needed to be set before the portgroup was
included. Now it can be set, changed, or unset, before or after.

Closes: https://trac.macports.org/ticket/56023
  • Loading branch information
ryandesign committed Mar 12, 2018
1 parent ccd3358 commit 0d8e18a9ca4636297320027f3c546c37aca4b649
Showing with 25 additions and 5 deletions.
  1. +25 −5 _resources/port1.0/group/obsolete-1.0.tcl
@@ -32,8 +32,8 @@
#
# Usage:
#
# replaced_by name-of-port-that-deprecated-this-port
# PortGroup obsolete 1.0
# replaced_by name-of-port-that-deprecated-this-port

# set a number of reasonable defaults for a port that is only there to
# inform users that they should uninstall it and install something else
@@ -43,12 +43,32 @@ platforms darwin
maintainers nomaintainer
supported_archs noarch

proc obsolete.set_descriptions {replaced_by} {
if {${replaced_by} eq ""} {
description Obsolete port
long_description This port is obsolete.
} else {
description Obsolete port, replaced by ${replaced_by}
long_description This port has been replaced by ${replaced_by}.
}
}

# Handle replaced_by set after portgroup inclusion.
option_proc replaced_by obsolete.replaced_by_proc
proc obsolete.replaced_by_proc {option action args} {
switch ${action} {
set -
delete {
obsolete.set_descriptions ${args}
}
}
}

# Handle replaced_by set before portgroup inclusion.
if {[info exists replaced_by]} {
description Obsolete port, replaced by ${replaced_by}
default long_description "This port has been replaced by ${replaced_by}."
obsolete.set_descriptions ${replaced_by}
} else {
description Obsolete port
default long_description "This port is obsolete."
obsolete.set_descriptions ""
}

homepage https://www.macports.org/

0 comments on commit 0d8e18a

Please sign in to comment.
You can’t perform that action at this time.