From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SFmsC-0006xu-W3 for garchives@archives.gentoo.org; Thu, 05 Apr 2012 13:37:13 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CA9BBE0F65; Thu, 5 Apr 2012 13:37:02 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 8BEE6E0F65 for ; Thu, 5 Apr 2012 13:37:02 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CF5951B402B for ; Thu, 5 Apr 2012 13:37:01 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 98BA7E5403 for ; Thu, 5 Apr 2012 13:37:00 +0000 (UTC) From: "Davide Pesavento" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Davide Pesavento" Message-ID: <1333632970.fd401af5991a7915f014fb1a2b7b3a4e3f7d3f30.pesa@gentoo> Subject: [gentoo-commits] proj/qt:master commit in: eclass/ X-VCS-Repository: proj/qt X-VCS-Files: eclass/qt4-r2.eclass X-VCS-Directories: eclass/ X-VCS-Committer: pesa X-VCS-Committer-Name: Davide Pesavento X-VCS-Revision: fd401af5991a7915f014fb1a2b7b3a4e3f7d3f30 X-VCS-Branch: master Date: Thu, 5 Apr 2012 13:37:00 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 1a638737-84e4-4156-97c3-d6fbab248bdc X-Archives-Hash: 4a50fedaaac3d175d6e10263e7c83fc6 commit: fd401af5991a7915f014fb1a2b7b3a4e3f7d3f30 Author: Davide Pesavento gmail com> AuthorDate: Thu Apr 5 13:36:10 2012 +0000 Commit: Davide Pesavento gentoo org> CommitDate: Thu Apr 5 13:36:10 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/qt.git;a=3Dco= mmit;h=3Dfd401af5 [qt4-r2.eclass] Move some code around, no functional changes. --- eclass/qt4-r2.eclass | 108 ++++++++++++++++++++++++--------------------= ----- 1 files changed, 53 insertions(+), 55 deletions(-) diff --git a/eclass/qt4-r2.eclass b/eclass/qt4-r2.eclass index 09adfd8..c8b007d 100644 --- a/eclass/qt4-r2.eclass +++ b/eclass/qt4-r2.eclass @@ -142,41 +142,11 @@ qt4-r2_src_install() { dodoc "${dir}/${doc}" || die "dodoc failed" done =20 - # install translations # hwoarang: Is this valid for every package??? + # install translations # need to have specified LANGS or LANGSLONG for this to work [[ -n ${LANGS} || -n ${LANGSLONG} ]] && prepare_translations } =20 -# Internal function, used by eqmake4 and qt4-r2_src_configure -# Look for project files: -# 0 *.pro files found - output null string -# 1 *.pro file found - output its name -# 2 or more *.pro files found - if ${PN}.pro or $(basename ${S}).pro -# are there, output any of them -# Outputs a project file argument used by eqmake4. Sets nullglob locally -# to avoid expanding *.pro as "*.pro" when there are no matching files. -_find_project_file() { - local dir_name=3D$(basename "${S}") - - eshopts_push -s nullglob - local pro_files=3D(*.pro) - eshopts_pop - - case ${#pro_files[@]} in - 1) - echo "${pro_files[0]}" - ;; - *) - for pro_file in "${pro_files[@]}"; do - if [[ ${pro_file} =3D=3D "${dir_name}.pro" || ${pro_file} =3D=3D "${P= N}.pro" ]]; then - echo "${pro_file}" - break - fi - done - ;; - esac -} - # @FUNCTION: eqmake4 # @USAGE: [project_file] [parameters to qmake] # @DESCRIPTION: @@ -295,27 +265,34 @@ eqmake4() { return 0 } =20 -# Internal function -_do_qm() { - debug-print-function $FUNCNAME "$@" - [[ $# -ne 2 ]] && die "$FUNCNAME requires exactly 2 arguments!" +# Internal function, used by eqmake4 and qt4-r2_src_configure. +# Outputs a project file name that can be passed to eqmake4. Sets nullgl= ob +# locally to avoid expanding *.pro as "*.pro" when there are no matching= files. +# 0 *.pro files found --> outputs null string +# 1 *.pro file found --> outputs its name +# 2 or more *.pro files found --> if ${PN}.pro or $(basename ${S}).pro +# are there, outputs any of them +_find_project_file() { + local dir_name=3D$(basename "${S}") =20 - local transfile=3D"$(find "${1}" -type f -name "*${2}".qm)" - if [[ -f ${transfile} ]]; then - ( - insinto /usr/share/${PN}/"${1#${S}}" - doins "${transfile}" - ) || die "failed to install ${2} translation" - else - eerror - eerror "Failed to install ${2} translation: file not found." - eerror - die "failed to install ${2} translation" - fi -} + eshopts_push -s nullglob + local pro_files=3D(*.pro) + eshopts_pop =20 -# @VARIABLE: TRANSLATIONSDIR -# @DESCRIPTION: Translations directory. If not set, ${S} will be used + case ${#pro_files[@]} in + 1) + echo "${pro_files[0]}" + ;; + *) + for pro_file in "${pro_files[@]}"; do + if [[ ${pro_file} =3D=3D "${dir_name}.pro" || ${pro_file} =3D=3D "${P= N}.pro" ]]; then + echo "${pro_file}" + break + fi + done + ;; + esac +} =20 # @FUNCTION: prepare_translations # @DESCRIPTION: @@ -324,22 +301,43 @@ _do_qm() { prepare_translations() { debug-print-function $FUNCNAME "$@" =20 + # @VARIABLE: TRANSLATIONSDIR + # @DESCRIPTION: Translations directory, defaults to ${S}. + local roottrdir=3D${TRANSLATIONSDIR:-${S}} + local trdir=3D. # Find translations directory - # Changed default to . - crazy upstreams :) - local roottrdir=3D"${TRANSLATIONSDIR:-${S}}" trdir=3D. for dir in lang langs translations; do - [[ -d ${roottrdir}/${dir} ]] && trdir=3D"${roottrdir}/${dir}" + [[ -d ${roottrdir}/${dir} ]] && trdir=3D${roottrdir}/${dir} done =20 local lang=3D for lang in ${LINGUAS}; do for x in ${LANGS}; do - [[ ${lang} =3D=3D ${x%_*} ]] && _do_qm "${trdir}" ${x} + [[ ${lang} =3D=3D ${x%_*} ]] && _do_qm "${trdir}" "${x}" done for x in ${LANGSLONG}; do - [[ ${lang} =3D=3D ${x} ]] && _do_qm "${trdir}" ${x} + [[ ${lang} =3D=3D ${x} ]] && _do_qm "${trdir}" "${x}" done done } =20 +# Internal function +_do_qm() { + debug-print-function $FUNCNAME "$@" + [[ $# -ne 2 ]] && die "$FUNCNAME() requires exactly 2 arguments!" + + local transfile=3D"$(find "${1}" -type f -name "*${2}".qm)" + if [[ -f ${transfile} ]]; then + ( + insinto /usr/share/${PN}/"${1#${S}}" + doins "${transfile}" + ) || die "failed to install ${2} translation" + else + eerror + eerror "Failed to install ${2} translation: file not found." + eerror + die "failed to install ${2} translation" + fi +} + EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_in= stall