commit:     c612e2880512912ec76b414deb8d13fbcc40e190
Author:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 25 19:18:09 2018 +0000
Commit:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
CommitDate: Thu Jan 25 19:20:29 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c612e288

mozextension.eclass: initial support for manifest.json exensions

Thanks to Sven B. for some initial legwork on this.  Work is not complete as
the extension installations should somehow also auto-validate themselves, but
it will at least prevent bugs such as bug 645636

Bug: http://bugs.gentoo.org/645754

 eclass/mozextension.eclass | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/eclass/mozextension.eclass b/eclass/mozextension.eclass
index 9d22166e9d7..425da7e85bf 100644
--- a/eclass/mozextension.eclass
+++ b/eclass/mozextension.eclass
@@ -69,10 +69,18 @@ xpi_install() {
        [[ ${#} -ne 1 ]] && die "$FUNCNAME takes exactly one argument, please 
specify an xpi to unpack"
 
        x="${1}"
-       cd ${x}
+       #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"
+               || 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%/}/${emid}
        elif $(mozversion_extension_location) ; then

Reply via email to