From 52716463ca346792b17cb994b9cf77639def040d Mon Sep 17 00:00:00 2001 From: Ian Stakenvicius Date: Fri, 7 Sep 2018 19:11:43 +0200 Subject: www-client/firefox: install language packs as XPI file Unpacked extensions are no longer supported. [Link 1] Link 1: https://blog.mozilla.org/addons/2018/02/22/removing-support-unpacked-extensions/ Closes: https://bugs.gentoo.org/665352 Package-Manager: Portage-2.3.49, Repoman-2.3.10 --- eclass/mozextension.eclass | 30 ++++++++++++++++++++++++++++++ eclass/mozlinguas-v2.eclass | 14 ++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) (limited to 'eclass') diff --git a/eclass/mozextension.eclass b/eclass/mozextension.eclass index 425da7e85bf1..68f401ee8661 100644 --- a/eclass/mozextension.eclass +++ b/eclass/mozextension.eclass @@ -91,5 +91,35 @@ xpi_install() { doins -r "${x}"/* || die "failed to copy extension" } +xpi_copy() { + local emid + + # You must tell xpi_install which xpi to use + [[ ${#} -ne 1 ]] && die "$FUNCNAME takes exactly one argument, please specify an xpi to unpack" + + x="${1}" + #cd ${x} + # determine id for extension + if [[ -f "${x}"/install.rdf ]]; then + emid="$(sed -n -e '/install-manifest/,$ { /em:id/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' "${x}"/install.rdf)" \ + || die "failed to determine extension id from install.rdf" + elif [[ -f "${x}"/manifest.json ]]; then + emid="$( sed -n 's/.*"id": "\([^"]*\)",.*/\1/p' "${x}"/manifest.json )" \ + || die "failed to determine extension id from manifest.json" + else + die "failed to determine extension id" + fi + + if [[ -n ${MOZEXTENSION_TARGET} ]]; then + insinto "${MOZILLA_FIVE_HOME}"/${MOZEXTENSION_TARGET%/} + elif $(mozversion_extension_location) ; then + insinto "${MOZILLA_FIVE_HOME}"/browser/extensions + else + insinto "${MOZILLA_FIVE_HOME}"/extensions + fi + + newins "${DISTDIR%/}"/${x##*/}.xpi ${emid}.xpi +} + _MOZEXTENSION=1 fi diff --git a/eclass/mozlinguas-v2.eclass b/eclass/mozlinguas-v2.eclass index 77f1d0a439cf..73576e967fa6 100644 --- a/eclass/mozlinguas-v2.eclass +++ b/eclass/mozlinguas-v2.eclass @@ -124,13 +124,18 @@ esac # shouldn't (ie it is an alpha or beta package) : ${MOZ_FORCE_UPSTREAM_L10N:=""} - # @ECLASS-VARIABLE: MOZ_TOO_REGIONALIZED_FOR_L10N # @INTERNAL # @DESCRIPTION: # Upstream identifiers that should not contain region subtags in L10N MOZ_TOO_REGIONALIZED_FOR_L10N=( fy-NL ga-IE gu-IN hi-IN hy-AM nb-NO nn-NO pa-IN sv-SE ) +# @ECLASS-VARIABLE: MOZ_INSTALL_L10N_XPIFILE +# @DESCRIPTION: +# Install langpacks as .xpi file instead of unpacked directory. +# Leave unset to install unpacked +: ${MOZ_INSTALL_L10N_XPIFILE:=""} + # Add l10n_* to IUSE according to available language packs # No language packs for alphas and betas if ! [[ -n ${MOZ_GENERATE_LANGPACKS} ]] ; then @@ -365,8 +370,13 @@ mozlinguas_src_install() { done popd > /dev/null || die fi + for x in "${mozlinguas[@]}"; do - xpi_install "${WORKDIR}/${MOZ_P}-${x}${MOZ_LANGPACK_UNOFFICIAL:+.unofficial}" + if [[ -n ${MOZ_INSTALL_L10N_XPIFILE} ]]; then + xpi_copy "${WORKDIR}/${MOZ_P}-${x}${MOZ_LANGPACK_UNOFFICIAL:+.unofficial}" + else + xpi_install "${WORKDIR}/${MOZ_P}-${x}${MOZ_LANGPACK_UNOFFICIAL:+.unofficial}" + fi done } -- cgit v1.2.3-65-gdbad