www-client/firefox: install language packs as XPI file
authorIan Stakenvicius <axs@gentoo.org>
Fri, 7 Sep 2018 17:11:43 +0000 (19:11 +0200)
committerThomas Deutschmann <whissi@gentoo.org>
Fri, 7 Sep 2018 17:15:31 +0000 (19:15 +0200)
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
eclass/mozlinguas-v2.eclass
www-client/firefox/firefox-62.0-r1.ebuild

index 425da7e85bf1af983c0af969d1b848d036b59be3..68f401ee866178d1b05bb6a25ea46716943c6ec4 100644 (file)
@@ -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
index 77f1d0a439cffb99bc05419546ccc7b9a0c2a3bb..73576e967fa6e0c328a8c0459360da5a7085f45e 100644 (file)
@@ -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
 }
 
index bebe61b439c54f1edfa98ae2dcf3409b6e353836..6f2ad021ba7d9e7d62ca862a093c44b70daf9971 100644 (file)
@@ -439,7 +439,7 @@ src_install() {
        DESTDIR="${D}" ./mach install
 
        # Install language packs
-       mozlinguas_src_install
+       MOZ_INSTALL_L10N_XPIFILE="1" mozlinguas_src_install
 
        local size sizes icon_path icon name
        if use bindist; then