diff options
author | Alexey Shvetsov <alexxy@gentoo.org> | 2009-10-06 18:02:12 +0000 |
---|---|---|
committer | Alexey Shvetsov <alexxy@gentoo.org> | 2009-10-06 18:02:12 +0000 |
commit | 2af9afa3cccbae359cda5db5640edb62cd3caa20 (patch) | |
tree | 3a47f4f7545135fb1e773f169e283cfdc4febcef /eclass/kde4-functions.eclass | |
parent | Removed alternative dependency on Qt metapackage (diff) | |
download | historical-2af9afa3cccbae359cda5db5640edb62cd3caa20.tar.gz historical-2af9afa3cccbae359cda5db5640edb62cd3caa20.tar.bz2 historical-2af9afa3cccbae359cda5db5640edb62cd3caa20.zip |
[eclass] Update kde4 eclasses
Diffstat (limited to 'eclass/kde4-functions.eclass')
-rw-r--r-- | eclass/kde4-functions.eclass | 196 |
1 files changed, 160 insertions, 36 deletions
diff --git a/eclass/kde4-functions.eclass b/eclass/kde4-functions.eclass index 678e7a70d531..dbac21790fd8 100644 --- a/eclass/kde4-functions.eclass +++ b/eclass/kde4-functions.eclass @@ -1,6 +1,8 @@ # Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.24 2009/09/01 09:32:08 scarabeus Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.25 2009/10/06 18:02:12 alexxy Exp $ + +inherit versionator # Prefix compat: : ${EROOT:=${ROOT}} @@ -82,26 +84,7 @@ buildsycoca() { eend $? fi - if [[ -z ${EROOT%%/} && -x "${KDEDIR}"/bin/kbuildsycoca4 ]]; then - # Make sure tha cache file exists, writable by root and readable by - # others. Otherwise kbuildsycoca4 will fail. - touch "${KDEDIR}/share/kde4/services/ksycoca4" - chmod 644 "${KDEDIR}/share/kde4/services/ksycoca4" - - # We have to unset DISPLAY and DBUS_SESSION_BUS_ADDRESS, the ones - # in the user's environment (through su [without '-']) may cause - # kbuildsycoca4 to hang. - - ebegin "Running kbuildsycoca4 to build global database" - # This is needed because we support multiple kde versions installed together. - # Lookup in order - local, KDEDIR, /usr, do not duplicate entries btw. - local KDEDIRS="${EROOT}usr/share" - [[ ${KDEDIR} != "${EROOT}usr" ]] && KDEDIRS="${KDEDIR}/share:${KDEDIRS}" - XDG_DATA_DIRS="${EROOT}usr/local/share:${KDEDIRS}" \ - DISPLAY="" DBUS_SESSION_BUS_ADDRESS="" \ - "${KDEDIR}"/bin/kbuildsycoca4 --global --noincremental &> /dev/null - eend $? - fi + # We no longer need to run kbuildsycoca4, as kded does that automatically, as needed # fix permission for some directories for x in share/{config,kde4}; do @@ -372,30 +355,171 @@ 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. -# add_blocker kde-base/kdelibs 4.2.4 +# 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 +# slot must be 4.x or live +# returns true if ver is >= the maximum possibile version in slot +_greater_max_in_slot() { + local ver=$1 + local slot=$2 + # If slot is live, then return false + # (nothing is greater than the maximum live version) + [[ $slot == live ]] && return 1 + # Otherwise, for slot X.Y, test against X.Y.50 + local test=${slot}.50 + version_compare $1 ${test} + # 1 = '<', 2 = '=', 3 = '>' + [[ $? -ne 1 ]] +} + +# _less_min_in_slot ver slot +# slot must be 4.x or live +# returns true if ver is <= the minimum possibile version in slot +_less_min_in_slot() { + local ver=$1 + local slot=$2 + # If slot == live, then test with "9999_pre", so that 9999 tests false + local test=9999_pre + # If slot == X.Y, then test with X.(Y-1).50 + [[ $slot == live ]] || test=${slot%.*}.$((${slot#*.} - 1)).50 + version_compare $1 ${test} + # 1 = '<', 2 = '=', 3 = '>' + [[ $? -ne 3 ]] +} + +# 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 will hold parameters that contain ":" + # - block_3_5 + # - block_4_1 + # - block_4_2 + # - block_4_3 + # - block_4_4 + # - block_live + for slot in 3.5 ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do + 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 no version was passed, or the version is greater than the + # maximum possible version in this slot, block all versions in this + # slot + if [[ ${!var} == "unset" ]] || _greater_max_in_slot ${!var#<} ${slot}; then + atom=${pkg} + # If the version is "0" or less than the minimum possible version in + # this slot, do nothing + elif [[ ${!var} == "0" ]] || _less_min_in_slot ${!var#<} ${slot}; then + continue + # 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? ( !<=${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? ( !<=${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 +# @DESCRIPTION: +# Create proper dependency for kde-base/ dependencies, +# adding SLOT when needed (and *only* when needed). +# This takes 1 or 2 arguments. The first being the package +# name, the optional second, is additional USE flags to append. +# The output of this should be added directly to DEPEND/RDEPEND, and +# may be wrapped in a USE conditional (but not an || conditional +# without an extra set of parentheses. +add_kdebase_dep() { + debug-print-function ${FUNCNAME} "$@" + + [[ -z ${1} ]] && die "Missing parameter" + + local use=${2:+,${2}} + + echo "!kdeprefix? ( >=kde-base/${1}-${PV}[-kdeprefix${use}] )" + echo "kdeprefix? ( >=kde-base/${1}-${PV}:${SLOT}[kdeprefix${use}] )" } |