Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: xartoc.xml.tmpl

Issue 29349885: Issue 4340 - Drop dependency on external xar tool (Closed)
Patch Set: Added template for ToC generation and rebased Created Aug. 17, 2016, 10:04 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« xarfile.py ('K') | « xarfile.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xartoc.xml.tmpl
===================================================================
new file mode 100644
--- /dev/null
+++ b/xartoc.xml.tmpl
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ - This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ -->
+
+{% macro file(data) %}
Sebastian Noack 2016/08/17 12:53:45 Why a macro? Couldn't you simply nest the code bel
Sebastian Noack 2016/08/17 18:41:33 What is about this comment?
Wladimir Palant 2016/08/17 18:52:18 How so? It's recursive.
Sebastian Noack 2016/08/17 18:58:46 Sorry, you are right. (But mind the other two comm
+<file id="{{data.id}}">
+ <name>{{data.name}}</name>
+ <type>{{data.type}}</type>
+ <mode>{{data.mode}}</mode>
+ {% if data.type == 'directory' %}
+ {% for f in data.children %}
+ {{file(f)}}
+ {% endfor %}
+ {% else %}
+ <data>
+ <archived-checksum style="sha1">{{data.checksum_compressed}}</archived-checksum>
+ <extracted-checksum style="sha1">{{data.checksum_uncompressed}}</extracted-checksum>
+ <encoding style="application/x-gzip"/>
+ <size>{{data.size_uncompressed}}</size>
+ <offset>{{data.offset}}</offset>
+ <length>{{data.size_compressed}}</length>
+ </data>
+ {% endif %}
+</file>
+{% endmacro %}
+
+<xar>
+ <toc>
+ <signature-creation-time>{{timestamp_numerical}}</signature-creation-time>
+ <checksum style="sha1">
+ <offset>{{checksum.offset}}</offset>
+ <size>{{checksum.size}}</size>
+ </checksum>
+ <creation-time>{{timestamp_iso}}</creation-time>
+ <signature style="RSA">
+ <offset>{{signature.offset}}</offset>
+ <size>{{signature.size}}</size>
+ <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
+ <X509Data>
+ {% for certificate in certificates %}
+ <X509Certificate>{{certificate}}</X509Certificate>
+ {% endfor %}
+ </X509Data>
+ </KeyInfo>
+ </signature>
+ {% for f in files %}
+ {{file(f)}}
+ {% endfor %}
+ </toc>
+</xar>
« xarfile.py ('K') | « xarfile.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld