-
Notifications
You must be signed in to change notification settings - Fork 538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increment the version in install.rdf when we mass sign the add-on (bug 1135139) #463
Increment the version in install.rdf when we mass sign the add-on (bug 1135139) #463
Conversation
a37b12d
to
2e851c1
Compare
Why do you believe that |
If we're going to go the I think the best approach is to change any |
Regarding rdflib, i'm following the advice from @joernhees who said that even with the fix, there's this issue with the Bnode inserted, and thus the serialized result may be all broken. Haven't tried though. I'll give it a try with your xpath, thanks a lot for the feedback! |
Not exactly, my rationale was mostly compatibility concerns... The thing with rdflib here will be that you are using a very old version of RDF/XML as install.rdf template. The fixes make rdflib able to parse it again, but serializing will create a more up to date RDF/XML format. That output will be correct RDF/XML, but it will probably look quite different (order-wise as RDF is a graph, nesting-wise as the serializer prefers less nested elements, BNode-wise as the the serializer introduces local identifiers...). As far as i understood you can't easily change the install.rdf template, much less all extensions that used it. Further, as was mentioned to me, many other things might depend on the current install.rdf (maybe with their own rdf parsers, xml parsers or even regexps). That's why in this "round-tripping" case with minimal changes to the version element i recommend an xml parser. This should allow you to only modify the one element you're after, leave the order and structure of the xml intact and have minimal / no impact on legacy code. |
Different format isn't a problem. Lots of extensions use machine-generated RDF XML in a similar format. As long as the data is the same, it's not an issue. |
2e851c1
to
ae3b4d6
Compare
@kmaglione I made the code a bit more generic as you suggested. |
# that has the "em:version" attribute if it's the alternate format. | ||
node = tree.xpath( | ||
'//em:version | //*[@em:version]', | ||
namespaces={'em': 'http://www.mozilla.org/2004/em-rdf#'})[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd rather this be a for
loop just in case there are extra em:version nodes.
The new XML code looks good to me, aside from the minor comments. But the version number bumping code definitely needs to change. We already have code for dealing with toolkit versions in |
ae3b4d6
to
e7b04a6
Compare
e7b04a6
to
162dc4e
Compare
According to https://bugzilla.mozilla.org/show_bug.cgi?id=1135139 we're good to merge on this one now? |
162dc4e
to
ef60d4a
Compare
I think so. Everything looks good to me. |
…t-signing Increment the version in install.rdf when we mass sign the add-on (bug 1135139)
Fixes bug 1135139
Following several discussions with @kmaglione and @joernhees (from RDFLib/rdflib#468), I believe we can't reliably use rdflib in this case. I've thus given a try to
lxml.etree
.Here's the diff on the two different install.rdf formats that I know of (left is the file I got from XPI files, the right is the result of the
_bump_version_in_install_rdf method
):"standard" (most common) install.rdf:

"alternate" (deprecated?) install.rdf (the indentation is mine, the end result put each node on a single line):
