/[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.48 Revision 1.52
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.48 2011/05/24 20:54:58 abcd Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.52 2011/06/15 00:11:05 abcd Exp $
4 4
5inherit versionator 5inherit versionator
6 6
7# @ECLASS: kde4-functions.eclass 7# @ECLASS: kde4-functions.eclass
8# @MAINTAINER: 8# @MAINTAINER:
54# @DESCRIPTION: 54# @DESCRIPTION:
55# The slots used by KDE live versions. Values should be ordered. 55# The slots used by KDE live versions. Values should be ordered.
56KDE_LIVE_SLOTS=( "live" ) 56KDE_LIVE_SLOTS=( "live" )
57 57
58# determine the build type 58# determine the build type
59if [[ ${SLOT} = live || ${PV} = *9999* ]]; then 59if [[ ${PV} = *9999* ]]; then
60 BUILD_TYPE="live" 60 BUILD_TYPE="live"
61else 61else
62 BUILD_TYPE="release" 62 BUILD_TYPE="release"
63fi 63fi
64export BUILD_TYPE 64export BUILD_TYPE
77 ;; 77 ;;
78 kdebase-apps) 78 kdebase-apps)
79 KDE_SCM="git" 79 KDE_SCM="git"
80 EGIT_REPONAME=${EGIT_REPONAME:=kde-baseapps} 80 EGIT_REPONAME=${EGIT_REPONAME:=kde-baseapps}
81 ;; 81 ;;
82 kde-workspace|kde-runtime|kde-baseapps)
83 KDE_SCM="git"
84 ;;
82 esac 85 esac
83fi 86fi
84 87
85# @ECLASS-VARIABLE: KDE_SCM 88# @ECLASS-VARIABLE: KDE_SCM
86# @DESCRIPTION: 89# @DESCRIPTION:
105 for _lingua in ${KDE_LINGUAS}; do 108 for _lingua in ${KDE_LINGUAS}; do
106 IUSE="${IUSE} linguas_${_lingua}" 109 IUSE="${IUSE} linguas_${_lingua}"
107 done 110 done
108fi 111fi
109 112
110# @FUNCTION: slot_is_at_least
111# @USAGE: <want> <have>
112# @DESCRIPTION:
113# Version aware slot comparator.
114# Current implementation relies on the fact, that slots can be compared like
115# string literals (and let's keep it this way).
116slot_is_at_least() {
117 [[ "${2}" > "${1}" || "${2}" = "${1}" ]]
118}
119
120# @FUNCTION: buildsycoca 113# @FUNCTION: buildsycoca
121# @DESCRIPTION: 114# @DESCRIPTION:
122# Function to rebuild the KDE System Configuration Cache. 115# Function to rebuild the KDE System Configuration Cache.
123# All KDE ebuilds should run this in pkg_postinst and pkg_postrm. 116# All KDE ebuilds should run this in pkg_postinst and pkg_postrm.
124buildsycoca() { 117buildsycoca() {
125 debug-print-function ${FUNCNAME} "$@" 118 debug-print-function ${FUNCNAME} "$@"
126 119
127 # We no longer need to run kbuildsycoca4, as kded does that automatically, as needed 120 # We no longer need to run kbuildsycoca4, as kded does that automatically, as needed
128 121
129 # fix permission for some directories 122 # fix permission for some directories
130 for x in share/{config,kde4}; do 123 for x in usr/share/{config,kde4}; do
131 [[ ${KDEDIR} == /usr ]] && DIRS=${EROOT}usr || DIRS="${EROOT}usr ${EROOT}${KDEDIR}" 124 DIRS=${EROOT}usr
132 for y in ${DIRS}; do
133 [[ -d "${y}/${x}" ]] || break # nothing to do if directory does not exist 125 [[ -d "${EROOT}${x}" ]] || break # nothing to do if directory does not exist
134 # fixes Bug 318237 126 # fixes Bug 318237
135 if use userland_BSD ; then 127 if use userland_BSD ; then
136 [[ $(stat -f %p "${y}/${x}") != 40755 ]] 128 [[ $(stat -f %p "${EROOT}${x}") != 40755 ]]
137 local stat_rtn="$?" 129 local stat_rtn="$?"
138 else 130 else
139 [[ $(stat --format=%a "${y}/${x}") != 755 ]] 131 [[ $(stat --format=%a "${EROOT}${x}") != 755 ]]
140 local stat_rtn=$? 132 local stat_rtn=$?
141 fi 133 fi
142 if [[ $stat_rtn != 1 ]] ; then 134 if [[ $stat_rtn != 1 ]] ; then
143 ewarn "QA Notice:" 135 ewarn "QA Notice:"
144 ewarn "Package ${PN} is breaking ${y}/${x} permissions." 136 ewarn "Package ${PN} is breaking ${EROOT}${x} permissions."
145 ewarn "Please report this issue to gentoo bugzilla." 137 ewarn "Please report this issue to gentoo bugzilla."
146 einfo "Permissions will get adjusted automatically now." 138 einfo "Permissions will get adjusted automatically now."
147 find "${y}/${x}" -type d -print0 | xargs -0 chmod 755 139 find "${EROOT}${x}" -type d -print0 | xargs -0 chmod 755
148 fi 140 fi
149 done
150 done 141 done
151} 142}
152 143
153# @FUNCTION: comment_all_add_subdirectory 144# @FUNCTION: comment_all_add_subdirectory
154# @USAGE: [list of directory names] 145# @USAGE: [list of directory names]
305 296
306# @FUNCTION: save_library_dependencies 297# @FUNCTION: save_library_dependencies
307# @DESCRIPTION: 298# @DESCRIPTION:
308# Add exporting CMake dependencies for current package 299# Add exporting CMake dependencies for current package
309save_library_dependencies() { 300save_library_dependencies() {
310 local depsfile="${T}/${PN}:${SLOT}" 301 local depsfile="${T}/${PN}"
311 302
312 ebegin "Saving library dependencies in ${depsfile##*/}" 303 ebegin "Saving library dependencies in ${depsfile##*/}"
313 echo "EXPORT_LIBRARY_DEPENDENCIES(\"${depsfile}\")" >> "${S}/CMakeLists.txt" || \ 304 echo "EXPORT_LIBRARY_DEPENDENCIES(\"${depsfile}\")" >> "${S}/CMakeLists.txt" || \
314 die "Failed to save the library dependencies." 305 die "Failed to save the library dependencies."
315 eend $? 306 eend $?
317 308
318# @FUNCTION: install_library_dependencies 309# @FUNCTION: install_library_dependencies
319# @DESCRIPTION: 310# @DESCRIPTION:
320# Install generated CMake library dependencies to /var/lib/kde 311# Install generated CMake library dependencies to /var/lib/kde
321install_library_dependencies() { 312install_library_dependencies() {
322 local depsfile="${T}/${PN}:${SLOT}" 313 local depsfile="${T}/${PN}"
323 314
324 ebegin "Installing library dependencies as ${depsfile##*/}" 315 ebegin "Installing library dependencies as ${depsfile##*/}"
325 insinto /var/lib/kde 316 insinto /var/lib/kde
326 doins "${depsfile}" || die "Failed to install library dependencies." 317 doins "${depsfile}" || die "Failed to install library dependencies."
327 eend $? 318 eend $?
335 ebegin "Injecting library dependencies from '${KMLOADLIBS}'" 326 ebegin "Injecting library dependencies from '${KMLOADLIBS}'"
336 327
337 i=0 328 i=0
338 for pn in ${KMLOADLIBS} ; do 329 for pn in ${KMLOADLIBS} ; do
339 ((i++)) 330 ((i++))
340 depsfile="${EPREFIX}/var/lib/kde/${pn}:${SLOT}" 331 depsfile="${EPREFIX}/var/lib/kde/${pn}"
332 [[ -r ${depsfile} ]] || depsfile="${EPREFIX}/var/lib/kde/${pn}:$(get_kde_version)"
341 [[ -r ${depsfile} ]] || die "Depsfile '${depsfile}' not accessible. You probably need to reinstall ${pn}." 333 [[ -r ${depsfile} ]] || die "Depsfile '${depsfile}' not accessible. You probably need to reinstall ${pn}."
342 sed -i -e "${i}iINCLUDE(\"${depsfile}\")" "${S}/CMakeLists.txt" || \ 334 sed -i -e "${i}iINCLUDE(\"${depsfile}\")" "${S}/CMakeLists.txt" || \
343 die "Failed to include library dependencies for ${pn}" 335 die "Failed to include library dependencies for ${pn}"
344 done 336 done
345 eend $? 337 eend $?
346} 338}
347 339
348# @FUNCTION: block_other_slots 340# @FUNCTION: block_other_slots
349# @DESCRIPTION: 341# @DESCRIPTION:
350# Create blocks for the current package in other slots when 342# Create blocks for the current package in other slots
351# installed with USE=-kdeprefix
352block_other_slots() { 343block_other_slots() {
353 debug-print-function ${FUNCNAME} "$@" 344 debug-print-function ${FUNCNAME} "$@"
345 local slot
354 346
355 _do_blocker ${PN} 0:${SLOT} 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
356} 354}
357 355
358# @FUNCTION: add_blocker 356# @FUNCTION: add_blocker
359# @DESCRIPTION: 357# @DESCRIPTION:
360# Create correct RDEPEND value for blocking correct package. 358# Create correct RDEPEND value for blocking correct package.
361# Useful for file-collision blocks. 359# Useful for file-collision blocks.
362# Parameters are package and version(s) to block. 360# Parameters are package and version(s) to block.
363# add_blocker kdelibs 4.2.4 361# add_blocker kdelibs 4.2.4
364# If no version is specified, then all versions will be blocked 362# If no version is specified, then all versions will be blocked.
365# If any arguments (from 2 on) contain a ":", then different versions 363# If the version is 0, then no versions will be blocked.
366# are blocked in different slots. (Unlisted slots get the version without 364# If a second version ending in ":3.5" is passed, then the version listed for
367# a ":", if none, then all versions are blocked). The parameter is then of 365# that slot will be blocked as well.
368# the form VERSION:SLOT. Any VERSION of 0 means that no blocker will be
369# added for that slot (or, if no slot, then for any unlisted slot).
370# A parameter of the form :SLOT means to block all versions from that slot.
371# If VERSION begins with "<", then "!<foo" will be used instead of "!<=foo".
372# As a special case, if a parameter with slot "3.5" is passed, then that slot
373# may also be blocked.
374# 366#
375# Versions that match "4.x.50" are equivalent to all slots up to (and including) 367# Examples:
376# "4.x", but nothing following slot "4.x" 368# # Block all versions of kdelibs
369# add_blocker kdelibs
377# 370#
378# As an example, if SLOT=live, then 371# # Block all versions of kdelibs older than 4.3.50
379# add_blocker kdelibs 0 :4.3 '<4.3.96:4.4' 9999:live 372# add_blocker kdelibs 4.3.50
380# will add the following to RDEPEND: 373#
381# !kdeprefix? ( !kde-base/kdelibs:4.3[-kdeprefix] ) 374# # Block kdelibs 3.5.10 and older, but not any version of
382# !kdeprefix? ( !<kde-base/kdelibs-4.3.96:4.4[-kdeprefix] ) 375# # kdelibs from KDE 4
383# !<=kde-base/kdelibs-9999:live 376# add_blocker kdelibs 0 3.5.10:3.5
384add_blocker() { 377add_blocker() {
385 debug-print-function ${FUNCNAME} "$@" 378 debug-print-function ${FUNCNAME} "$@"
386 379
387 RDEPEND+=" $(_do_blocker "$@")" 380 RDEPEND+=" $(_do_blocker "$@")"
388} 381}
406 ver=${3} 399 ver=${3}
407 elif [[ -n ${KDE_OVERRIDE_MINIMAL} ]]; then 400 elif [[ -n ${KDE_OVERRIDE_MINIMAL} ]]; then
408 ver=${KDE_OVERRIDE_MINIMAL} 401 ver=${KDE_OVERRIDE_MINIMAL}
409 elif [[ ${KDEBASE} != kde-base ]]; then 402 elif [[ ${KDEBASE} != kde-base ]]; then
410 ver=${KDE_MINIMAL} 403 ver=${KDE_MINIMAL}
411 # FIXME remove hack when kdepim-4.4.* is gone
412 elif [[ ( ${KMNAME} == kdepim || ${PN} == kdepim-runtime ) && ${SLOT} == 4.4 && ${1} =~ ^(kde(pim)?libs|oxygen-icons)$ ]]; then
413 ver=4.4.5
414 # FIXME remove hack when kdepim-4.6beta is gone
415 elif [[ ( ${KMNAME} == kdepim || ${PN} == kdepim-runtime ) && ${PV} == 4.5.98 && ${1} =~ ^(kde(pim)?libs|oxygen-icons)$ ]]; then
416 ver=4.5.90
417 # if building stable-live version depend just on slot 404 # if building stable-live version depend just on slot
418 # to allow merging packages against more stable basic stuff 405 # to allow merging packages against more stable basic stuff
419 elif [[ ${PV} == *.9999 ]]; then 406 elif [[ ${PV} == *.9999 ]]; then
420 ver=${SLOT} 407 ver=$(get_kde_version)
421 else 408 else
422 ver=${PV} 409 ver=${PV}
423 fi 410 fi
424 411
425 [[ -z ${1} ]] && die "Missing parameter" 412 [[ -z ${1} ]] && die "Missing parameter"
426 413
427 local use=${2:+,${2}}
428
429 if [[ ${KDEBASE} = kde-base ]]; then
430 echo " !kdeprefix? ( >=kde-base/${1}-${ver}[aqua=,-kdeprefix${use}] )"
431 # kdeprefix is no-go for kdepim 4.4
432 [[ ( ${KMNAME} == kdepim || ${PN} == kdepim-runtime ) && ${SLOT} == 4.4 ]] || \
433 echo " kdeprefix? ( >=kde-base/${1}-${ver}:${SLOT}[aqua=,kdeprefix${use}] )"
434 elif [[ ${ver} == live ]]; then
435 echo " kde-base/${1}:live[aqua=${use}]"
436 else
437 echo " >=kde-base/${1}-${ver}[aqua=${use}]" 414 echo " >=kde-base/${1}-${ver}[aqua=${2:+,${2}}]"
438 fi
439} 415}
440 416
441# _greater_max_in_slot ver slot 417# _greater_max_in_slot ver slot
442# slot must be 4.x or live 418# slot must be 4.x or live
443# returns true if ver is >= the maximum possibile version in slot 419# returns true if ver is >= the maximum possibile version in slot
482 use=${pkg#*\[} 458 use=${pkg#*\[}
483 use=${use%\]} 459 use=${use%\]}
484 pkg=${pkg%\[*\]} 460 pkg=${pkg%\[*\]}
485 fi 461 fi
486 462
487 local param slot def="unset" var atom 463 local slot ver="$1" atom old_ver="unset"
488 # The following variables will hold parameters that contain ":" 464 [[ "$2" == *:3.5 ]] && old_ver=${2::-4}
489 # - block_3_5
490 # - block_4_1
491 # - block_4_2
492 # - block_4_3
493 # - block_4_4
494 # - block_live
495 for slot in 3.5 ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do
496 local block_${slot//./_}="unset"
497 done
498
499 # This construct goes through each parameter passed, and sets
500 # either def or block_* to the version passed
501 for param; do
502 # If the parameter does not have a ":" in it...
503 if [[ ${param/:} == ${param} ]]; then
504 def=${param}
505 else # the parameter *does* have a ":" in it
506 # so everything after the : is the slot...
507 slot=${param#*:}
508 # ...and everything before the : is the version
509 local block_${slot//./_}=${param%:*}
510 fi
511 done
512 465
513 for slot in ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do 466 for slot in ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do
514 # ${var} contains the name of the variable we care about for this slot
515 # ${!var} is it's value
516 var=block_${slot//./_}
517 # if we didn't pass *:${slot}, then use the unsloted value
518 [[ ${!var} == "unset" ]] && var=def
519
520 # If no version was passed, or the version is greater than the maximum 467 # If no version was passed, or the version is greater than the maximum
521 # possible version in this slot, block all versions in this slot 468 # possible version in this slot, block all versions in this slot
522 if [[ ${!var} == "unset" ]] || [[ -z ${!var} ]] || _greater_max_in_slot ${!var#<} ${slot}; then 469 if [[ ${ver} == "unset" ]] || [[ -z ${ver} ]] || _greater_max_in_slot ${ver#<} ${slot}; then
523 atom=${pkg} 470 atom=${pkg}
524 # If the version is "0" or less than the minimum possible version in 471 # If the version is "0" or less than the minimum possible version in
525 # this slot, do nothing 472 # this slot, do nothing
526 elif [[ ${!var} == "0" ]] || _less_min_in_slot ${!var#<} ${slot}; then 473 elif [[ ${ver} == "0" ]] || _less_min_in_slot ${ver#<} ${slot}; then
527 continue 474 continue
528 # If the version passed begins with a "<", then use "<" instead of "<=" 475 # If the version passed begins with a "<", then use "<" instead of "<="
529 elif [[ ${!var:0:1} == "<" ]]; then 476 elif [[ ${ver::1} == "<" ]]; then
530 # this also removes the first character of the version, which is a "<" 477 # this also removes the first character of the version, which is a "<"
531 atom="<${pkg}-${!var:1}" 478 atom="<${pkg}-${ver:1}"
532 else 479 else
533 atom="<=${pkg}-${!var}" 480 atom="<=${pkg}-${ver}"
534 fi 481 fi
535 # we always block our own slot, ignoring kdeprefix
536 if [[ ${SLOT} == ${slot} ]]; then
537 echo " !${atom}:${slot}${use:+[${use}]}" 482 echo " !${atom}:${slot}${use:+[${use}]}"
538 else
539 # we only block other slots on -kdeprefix
540 echo " !kdeprefix? ( !${atom}:${slot}[-kdeprefix${use:+,${use}}] )"
541 fi
542 done 483 done
543 484
544 # This is a special case block for :3.5; it does not use the 485 # This is a special case block for :3.5; it does not use the
545 # default version passed, and no blocker is output *unless* a version 486 # default version passed, and no blocker is output *unless* a version
546 # is passed, or ":3.5" is passed to explicitly request a block on all 487 # is passed, or ":3.5" is passed to explicitly request a block on all
547 # 3.5 versions. 488 # 3.5 versions.
548 if [[ ${block_3_5} != "unset" && ${block_3_5} != "0" ]]; then 489 if [[ ${old_ver} != "unset" && ${old_ver} != "0" ]]; then
549 if [[ -z ${block_3_5} ]]; then 490 if [[ -z ${old_ver} ]]; then
550 atom=${pkg} 491 atom=${pkg}
551 elif [[ ${block_3_5:0:1} == "<" ]]; then 492 elif [[ ${old_ver::1} == "<" ]]; then
552 atom="<${pkg}-${block_3_5:1}" 493 atom="<${pkg}-${old_ver:1}"
553 else 494 else
554 atom="<=${pkg}-${block_3_5}" 495 atom="<=${pkg}-${old_ver}"
555 fi 496 fi
556 echo " !${atom}:3.5${use:+[${use}]}" 497 echo " !${atom}:3.5${use:+[${use}]}"
557 fi 498 fi
558} 499}
559 500
605 [[ -n ${linguas} ]] && echo ">>> Enabling languages: ${linguas}" 546 [[ -n ${linguas} ]] && echo ">>> Enabling languages: ${linguas}"
606 547
607 popd > /dev/null 548 popd > /dev/null
608} 549}
609 550
610_calculate_kde_slot() { 551# @FUNCTION: get_kde_version
552# Translates an ebuild version into a major.minor KDE SC
553# release version. If no version is specified, ${PV} is used.
554get_kde_version() {
611 local ver=${1:-${PV}} 555 local ver=${1:-${PV}}
612 local major=$(get_major_version ${ver}) 556 local major=$(get_major_version ${ver})
613 local minor=$(get_version_component_range 2 ${ver}) 557 local minor=$(get_version_component_range 2 ${ver})
614 local micro=$(get_version_component_range 3 ${ver}) 558 local micro=$(get_version_component_range 3 ${ver})
615 [[ ${ver} == 9999 ]] && echo live 559 if [[ ${ver} == 9999 ]]; then
616 (( major == 4 && micro == 9999 )) && echo ${major}.${minor} 560 echo live
617 if (( major == 4 && micro != 9999 )); then 561 else
618 (( micro < 50 )) && echo ${major}.${minor} || echo ${major}.$((minor + 1)) 562 (( micro < 50 )) && echo ${major}.${minor} || echo ${major}.$((minor + 1))
619 fi 563 fi
620} 564}

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

  ViewVC Help
Powered by ViewVC 1.1.20