commit:     07a7c23b7d497d5e0566570fc655063140774b40
Author:     Andreas Sturmlechner <andreas.sturmlechner <AT> gmail <DOT> com>
AuthorDate: Wed Sep 16 18:47:58 2015 +0000
Commit:     Manuel Rüger <mrueg <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 14:05:25 2015 +0000
URL:        https://gitweb.gentoo.org/proj/kde.git/commit/?id=07a7c23b

kde-apps/kde4-l10n: Finally fix USE=-minimal

Be more verbose about what is being copied or removed.
Merge everything from LEGACY_LANGS, not just messages.
Take care of nonexistent directories in destination paths.
Fixes https://bugs.gentoo.org/show_bug.cgi?id=560336

Package-Manager: portage-2.2.20.1

 kde-apps/kde4-l10n/kde4-l10n-15.08.1.ebuild | 44 ++++++++++++++++++++---------
 1 file changed, 30 insertions(+), 14 deletions(-)

diff --git a/kde-apps/kde4-l10n/kde4-l10n-15.08.1.ebuild 
b/kde-apps/kde4-l10n/kde4-l10n-15.08.1.ebuild
index ef80763..49d9885 100644
--- a/kde-apps/kde4-l10n/kde4-l10n-15.08.1.ebuild
+++ b/kde-apps/kde4-l10n/kde4-l10n-15.08.1.ebuild
@@ -66,11 +66,12 @@ src_unpack() {
 }
 
 src_prepare() {
-       local LNG DIR SDIR
+       local LNG DIR LDIR SDIR
        # add all linguas to cmake
        if [[ -n ${A} ]]; then
                for LNG in ${LINGUAS}; do
                        DIR="${KMNAME}-${LNG}-${PV}"
+                       LDIR="${KMNAME}-${LNG}-${LV}"
                        SDIR="${S}/${DIR}/4/${LNG}"
                        if [[ -d "${DIR}" ]] ; then
                                echo "add_subdirectory( ${DIR} )" >> 
"${S}"/CMakeLists.txt
@@ -80,12 +81,12 @@ src_prepare() {
 
                                # Drop translations installed with plasma 5 and 
kde-apps 5 packages
                                if use minimal; then
-                                       einfo "Removing paths from ${LNG}"
-                                       if [[ -d "${KMNAME}-${LNG}-${LV}" ]] ; 
then
-                                               rm -rf "${KMNAME}-${LNG}-${LV}"
+                                       einfo "${LNG}: Removing file conflicts"
+                                       if [[ -d "${LDIR}" ]] ; then
+                                               rm -rf "${LDIR}"
                                        fi
 
-                                       # Remove dirs
+                                       einfo "   directories..."
                                        while read path; do
                                                if [[ -n ${path} && -e 
"${SDIR}"/${path%\ *}/CMakeLists.txt ]] ; then
                                                        sed -e ":${path#*\ }: 
s:^:#:"\
@@ -93,7 +94,7 @@ src_prepare() {
                                                fi
                                        done < <(grep -v "^#" "${REMOVE_DIRS}")
 
-                                       # Remove messages
+                                       einfo "   messages..."
                                        for path in $(grep -v "^#" 
"${REMOVE_MSGS}") ; do
                                                rm -f "${SDIR}"/messages/${path}
                                                # Quirk for LINGUAS=sr variants
@@ -102,16 +103,31 @@ src_prepare() {
                                                fi
                                        done
                                else
-                                       if [[ -d "${KMNAME}-${LNG}-${LV}" ]] ; 
then
-                                               # Do not try to copy kdepim 
localisation
-                                               for path in kdepim kdepimlibs 
kdepim-runtime; do
-                                                       rm -rf 
"${KMNAME}-${LNG}-${LV}/messages/${path}" || die
+                                       if [[ -d "${LDIR}" ]] ; then
+                                               einfo "${LNG}: Adding legacy 
localisation"
+                                               local dest_path
+                                               # Step through directories 
alphabetically first
+                                               for path in $(ls -R "${LDIR}" | 
grep ":$" | sed -e 's/:$//') ; do
+                                                       
dest_path="${path/${LV}/${PV}/4/${LNG}}"
+                                                       if [[ ! -d 
"${dest_path}" ]] ; then
+                                                               einfo "   
$(basename ${dest_path}) subdirectory"\
+                                                                       "added 
to $(basename $(dirname ${dest_path}))"
+                                                               mkdir 
"${dest_path}" || die "Failed creating ${dest_path}"
+                                                               echo 
"add_subdirectory($(basename ${dest_path}))" >> \
+                                                                       
$(dirname "${dest_path}")/CMakeLists.txt
+                                                       fi
                                                done
-                                               # Merge legacy localisation
-                                               for path in $(find 
"${KMNAME}-${LNG}-${LV}" -name "*.po"); do
-                                                       cp -rn "${path}" 
"${path/${LV}/${PV}/4/${LNG}}" || die
+                                               einfo "   merging legacy 
localisation..."
+                                               for path in $(find "${LDIR}" 
-type f) ; do
+                                                       
dest_path="${path/${LV}/${PV}/4/${LNG}}"
+                                                       cp -rn "${path}" 
"${dest_path}" || die "Failed copying ${path}"
                                                done
-                                               rm -rf "${KMNAME}-${LNG}-${LV}"
+                                               # Disable kdepim
+                                               for path in kdepim kdepimlibs 
kdepim-runtime ; do
+                                                       find "${SDIR}" -name 
CMakeLists.txt -type f -exec \
+                                                               sed -i -e "s:^ 
*add_subdirectory( *${path} *):# no ${path}:g" {} +
+                                               done
+                                               rm -rf "${LDIR}"
                                        fi
                                fi
                        fi

Reply via email to