summaryrefslogtreecommitdiff
path: root/app-office/libreoffice-l10n/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /app-office/libreoffice-l10n/files
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'app-office/libreoffice-l10n/files')
-rw-r--r--app-office/libreoffice-l10n/files/lo_gen_langs.sh65
1 files changed, 65 insertions, 0 deletions
diff --git a/app-office/libreoffice-l10n/files/lo_gen_langs.sh b/app-office/libreoffice-l10n/files/lo_gen_langs.sh
new file mode 100644
index 000000000000..baafa56cfe2b
--- /dev/null
+++ b/app-office/libreoffice-l10n/files/lo_gen_langs.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Licensed under the GNU General Public License, v2
+
+#
+# Author: Ralph Sennhauser
+#
+# Find l10n packs for libreoffice and format it for use in ebuilds.
+#
+
+VERSION=${1:-4.1.5}
+BASE_SRC_URI="http://download.documentfoundation.org/libreoffice/stable/${VERSION}/rpm/x86"
+
+# needs lxml
+print_available_tarballs() {
+ python << EOL
+import sys, urllib
+from xml.dom.minidom import parseString
+from BeautifulSoup import BeautifulSoup
+
+opener = urllib.urlopen("${BASE_SRC_URI}")
+html = opener.read()
+opener.close()
+# broken html, try to sanitize
+html = BeautifulSoup(html).prettify()
+
+dom = parseString(html)
+for elem in dom.getElementsByTagName('a'):
+ attr = elem.getAttribute("href")
+ if attr.endswith('tar.gz'):
+ if "install" in attr: continue
+ print(attr)
+EOL
+}
+
+tarballs=( $(print_available_tarballs) )
+help_packs=()
+lang_packs=()
+lang_packs_reduced=()
+
+for tb in "${tarballs[@]}"; do
+ pack=${tb%.tar.gz}
+ pack=${pack##*rpm_}
+ pack=${pack/en-US/en}
+ pack=${pack/-/_}
+ pack=${pack/en-US/en}
+ if [[ ${tb} =~ helppack ]]; then
+ pack=${pack/helppack_/}
+ help_packs+=( ${pack} )
+ elif [[ ${tb} =~ langpack ]]; then
+ pack=${pack/langpack_/}
+ lang_packs+=( ${pack} )
+ fi
+done
+
+for lpack in "${lang_packs[@]}"; do
+ for hpack in "${help_packs[@]}"; do
+ if [[ ${hpack} == ${lpack} ]]; then
+ continue 2
+ fi
+ done
+ lang_packs_reduced+=( ${lpack} )
+done
+
+echo "LANGUAGES_HELP=\" ${help_packs[@]} \""
+echo "LANGUAGES=\"\${LANGUAGES_HELP}${lang_packs_reduced[@]} \""