<pre style='margin:0'>
Rainer Müller (raimue) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/50e49c5ee6eebf1a107076861d3de433a9358999">https://github.com/macports/macports-ports/commit/50e49c5ee6eebf1a107076861d3de433a9358999</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new 50e49c5 Remove unused active_variants-1.0.tcl
</span>50e49c5 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 50e49c5ee6eebf1a107076861d3de433a9358999
</span>Author: Eitan Adler <lists@eitanadler.com>
AuthorDate: Sun Sep 17 20:07:23 2017 -0700
<span style='display:block; white-space:pre;color:#404040;'> Remove unused active_variants-1.0.tcl
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Grepping shows this is unused.
</span>---
_resources/port1.0/group/active_variants-1.0.tcl | 161 -----------------------
1 file changed, 161 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/_resources/port1.0/group/active_variants-1.0.tcl b/_resources/port1.0/group/active_variants-1.0.tcl
</span>deleted file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 4f884bf..0000000
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/_resources/port1.0/group/active_variants-1.0.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1,161 +0,0 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# Copyright (c) 2012 The MacPorts Project
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# All rights reserved.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# Redistribution and use in source and binary forms, with or without
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# modification, are permitted provided that the following conditions are
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# met:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# 1. Redistributions of source code must retain the above copyright
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# notice, this list of conditions and the following disclaimer.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# 2. Redistributions in binary form must reproduce the above copyright
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# notice, this list of conditions and the following disclaimer in the
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# documentation and/or other materials provided with the distribution.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# 3. Neither the name of The MacPorts Project nor the names of its
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# contributors may be used to endorse or promote products derived from
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# this software without specific prior written permission.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# Usage:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# PortGroup active_variants 1.0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# if {![catch {set result [active_variants $name $required $forbidden]}]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# if {$result} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# # code to be executed if $name is active with at least all variants in
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# # $required and none from $forbidden
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# } else {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# # code to be executed if $name is active, but either not with all
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# # variants in $required or any variant in $forbidden
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# } else {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# # code to be executed if $name isn't active
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# where
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# $name
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# is the name of the port you're trying to check (required)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# $required
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# is a list of variants that must be enabled for the test to succeed
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# (required; remember this can also be a space-separated string or just
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# a string for a single value. It's interpreted as list, though.)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# $forbidden
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# is a list of variants that may not be enabled for the test to succeed
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# (default is empty list, see description of $required for values that can be
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# interpreted as list by Tcl)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# In situations where you know that a version of the port is active (e.g., when
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# checking in pre-configure of a port and the checked port is a dependency),
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# this can be simplified to:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# if {[active_variants $name $required $forbidden]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# # code to be run if $name is active with all from $required and none from
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# # $forbidden
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# } else {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# # code to be run if $name is active, but either not with all variants in
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# # $required or any variant in $forbidden
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# If all you want to do is bail out when the condition isn't fulfilled, there's
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# a convenience wrapper available. If the condition isn't met it will print an
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# error message and exit. This will also error out, if the port $name isn't
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# active, so you should probably not be using this before configure phase.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# require_active_variants $name $required $forbidden
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-proc active_variants {name required {forbidden {}}} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # registry_active comes from a list of aliased procedures in
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # macports1.0/macports.tcl, line 1238 - 1303.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # It actually calls registry::active, which is defined in
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # registry2.0/registry.tcl, line 173 and does some error handling plus
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # passing the call to the appropriate registry backend (flat file or
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # sqlite).
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # In the SQLite case the call goes to registry2.0/receipt_sqlite.tcl,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # line 45, proc active, which in turn calls registry::entry installed
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # $name, which comes from registry2.0/entry.c, line 387. I won't dig
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # deeper than that, since that's as far as we need to go to handle this
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # correctly.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # When looking at registry2.0/receipt_sqlite.tcl, line 53 and following,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # we can see the structure returned by this call: it's a list of
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # registry entries (in the case of active, there can only be one, since
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # there can never be multiple versions of the same port active at the
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # same time). This explains the [lindex $active_list 0] in the following
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # block.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # this will throw if $name isn't active
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set installed [lindex [registry_active $name] 0]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # In $installed there are in order: name, version, revision, variants,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # a boolean indicating whether the port is installed and the epoch. So,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # we're interested in the field at offset 3.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set variants [lindex $installed 3]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_debug "$name is installed with the following variants: $variants"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_debug " required: $required, forbidden: $forbidden"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # split by "+" into the separate variant names
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set variant_list [split $variants +]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # check that each required variant is there
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach required_variant $required {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![_variant_in_variant_list $required_variant $variant_list]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_debug " rejected, because required variant $required_variant is missing"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # check that no forbidden variant is there
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach forbidden_variant $forbidden {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[_variant_in_variant_list $forbidden_variant $variant_list]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_debug " rejected, because forbidden variant $forbidden_variant is present"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_debug " accepted"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-proc require_active_variants {name required {forbidden {}}} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[catch {set result [active_variants $name $required $forbidden]}] != 0} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- error "$name is required, but not active."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {!$result} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set str_required ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[llength $required] > 0} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set str_required "with +[join $required +]"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set str_forbidden ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[llength $forbidden] > 0} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set str_forbidden "without +[join $forbidden +]"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set str_combine ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$str_required != "" && $str_forbidden != ""} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set str_combine " and "
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- error "$name must be installed ${str_required}${str_combine}${str_forbidden}."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-proc _variant_in_variant_list {needle haystack} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach variant $haystack {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$variant == $needle} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span></pre><pre style='margin:0'>
</pre>