You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Kerry, Richard" <ri...@atos.net> on 2013/06/14 12:04:58 UTC

Use of Ant's zip task - ensuring file order follows the rules for Epub3


Does anyone have experience of Ant's zip task - in particular for building epub3 documents  ?



One of the rules for epub3 is that the mimetype file comes first.  It appears that this can't be enforced using Ant's zip task.  Does anyone know if there is any way of making this work ?  Or do I need to call out to an external application ?  (ie infozip's zip.exe.  7-zip doesn't appear to do it either).





Regards,

Richard.











Richard Kerry
BNCS Engineer
T: +44 (0)20 82259063
M: +44 (0)7812 325518
Room EBX 301, BBC Television Centre, Wood Lane, London, W12 7RJ
richard.kerry@atos.net<https://webmail.siemens-it-solutions.com/owa/redir.aspx?C=9fb20d019e3e4cb99344d708709a3177&URL=mailto%3arichard.kerry%40atos.net>
uk.atos.net<https://webmail.siemens-it-solutions.com/owa/redir.aspx?C=9fb20d019e3e4cb99344d708709a3177&URL=http%3a%2f%2fuk.atos.net%2fen-uk%2f>

This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable

RE: Use of Ant's zip task - ensuring file order follows the rules for Epub3

Posted by "Kerry, Richard" <ri...@atos.net>.

I've had an answer from someone on the Docbook mailing list (which is the context within which I need to do this task).



The answer is to generate a separate zip-file containing only the file that must come first.

Then the other files and directories are added to it.  (Most of the rest of the data is in directories, so the answer below would appear not to be applicable as it appears to require files only)



The example I've based mine on is at http://inasmuch.as/2010/12/10/ant-for-epub/.



To be more complete, two zip files are created, one containing only the "mimetype" file and the other containing the rest.  These two can then be merged, creating one file with the requirements as stated.



(Also the "mimetype" file must not be compressed.  This tends to happen anyway, probably due to its very small size (21 characters), but it's good to be able to specify it to ensure this is done)



Regards,

Richard.



Richard Kerry
BNCS Engineer
T: +44 (0)20 82259063
M: +44 (0)7812 325518
Room EBX 301, BBC Television Centre, Wood Lane, London, W12 7RJ
richard.kerry@atos.net<https://webmail.siemens-it-solutions.com/owa/redir.aspx?C=9fb20d019e3e4cb99344d708709a3177&URL=mailto%3arichard.kerry%40atos.net>
uk.atos.net<https://webmail.siemens-it-solutions.com/owa/redir.aspx?C=9fb20d019e3e4cb99344d708709a3177&URL=http%3a%2f%2fuk.atos.net%2fen-uk%2f>

This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable
________________________________
From: Stefan Bodewig [bodewig@apache.org]
Sent: 14 June 2013 13:09
To: user@ant.apache.org
Subject: Re: Use of Ant's zip task - ensuring file order follows the rules for Epub3


On 2013-06-14, Kerry, Richard wrote:

> Does anyone have experience of Ant's zip task - in particular for
> building epub3 documents ?

Not for building epub3 documents but I know a thing about the task or
two :-)

> One of the rules for epub3 is that the mimetype file comes first.  It
> appears that this can't be enforced using Ant's zip task.  Does anyone
> know if there is any way of making this work ?  Or do I need to call
> out to an external application ?  (ie infozip's zip.exe.  7-zip
> doesn't appear to do it either).

Ant will always add directory entries before file entries unless you set
filesonly to true.  Without that you don't have any chance unless the
files you need first are in the top level directory.

If you don't need directories or the special files all live inside the
top level dir it should work if you specify the files that need specific
order explicitly in a filelist (which preserves order) or file resources
before specifying any filesets.

Something like

<zip filesonly="true" ...>
  <file file="mime-type-thingy"/>
  <fileset dir="where your content is">
    <exclude name="mime-type-thingy"/>
  </fileset>
</zip>

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org

Re: Use of Ant's zip task - ensuring file order follows the rules for Epub3

Posted by Stefan Bodewig <bo...@apache.org>.
On 2013-06-14, Kerry, Richard wrote:

> Does anyone have experience of Ant's zip task - in particular for
> building epub3 documents ?

Not for building epub3 documents but I know a thing about the task or
two :-)

> One of the rules for epub3 is that the mimetype file comes first.  It
> appears that this can't be enforced using Ant's zip task.  Does anyone
> know if there is any way of making this work ?  Or do I need to call
> out to an external application ?  (ie infozip's zip.exe.  7-zip
> doesn't appear to do it either).

Ant will always add directory entries before file entries unless you set
filesonly to true.  Without that you don't have any chance unless the
files you need first are in the top level directory.

If you don't need directories or the special files all live inside the
top level dir it should work if you specify the files that need specific
order explicitly in a filelist (which preserves order) or file resources
before specifying any filesets.

Something like

<zip filesonly="true" ...>
  <file file="mime-type-thingy"/>
  <fileset dir="where your content is">
    <exclude name="mime-type-thingy"/>
  </fileset>
</zip>

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org