/[gentoo-x86]/eclass/kde4-functions.eclass
Gentoo

Diff of /eclass/kde4-functions.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.52 Revision 1.54
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.52 2011/06/15 00:11:05 abcd Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.54 2011/06/15 22:03:13 abcd Exp $
4 4
5inherit versionator 5inherit versionator
6 6
7# @ECLASS: kde4-functions.eclass 7# @ECLASS: kde4-functions.eclass
8# @MAINTAINER: 8# @MAINTAINER:
41 KDEBASE=koffice 41 KDEBASE=koffice
42elif [[ ${KMNAME-${PN}} = kdevelop ]]; then 42elif [[ ${KMNAME-${PN}} = kdevelop ]]; then
43 debug-print "${ECLASS}: KDEVELOP ebuild recognized" 43 debug-print "${ECLASS}: KDEVELOP ebuild recognized"
44 KDEBASE=kdevelop 44 KDEBASE=kdevelop
45fi 45fi
46
47# @ECLASS-VARIABLE: KDE_SLOTS
48# @DESCRIPTION:
49# The slots used by all KDE versions later than 4.0. The live KDE releases use
50# KDE_LIVE_SLOTS instead. Values should be ordered.
51KDE_SLOTS=( "4.1" "4.2" "4.3" "4.4" "4.5" "4.6" "4.7" )
52
53# @ECLASS-VARIABLE: KDE_LIVE_SLOTS
54# @DESCRIPTION:
55# The slots used by KDE live versions. Values should be ordered.
56KDE_LIVE_SLOTS=( "live" )
57 46
58# determine the build type 47# determine the build type
59if [[ ${PV} = *9999* ]]; then 48if [[ ${PV} = *9999* ]]; then
60 BUILD_TYPE="live" 49 BUILD_TYPE="live"
61else 50else
335 die "Failed to include library dependencies for ${pn}" 324 die "Failed to include library dependencies for ${pn}"
336 done 325 done
337 eend $? 326 eend $?
338} 327}
339 328
340# @FUNCTION: block_other_slots
341# @DESCRIPTION:
342# Create blocks for the current package in other slots
343block_other_slots() {
344 debug-print-function ${FUNCNAME} "$@"
345 local slot
346
347 # Temporary HACK, remove this function after slotmove
348 # (moved from _do_blocker, as this only needs a very specialized listing)
349 for slot in "${KDE_SLOTS[@]}" "${KDE_LIVE_SLOTS[@]}"; do
350 if [[ ${slot} != ${SLOT} ]]; then
351 echo " !kde-base/${PN}:${slot}"
352 fi
353 done
354}
355
356# @FUNCTION: add_blocker 329# @FUNCTION: add_blocker
357# @DESCRIPTION: 330# @DESCRIPTION:
358# Create correct RDEPEND value for blocking correct package. 331# Create correct RDEPEND value for blocking correct package.
359# Useful for file-collision blocks. 332# Useful for file-collision blocks.
360# Parameters are package and version(s) to block. 333# Parameters are package and version(s) to block.
375# # kdelibs from KDE 4 348# # kdelibs from KDE 4
376# add_blocker kdelibs 0 3.5.10:3.5 349# add_blocker kdelibs 0 3.5.10:3.5
377add_blocker() { 350add_blocker() {
378 debug-print-function ${FUNCNAME} "$@" 351 debug-print-function ${FUNCNAME} "$@"
379 352
380 RDEPEND+=" $(_do_blocker "$@")" 353 [[ -z ${1} ]] && die "Missing parameter"
354 local pkg=kde-base/$1 atom old_ver="unset" use
355 if [[ $pkg == *\[*\] ]]; then
356 use=${pkg/#*\[/[}
357 pkg=${pkg%\[*\]}
358 fi
359
360 [[ "$3" == *:3.5 ]] && old_ver=${3%:3.5}
361
362 # If the version passed is "0", do nothing
363 if [[ ${2} != 0 ]]; then
364 # If no version was passed, block all versions in this slot
365 if [[ -z ${2} ]]; then
366 atom=${pkg}
367 # If the version passed begins with a "<", then use "<" instead of "<="
368 elif [[ ${2::1} == "<" ]]; then
369 # this also removes the first character of the version, which is a "<"
370 atom="<${pkg}-${2:1}"
371 else
372 atom="<=${pkg}-${2}"
373 fi
374 RDEPEND+=" !${atom}:4${use}"
375 fi
376
377 # Do the same thing as above for :3.5, except that we don't want any
378 # output if no parameter was passed.
379 if [[ ${old_ver} != "unset" ]]; then
380 if [[ -z ${old_ver} ]]; then
381 atom=${pkg}
382 elif [[ ${old_ver::1} == "<" ]]; then
383 atom="<${pkg}-${old_ver:1}"
384 else
385 atom="<=${pkg}-${old_ver}"
386 fi
387 RDEPEND+=" !${atom}:3.5${use}"
388 fi
381} 389}
382 390
383# @FUNCTION: add_kdebase_dep 391# @FUNCTION: add_kdebase_dep
384# @DESCRIPTION: 392# @DESCRIPTION:
385# Create proper dependency for kde-base/ dependencies, adding SLOT when needed 393# Create proper dependency for kde-base/ dependencies.
386# (and *only* when needed).
387# This takes 1 to 3 arguments. The first being the package name, the optional 394# This takes 1 to 3 arguments. The first being the package name, the optional
388# second is additional USE flags to append, and the optional third is the 395# second is additional USE flags to append, and the optional third is the
389# version to use instead of the automatic version (use sparingly). 396# version to use instead of the automatic version (use sparingly).
390# The output of this should be added directly to DEPEND/RDEPEND, and may be 397# The output of this should be added directly to DEPEND/RDEPEND, and may be
391# wrapped in a USE conditional (but not an || conditional without an extra set 398# wrapped in a USE conditional (but not an || conditional without an extra set
399 ver=${3} 406 ver=${3}
400 elif [[ -n ${KDE_OVERRIDE_MINIMAL} ]]; then 407 elif [[ -n ${KDE_OVERRIDE_MINIMAL} ]]; then
401 ver=${KDE_OVERRIDE_MINIMAL} 408 ver=${KDE_OVERRIDE_MINIMAL}
402 elif [[ ${KDEBASE} != kde-base ]]; then 409 elif [[ ${KDEBASE} != kde-base ]]; then
403 ver=${KDE_MINIMAL} 410 ver=${KDE_MINIMAL}
404 # if building stable-live version depend just on slot 411 # if building stable-live version depend just on the raw KDE version
405 # to allow merging packages against more stable basic stuff 412 # to allow merging packages against more stable basic stuff
406 elif [[ ${PV} == *.9999 ]]; then 413 elif [[ ${PV} == *.9999 ]]; then
407 ver=$(get_kde_version) 414 ver=$(get_kde_version)
408 else 415 else
409 ver=${PV} 416 ver=${PV}
410 fi 417 fi
411 418
412 [[ -z ${1} ]] && die "Missing parameter" 419 [[ -z ${1} ]] && die "Missing parameter"
413 420
414 echo " >=kde-base/${1}-${ver}[aqua=${2:+,${2}}]" 421 echo " >=kde-base/${1}-${ver}:4[aqua=${2:+,${2}}]"
415}
416
417# _greater_max_in_slot ver slot
418# slot must be 4.x or live
419# returns true if ver is >= the maximum possibile version in slot
420_greater_max_in_slot() {
421 local ver=$1
422 local slot=$2
423 # If slot is live, then return false
424 # (nothing is greater than the maximum live version)
425 [[ $slot == live ]] && return 1
426 # Otherwise, for slot X.Y, test against X.Y.50
427 local test=${slot}.50
428 version_compare $1 ${test}
429 # 1 = '<', 2 = '=', 3 = '>'
430 (( $? != 1 ))
431}
432
433# _less_min_in_slot ver slot
434# slot must be 4.x or live
435# returns true if ver is <= the minimum possibile version in slot
436_less_min_in_slot() {
437 local ver=$1
438 local slot=$2
439 # If slot == live, then test with "9999_pre", so that 9999 tests false
440 local test=9999_pre
441 # If slot == X.Y, then test with X.(Y-1).50
442 [[ $slot != live ]] && test=${slot%.*}.$((${slot#*.} - 1)).50
443 version_compare $1 ${test}
444 # 1 = '<', 2 = '=', 3 = '>'
445 (( $? != 3 ))
446}
447
448# Internal function used for add_blocker and block_other_slots
449# This takes the same parameters as add_blocker, but echos to
450# stdout instead of updating a variable.
451_do_blocker() {
452 debug-print-function ${FUNCNAME} "$@"
453
454 [[ -z ${1} ]] && die "Missing parameter"
455 local pkg=kde-base/$1 use
456 shift
457 if [[ $pkg == *\[*\] ]]; then
458 use=${pkg#*\[}
459 use=${use%\]}
460 pkg=${pkg%\[*\]}
461 fi
462
463 local slot ver="$1" atom old_ver="unset"
464 [[ "$2" == *:3.5 ]] && old_ver=${2::-4}
465
466 for slot in ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do
467 # If no version was passed, or the version is greater than the maximum
468 # possible version in this slot, block all versions in this slot
469 if [[ ${ver} == "unset" ]] || [[ -z ${ver} ]] || _greater_max_in_slot ${ver#<} ${slot}; then
470 atom=${pkg}
471 # If the version is "0" or less than the minimum possible version in
472 # this slot, do nothing
473 elif [[ ${ver} == "0" ]] || _less_min_in_slot ${ver#<} ${slot}; then
474 continue
475 # If the version passed begins with a "<", then use "<" instead of "<="
476 elif [[ ${ver::1} == "<" ]]; then
477 # this also removes the first character of the version, which is a "<"
478 atom="<${pkg}-${ver:1}"
479 else
480 atom="<=${pkg}-${ver}"
481 fi
482 echo " !${atom}:${slot}${use:+[${use}]}"
483 done
484
485 # This is a special case block for :3.5; it does not use the
486 # default version passed, and no blocker is output *unless* a version
487 # is passed, or ":3.5" is passed to explicitly request a block on all
488 # 3.5 versions.
489 if [[ ${old_ver} != "unset" && ${old_ver} != "0" ]]; then
490 if [[ -z ${old_ver} ]]; then
491 atom=${pkg}
492 elif [[ ${old_ver::1} == "<" ]]; then
493 atom="<${pkg}-${old_ver:1}"
494 else
495 atom="<=${pkg}-${old_ver}"
496 fi
497 echo " !${atom}:3.5${use:+[${use}]}"
498 fi
499} 422}
500 423
501# local function to enable specified translations for specified directory 424# local function to enable specified translations for specified directory
502# used from kde4-functions_enable_selected_linguas function 425# used from kde4-functions_enable_selected_linguas function
503_enable_selected_linguas_dir() { 426_enable_selected_linguas_dir() {

Legend:
Removed from v.1.52  
changed lines
  Added in v.1.54

  ViewVC Help
Powered by ViewVC 1.1.20