Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 645754 - mozextension.eclass: incompatible with new JSON manifest
Summary: mozextension.eclass: incompatible with new JSON manifest
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords:
: 645636 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-01-25 18:42 UTC by Manuel Ullmann
Modified: 2018-01-26 23:01 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel Ullmann 2018-01-25 18:42:03 UTC
firefox-58* can’t be emerged with L10N!="", because XPI files contain a manifest file in json format now. The regexp in xpi_install() has to be adapted.
I’ve prepared a PR and will reference this one.

Reproducible: Always

Related.
Bug: https://bugs.gentoo.org/645636
Comment 1 Ian Stakenvicius (RETIRED) gentoo-dev 2018-01-25 19:03:08 UTC
*** Bug 645636 has been marked as a duplicate of this bug. ***
Comment 2 Ian Stakenvicius (RETIRED) gentoo-dev 2018-01-25 19:03:50 UTC
Working on it.
Comment 3 Larry the Git Cow gentoo-dev 2018-01-25 19:20:36 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c612e2880512912ec76b414deb8d13fbcc40e190

commit c612e2880512912ec76b414deb8d13fbcc40e190
Author:     Ian Stakenvicius <axs@gentoo.org>
AuthorDate: 2018-01-25 19:18:09 +0000
Commit:     Ian Stakenvicius <axs@gentoo.org>
CommitDate: 2018-01-25 19:20:29 +0000

    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(-)}
Comment 4 Ian Stakenvicius (RETIRED) gentoo-dev 2018-01-25 19:21:13 UTC
Initial support committed; this may change as I haven't done enough validaiton checks to confirm it's the final version, but at least it will allow firefox-58's langpacks to install.
Comment 5 Manuel Ullmann 2018-01-25 19:33:24 UTC
Oops, I’ve seen this too late. Did you create new eclass versions? Otherwise this probably breaks firefox-52*.
PRs opened:
https://github.com/gentoo/gentoo/pull/6958
https://github.com/gentoo/gentoo/pull/6957
Close them as you prefer.
Comment 6 Manuel Ullmann 2018-01-25 19:42:51 UTC
Ah, I have seen the version check.
My regexp is probably more robust.
You could use:

sed -n -re '/"gecko": \{/,/ +\},/{/"id": /{s/^ +"id": "(.*)", *$/\1/p; q}}' "${x}"/manifest.json)"

to constrain the regexp a little bit more. This uses cascading addresses to prevent multiple id matches and prevents anything else from slipping in.
Comment 7 Manuel Ullmann 2018-01-25 20:45:45 UTC
Other PRs closed.
If you prefer that regexp, you could merge PR #6959.
https://github.com/gentoo/gentoo/pull/6959
Robustness obviously depends on the grade of upstream insanity. As a maintainer, you probably can predict them better.

Best regards,
Manuel
Comment 8 Ian Stakenvicius (RETIRED) gentoo-dev 2018-01-25 21:27:40 UTC
(In reply to Manuel Ullmann from comment #7)
> Other PRs closed.
> If you prefer that regexp, you could merge PR #6959.
> https://github.com/gentoo/gentoo/pull/6959
> Robustness obviously depends on the grade of upstream insanity. As a
> maintainer, you probably can predict them better.
> 
> Best regards,
> Manuel

Yeah that's essentially why I haven't closed this bug yet -- I need to evaluate the regex or possibly even switch to a different tool to extract the id; not to mention making sure that what we are doing with this id (or that we are extracting the xpi at all) is actually what we should be doing.
Comment 9 Larry the Git Cow gentoo-dev 2018-01-26 04:28:10 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=39aa655a9a53a215c146027487168ad4a1f9fc72

commit 39aa655a9a53a215c146027487168ad4a1f9fc72
Author:     Ian Stakenvicius <axs@gentoo.org>
AuthorDate: 2018-01-25 22:01:13 +0000
Commit:     Ian Stakenvicius <axs@gentoo.org>
CommitDate: 2018-01-25 22:01:13 +0000

    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(-)}
Comment 10 Manuel Ullmann 2018-01-26 14:25:39 UTC
Hm, not bad. This works as long as the id property is unique in the manifest. My addresses constrained it to the gecko subsection. It is arguable though, that the id, that we look for, could be moved into other section or gecko could be renamed.
However, in that case we might have to review the eclasses anyway, because other things likely might have been broken as well.
The sed address ranges are non-greedy, so it is easy to select a single json section. My cascading id address was unnecessary, because properties have to be unique in a section.
Which gives me:
emid="$( sed -n '/"gecko": \{/,/ +\},/{s/.*"id": "\(.*\)",/\1/p}'  ${x}"/manifest.json )" \
The previous eclass version solved this by exiting sed on the first match (p; q) assuming that the first match would be the id, it looks for.
See info sed address, if you are not familiar with sed addresses.