Opened 8 years ago

Last modified 2 years ago

#52530 new enhancement

conditional PortGroup include

Reported by: RJVB (René Bertin) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: base Version:
Keywords: portgroup Cc:
Port:

Description

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)?

Change History (3)

comment:1 Changed 8 years ago by mkae (Marko Käning)

Cc: mkae added

comment:2 Changed 8 years ago by raimue (Rainer Müller)

Keywords: haspatch removed
Type: requestenhancement

comment:3 Changed 2 years ago by mascguy (Christopher Nielsen)

Keywords: portgroup added

Add keyword portgroup, to pg-related tickets

Note: See TracTickets for help on using tickets.