| 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.51 2011/06/07 20:11:04 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 | |
| 5 | inherit versionator |
5 | inherit versionator |
| 6 | |
6 | |
| 7 | # @ECLASS: kde4-functions.eclass |
7 | # @ECLASS: kde4-functions.eclass |
| 8 | # @MAINTAINER: |
8 | # @MAINTAINER: |
| … | |
… | |
| 118 | debug-print-function ${FUNCNAME} "$@" |
118 | debug-print-function ${FUNCNAME} "$@" |
| 119 | |
119 | |
| 120 | # 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 |
| 121 | |
121 | |
| 122 | # fix permission for some directories |
122 | # fix permission for some directories |
| 123 | for x in share/{config,kde4}; do |
123 | for x in usr/share/{config,kde4}; do |
| 124 | [[ ${KDEDIR} == /usr ]] && DIRS=${EROOT}usr || DIRS="${EROOT}usr ${EROOT}${KDEDIR}" |
124 | DIRS=${EROOT}usr |
| 125 | for y in ${DIRS}; do |
|
|
| 126 | [[ -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 |
| 127 | # fixes Bug 318237 |
126 | # fixes Bug 318237 |
| 128 | if use userland_BSD ; then |
127 | if use userland_BSD ; then |
| 129 | [[ $(stat -f %p "${y}/${x}") != 40755 ]] |
128 | [[ $(stat -f %p "${EROOT}${x}") != 40755 ]] |
| 130 | local stat_rtn="$?" |
129 | local stat_rtn="$?" |
| 131 | else |
130 | else |
| 132 | [[ $(stat --format=%a "${y}/${x}") != 755 ]] |
131 | [[ $(stat --format=%a "${EROOT}${x}") != 755 ]] |
| 133 | local stat_rtn=$? |
132 | local stat_rtn=$? |
| 134 | fi |
133 | fi |
| 135 | if [[ $stat_rtn != 1 ]] ; then |
134 | if [[ $stat_rtn != 1 ]] ; then |
| 136 | ewarn "QA Notice:" |
135 | ewarn "QA Notice:" |
| 137 | ewarn "Package ${PN} is breaking ${y}/${x} permissions." |
136 | ewarn "Package ${PN} is breaking ${EROOT}${x} permissions." |
| 138 | ewarn "Please report this issue to gentoo bugzilla." |
137 | ewarn "Please report this issue to gentoo bugzilla." |
| 139 | einfo "Permissions will get adjusted automatically now." |
138 | einfo "Permissions will get adjusted automatically now." |
| 140 | find "${y}/${x}" -type d -print0 | xargs -0 chmod 755 |
139 | find "${EROOT}${x}" -type d -print0 | xargs -0 chmod 755 |
| 141 | fi |
140 | fi |
| 142 | done |
|
|
| 143 | done |
141 | done |
| 144 | } |
142 | } |
| 145 | |
143 | |
| 146 | # @FUNCTION: comment_all_add_subdirectory |
144 | # @FUNCTION: comment_all_add_subdirectory |
| 147 | # @USAGE: [list of directory names] |
145 | # @USAGE: [list of directory names] |
| … | |
… | |
| 342 | # @FUNCTION: block_other_slots |
340 | # @FUNCTION: block_other_slots |
| 343 | # @DESCRIPTION: |
341 | # @DESCRIPTION: |
| 344 | # Create blocks for the current package in other slots |
342 | # Create blocks for the current package in other slots |
| 345 | block_other_slots() { |
343 | block_other_slots() { |
| 346 | debug-print-function ${FUNCNAME} "$@" |
344 | debug-print-function ${FUNCNAME} "$@" |
|
|
345 | local slot |
| 347 | |
346 | |
| 348 | _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 |
| 349 | } |
354 | } |
| 350 | |
355 | |
| 351 | # @FUNCTION: add_blocker |
356 | # @FUNCTION: add_blocker |
| 352 | # @DESCRIPTION: |
357 | # @DESCRIPTION: |
| 353 | # Create correct RDEPEND value for blocking correct package. |
358 | # Create correct RDEPEND value for blocking correct package. |
| 354 | # Useful for file-collision blocks. |
359 | # Useful for file-collision blocks. |
| 355 | # Parameters are package and version(s) to block. |
360 | # Parameters are package and version(s) to block. |
| 356 | # add_blocker kdelibs 4.2.4 |
361 | # add_blocker kdelibs 4.2.4 |
| 357 | # If no version is specified, then all versions will be blocked |
362 | # If no version is specified, then all versions will be blocked. |
| 358 | # If any arguments (from 2 on) contain a ":", then different versions |
363 | # If the version is 0, then no versions will be blocked. |
| 359 | # 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 |
| 360 | # a ":", if none, then all versions are blocked). The parameter is then of |
365 | # that slot will be blocked as well. |
| 361 | # the form VERSION:SLOT. Any VERSION of 0 means that no blocker will be |
|
|
| 362 | # added for that slot (or, if no slot, then for any unlisted slot). |
|
|
| 363 | # A parameter of the form :SLOT means to block all versions from that slot. |
|
|
| 364 | # If VERSION begins with "<", then "!<foo" will be used instead of "!<=foo". |
|
|
| 365 | # As a special case, if a parameter with slot "3.5" is passed, then that slot |
|
|
| 366 | # may also be blocked. |
|
|
| 367 | # |
366 | # |
| 368 | # Versions that match "4.x.50" are equivalent to all slots up to (and including) |
367 | # Examples: |
| 369 | # "4.x", but nothing following slot "4.x" |
368 | # # Block all versions of kdelibs |
|
|
369 | # add_blocker kdelibs |
| 370 | # |
370 | # |
| 371 | # As an example, if SLOT=live, then |
371 | # # Block all versions of kdelibs older than 4.3.50 |
| 372 | # add_blocker kdelibs 0 :4.3 '<4.3.96:4.4' 9999:live |
372 | # add_blocker kdelibs 4.3.50 |
| 373 | # will add the following to RDEPEND: |
373 | # |
| 374 | # !kde-base/kdelibs:4.3 |
374 | # # Block kdelibs 3.5.10 and older, but not any version of |
| 375 | # !<kde-base/kdelibs-4.3.96:4.4 |
375 | # # kdelibs from KDE 4 |
| 376 | # !<=kde-base/kdelibs-9999:live |
376 | # add_blocker kdelibs 0 3.5.10:3.5 |
| 377 | add_blocker() { |
377 | add_blocker() { |
| 378 | debug-print-function ${FUNCNAME} "$@" |
378 | debug-print-function ${FUNCNAME} "$@" |
| 379 | |
379 | |
| 380 | RDEPEND+=" $(_do_blocker "$@")" |
380 | RDEPEND+=" $(_do_blocker "$@")" |
| 381 | } |
381 | } |
| … | |
… | |
| 399 | ver=${3} |
399 | ver=${3} |
| 400 | elif [[ -n ${KDE_OVERRIDE_MINIMAL} ]]; then |
400 | elif [[ -n ${KDE_OVERRIDE_MINIMAL} ]]; then |
| 401 | ver=${KDE_OVERRIDE_MINIMAL} |
401 | ver=${KDE_OVERRIDE_MINIMAL} |
| 402 | elif [[ ${KDEBASE} != kde-base ]]; then |
402 | elif [[ ${KDEBASE} != kde-base ]]; then |
| 403 | ver=${KDE_MINIMAL} |
403 | ver=${KDE_MINIMAL} |
| 404 | # FIXME remove hack when kdepim-4.4.* is gone |
|
|
| 405 | elif [[ ( ${KMNAME} == kdepim || ${PN} == kdepim-runtime ) && $(get_kde_version) == 4.4 && ${1} =~ ^(kde(pim)?libs|oxygen-icons)$ ]]; then |
|
|
| 406 | ver=4.4.5 |
|
|
| 407 | # FIXME remove hack when kdepim-4.6beta is gone |
|
|
| 408 | elif [[ ( ${KMNAME} == kdepim || ${PN} == kdepim-runtime ) && ${PV} == 4.5.98 && ${1} =~ ^(kde(pim)?libs|oxygen-icons)$ ]]; then |
|
|
| 409 | ver=4.5.90 |
|
|
| 410 | # if building stable-live version depend just on slot |
404 | # if building stable-live version depend just on slot |
| 411 | # to allow merging packages against more stable basic stuff |
405 | # to allow merging packages against more stable basic stuff |
| 412 | elif [[ ${PV} == *.9999 ]]; then |
406 | elif [[ ${PV} == *.9999 ]]; then |
| 413 | ver=$(get_kde_version) |
407 | ver=$(get_kde_version) |
| 414 | else |
408 | else |
| 415 | ver=${PV} |
409 | ver=${PV} |
| 416 | fi |
410 | fi |
| 417 | |
411 | |
| 418 | [[ -z ${1} ]] && die "Missing parameter" |
412 | [[ -z ${1} ]] && die "Missing parameter" |
| 419 | |
413 | |
| 420 | local use=${2:+,${2}} |
|
|
| 421 | |
|
|
| 422 | if [[ ${ver} == live ]]; then |
|
|
| 423 | echo " kde-base/${1}:live[aqua=${use}]" |
|
|
| 424 | else |
|
|
| 425 | echo " >=kde-base/${1}-${ver}[aqua=${use}]" |
414 | echo " >=kde-base/${1}-${ver}[aqua=${2:+,${2}}]" |
| 426 | fi |
|
|
| 427 | } |
415 | } |
| 428 | |
416 | |
| 429 | # _greater_max_in_slot ver slot |
417 | # _greater_max_in_slot ver slot |
| 430 | # slot must be 4.x or live |
418 | # slot must be 4.x or live |
| 431 | # returns true if ver is >= the maximum possibile version in slot |
419 | # returns true if ver is >= the maximum possibile version in slot |
| … | |
… | |
| 470 | use=${pkg#*\[} |
458 | use=${pkg#*\[} |
| 471 | use=${use%\]} |
459 | use=${use%\]} |
| 472 | pkg=${pkg%\[*\]} |
460 | pkg=${pkg%\[*\]} |
| 473 | fi |
461 | fi |
| 474 | |
462 | |
| 475 | local param slot def="unset" var atom |
463 | local slot ver="$1" atom old_ver="unset" |
| 476 | # The following variables will hold parameters that contain ":" |
464 | [[ "$2" == *:3.5 ]] && old_ver=${2::-4} |
| 477 | # - block_3_5 |
|
|
| 478 | # - block_4_1 |
|
|
| 479 | # - block_4_2 |
|
|
| 480 | # - block_4_3 |
|
|
| 481 | # - block_4_4 |
|
|
| 482 | # - block_live |
|
|
| 483 | for slot in 3.5 ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do |
|
|
| 484 | local block_${slot//./_}="unset" |
|
|
| 485 | done |
|
|
| 486 | |
|
|
| 487 | # This construct goes through each parameter passed, and sets |
|
|
| 488 | # either def or block_* to the version passed |
|
|
| 489 | for param; do |
|
|
| 490 | # If the parameter does not have a ":" in it... |
|
|
| 491 | if [[ ${param/:} == ${param} ]]; then |
|
|
| 492 | def=${param} |
|
|
| 493 | else # the parameter *does* have a ":" in it |
|
|
| 494 | # so everything after the : is the slot... |
|
|
| 495 | slot=${param#*:} |
|
|
| 496 | # ...and everything before the : is the version |
|
|
| 497 | local block_${slot//./_}=${param%:*} |
|
|
| 498 | fi |
|
|
| 499 | done |
|
|
| 500 | |
465 | |
| 501 | for slot in ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do |
466 | for slot in ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do |
| 502 | # ${var} contains the name of the variable we care about for this slot |
|
|
| 503 | # ${!var} is it's value |
|
|
| 504 | var=block_${slot//./_} |
|
|
| 505 | # if we didn't pass *:${slot}, then use the unsloted value |
|
|
| 506 | [[ ${!var} == "unset" ]] && var=def |
|
|
| 507 | |
|
|
| 508 | # 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 |
| 509 | # possible version in this slot, block all versions in this slot |
468 | # possible version in this slot, block all versions in this slot |
| 510 | 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 |
| 511 | atom=${pkg} |
470 | atom=${pkg} |
| 512 | # 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 |
| 513 | # this slot, do nothing |
472 | # this slot, do nothing |
| 514 | elif [[ ${!var} == "0" ]] || _less_min_in_slot ${!var#<} ${slot}; then |
473 | elif [[ ${ver} == "0" ]] || _less_min_in_slot ${ver#<} ${slot}; then |
| 515 | continue |
474 | continue |
| 516 | # If the version passed begins with a "<", then use "<" instead of "<=" |
475 | # If the version passed begins with a "<", then use "<" instead of "<=" |
| 517 | elif [[ ${!var:0:1} == "<" ]]; then |
476 | elif [[ ${ver::1} == "<" ]]; then |
| 518 | # 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 "<" |
| 519 | atom="<${pkg}-${!var:1}" |
478 | atom="<${pkg}-${ver:1}" |
| 520 | else |
479 | else |
| 521 | atom="<=${pkg}-${!var}" |
480 | atom="<=${pkg}-${ver}" |
| 522 | fi |
481 | fi |
| 523 | echo " !${atom}:${slot}${use:+[${use}]}" |
482 | echo " !${atom}:${slot}${use:+[${use}]}" |
| 524 | done |
483 | done |
| 525 | |
484 | |
| 526 | # 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 |
| 527 | # default version passed, and no blocker is output *unless* a version |
486 | # default version passed, and no blocker is output *unless* a version |
| 528 | # 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 |
| 529 | # 3.5 versions. |
488 | # 3.5 versions. |
| 530 | if [[ ${block_3_5} != "unset" && ${block_3_5} != "0" ]]; then |
489 | if [[ ${old_ver} != "unset" && ${old_ver} != "0" ]]; then |
| 531 | if [[ -z ${block_3_5} ]]; then |
490 | if [[ -z ${old_ver} ]]; then |
| 532 | atom=${pkg} |
491 | atom=${pkg} |
| 533 | elif [[ ${block_3_5:0:1} == "<" ]]; then |
492 | elif [[ ${old_ver::1} == "<" ]]; then |
| 534 | atom="<${pkg}-${block_3_5:1}" |
493 | atom="<${pkg}-${old_ver:1}" |
| 535 | else |
494 | else |
| 536 | atom="<=${pkg}-${block_3_5}" |
495 | atom="<=${pkg}-${old_ver}" |
| 537 | fi |
496 | fi |
| 538 | echo " !${atom}:3.5${use:+[${use}]}" |
497 | echo " !${atom}:3.5${use:+[${use}]}" |
| 539 | fi |
498 | fi |
| 540 | } |
499 | } |
| 541 | |
500 | |
| … | |
… | |
| 595 | get_kde_version() { |
554 | get_kde_version() { |
| 596 | local ver=${1:-${PV}} |
555 | local ver=${1:-${PV}} |
| 597 | local major=$(get_major_version ${ver}) |
556 | local major=$(get_major_version ${ver}) |
| 598 | local minor=$(get_version_component_range 2 ${ver}) |
557 | local minor=$(get_version_component_range 2 ${ver}) |
| 599 | local micro=$(get_version_component_range 3 ${ver}) |
558 | local micro=$(get_version_component_range 3 ${ver}) |
| 600 | [[ ${ver} == 9999 ]] && echo live |
559 | if [[ ${ver} == 9999 ]]; then |
| 601 | (( major == 4 && micro == 9999 )) && echo ${major}.${minor} |
560 | echo live |
| 602 | if (( major == 4 && micro != 9999 )); then |
561 | else |
| 603 | (( micro < 50 )) && echo ${major}.${minor} || echo ${major}.$((minor + 1)) |
562 | (( micro < 50 )) && echo ${major}.${minor} || echo ${major}.$((minor + 1)) |
| 604 | fi |
563 | fi |
| 605 | } |
564 | } |