summaryrefslogtreecommitdiff
path: root/eclass/kde4-functions.eclass
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/kde4-functions.eclass')
-rw-r--r--eclass/kde4-functions.eclass144
1 files changed, 130 insertions, 14 deletions
diff --git a/eclass/kde4-functions.eclass b/eclass/kde4-functions.eclass
index 419272a6f58..1581edbeeef 100644
--- a/eclass/kde4-functions.eclass
+++ b/eclass/kde4-functions.eclass
@@ -2,6 +2,8 @@
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.18 2009/05/09 13:23:15 scarabeus Exp $
+inherit versionator
+
# Prefix compat:
: ${EROOT:=${ROOT}}
# Append missing trailing slash character
@@ -372,32 +374,146 @@ load_library_dependencies() {
block_other_slots() {
debug-print-function ${FUNCNAME} "$@"
- local slot
- for slot in ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do
- # Block non kdeprefix ${PN} on other slots
- if [[ ${SLOT} != ${slot} ]]; then
- echo "!kdeprefix? ( !kde-base/${PN}:${slot}[-kdeprefix] )"
- fi
- done
+ _do_blocker ${PN} 0:${SLOT}
}
# @FUNCTION: add_blocker
# @DESCRIPTION:
# Create correct RDEPEND value for blocking correct package.
-# Usefull for file-collision blocks.
-# Parameters are package and version to block.
+# Useful for file-collision blocks.
+# Parameters are package and version(s) to block.
# add_blocker kdelibs 4.2.4
+# If no version is specified, then all versions will be blocked
+# If any arguments (from 2 on) contain a ":", then different versions
+# are blocked in different slots. (Unlisted slots get the version without
+# a ":", if none, then all versions are blocked). The parameter is then of
+# the form VERSION:SLOT. Any VERSION of 0 means that no blocker will be
+# added for that slot (or, if no slot, then for any unlisted slot).
+# A parameter of the form :SLOT means to block all versions from that slot.
+# If VERSION begins with "<", then "!<foo" will be used instead of "!<=foo".
+# As a special case, if a parameter with slot "3.5" is passed, then that slot
+# may also be blocked.
+#
+# Versions that match "4.x.50" are equivalent to all slots up to (and including)
+# "4.x", but nothing following slot "4.x"
+#
+# As an example, if SLOT=live, then
+# add_blocker kdelibs 0 :4.3 '<4.3.96:4.4' 9999:live
+# will add the following to RDEPEND:
+# !kdeprefix? ( !kde-base/kdelibs:4.3[-kdeprefix] )
+# !kdeprefix? ( !<kde-base/kdelibs-4.3.96:4.4[-kdeprefix] )
+# !kdeprefix? ( !<=kde-base/kdelibs-9999:live[-kdeprefix] )
+# kdeprefix? ( !<=kde-base/kdelibs-9999:live[kdeprefix] )
add_blocker() {
debug-print-function ${FUNCNAME} "$@"
- [[ ${1} = "" || ${2} = "" ]] && die "Missing parameter"
- local slot
+ RDEPEND+=" $(_do_blocker "$@")"
+}
+
+# _greater_max_in_slot ver slot
+_greater_max_in_slot() {
+ local ver=$1
+ local slot=$2
+ [[ $slot == live ]] && return 1
+ local test=${slot}.50
+ version_compare $1 ${test}
+ [[ $? -ne 1 ]]
+}
+
+# _less_min_in_slot ver slot
+# slot must be 4.x or live
+_less_min_in_slot() {
+ local ver=$1
+ local slot=$2
+ local test=9999
+ [[ $slot == live ]] || test=${slot%.*}.$((${slot#*.} - 1)).50
+ version_compare $1 ${test}
+ [[ $? -eq 1 ]]
+}
+
+# Internal function used for add_blocker and block_other_slots
+# This takes the same parameters as add_blocker, but echos to
+# stdout instead of updating a variable.
+_do_blocker() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ [[ -z ${1} ]] && die "Missing parameter"
+ local pkg=kde-base/$1
+ shift
+ local param slot def="unset" var atom
+ # The following variables are set to "unset" in this block:
+ # - block_3_5
+ # - block_4_1
+ # - block_4_2
+ # - block_4_3
+ # - block_4_4
+ # - block_live
+ # Those variables will hold the parameters that end in :3.5
+ # (resp. :4.1, :4.2, :4.3, :4.4, :live)
+ for slot in 3.5 ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do
+ slot=${slot//[.-]/_}
+ local block_${slot}="unset"
+ done
+
+ # This construct goes through each parameter passed, and sets
+ # either def or block_* to the version passed
+ for param; do
+ # If the parameter does not have a ":" in it...
+ if [[ ${param/:} == ${param} ]]; then
+ def=${param}
+ else # the parameter *does* have a ":" in it
+ # so everythin after the : is the slot...
+ slot=${param#*:}
+ # ...and everything before the : is the version
+ local block_${slot//[.-]/_}=${param%:*}
+ fi
+ done
+
for slot in ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do
+ # ${var} contains the name of the variable we care about for this slot
+ # ${!var} is it's value
+ var=block_${slot//[.-]/_}
+ # if we didn't pass *:${slot}, then use the unsloted value
+ [[ ${!var} == "unset" ]] && var=def
+
+ # If the version is "0" or less than the minimum possible version in
+ # this slot, do nothing
+ if [[ ${!var} == "0" ]] || _less_min_in_slot ${!var#<} ${slot}; then
+ continue
+ # If the no version was passed, or the version is greater than the
+ # maximum possible version in this slot, block all versions in this
+ # slot
+ elif [[ ${!var} == "unset" || -z ${!var} ]] || _greater_max_in_slot ${!var#<} ${slot}; then
+ atom=${pkg}
+ # If the version passed begins with a "<", then use "<" instead of "<="
+ elif [[ ${!var:0:1} == "<" ]]; then
+ # this also removes the first character of the version, which is a "<"
+ atom="<${pkg}-${!var:1}"
+ else
+ atom="<=${pkg}-${!var}"
+ fi
# on -kdeprefix we block every slot
- RDEPEND+=" !kdeprefix? ( !<=kde-base/${1}-${2}:${slot}[-kdeprefix] )"
+ echo " !kdeprefix? ( !${atom}:${slot}[-kdeprefix] )"
+ # on kdeprefix we block only our slot
+ if [[ ${SLOT} == ${slot} ]]; then
+ echo " kdeprefix? ( !${atom}:${SLOT}[kdeprefix] )"
+ fi
done
- # on kdeprefix we block only our slot
- RDEPEND+=" kdeprefix? ( !<=kde-base/${1}-${2}:${SLOT}[kdeprefix] )"
+
+ # This is a special case block for :3.5; it does not use the
+ # default version passed, and no blocker is output *unless* a version
+ # is passed, or ":3.5" is passed to explicitly request a block on all
+ # 3.5 versions.
+ if [[ ${block_3_5} != "unset" && ${block_3_5} != "0" ]]; then
+ if [[ -z ${block_3_5} ]]; then
+ atom=${pkg}
+ elif [[ ${block_3_5:0:1} == "<" ]]; then
+ atom="<${pkg}-${block_3_5:1}"
+ else
+ atom="<=${pkg}-${block_3_5}"
+ fi
+ echo " !${atom}:3.5"
+ fi
}
# @FUNCTION: add_kdebase_dep