[MacPorts] #52530: conditional PortGroup include

MacPorts noreply at macports.org
Thu Oct 6 23:03:22 CEST 2016


#52530: conditional PortGroup include
-------------------------+--------------------------------
 Reporter:  rjvbertin@…  |      Owner:  macports-tickets@…
     Type:  request      |     Status:  new
 Priority:  Normal       |  Milestone:
Component:  base         |    Version:
 Keywords:  haspatch     |       Port:
-------------------------+--------------------------------
 I am using portgroups for a number of features that are unlikely ever to
 be included officially, in ports and portgroups that themselves should be
 admissable.

 Rather than maintaining a local and a submitted version, it'd be nice to
 have a conditional PortGroup command which doesn't print a warning when
 the requested file doesn't exist. Something like

 {{{
 proc PortGroup {group version {test ""}} {
     global porturl PortInfo _portgroup_search_dirs

     lappend PortInfo(portgroups) [list $group $version]

     if {[info exists _portgroup_search_dirs]} {
         foreach dir $_portgroup_search_dirs {
             set groupFile ${dir}/${group}-${version}.tcl
             if {[file exists $groupFile]} {
                 uplevel "source $groupFile"
                 ui_debug "Sourcing PortGroup $group $version from
 $groupFile"
                 return
             }
         }
     }

     set groupFile [getportresourcepath $porturl
 "port1.0/group/${group}-${version}.tcl"]

     if {[file exists $groupFile]} {
         uplevel "source $groupFile"
         ui_debug "Sourcing PortGroup $group $version from $groupFile"
     } else {
         if {$test eq ""} {
             ui_warn "PortGroup ${group} ${version} could not be located.
 ${group}-${version}.tcl does not exist."
         } else {
             ui_debug "PortGroup ${group} ${version} could not be located.
 ${group}-${version}.tcl does not exist."
         }
     }
 }
 }}}

 BTW, I notice that a missing PortGroup is never an error according to this
 procedure (copied from portutil.tcl). Shouldn't ports be able to raise an
 error if one doesn't exist (think the Qt5, cmake, qmake, KDE4, KF5
 portgroups)?

-- 
Ticket URL: <https://trac.macports.org/ticket/52530>
MacPorts <https://www.macports.org/>
Ports system for the Mac operating system



More information about the macports-tickets mailing list