Lars, one solution is to use the exec task and call the zip system file (I
work on OS X and Linux, your mileage may vary)
<target name="epub-zip">
<!-- We use exec zip because I can't figure out if the builtin zip task
conforms to what ePub expects -->
<!-- Zip the mimetype first without compression as required-->
<exec executable="zip">
<arg line="-X0 ${src_file}.epub mimetype"/>
</exec>
<!-- Then zip the other files into the zip/epub archive -->
<exec executable="zip">
<arg line="-r -X9 ${src_file}.epub META-INF OEBPS"/>
</exec>
</target>
Hope this helps
On Mon, Feb 17, 2014 at 9:15 AM, Lars Vogel <[email protected]> wrote:
> Hi,
>
> maybe the first line in my zip task was misleading, I created temp.mimetype.
> If I adjust it to use the file name you suggest it does not make a
> difference.
>
>
> <zip destfile="${output.dir}/mimetype.zip" basedir="${output.dir}/tmp"
> compress="false" includes="mimetype" />
> <zip destfile="${output.dir}/temp.zip" basedir="${output.dir}/tmp/"
> level="9" compress="true" excludes="mimetype" includes="OEBPS/**
> META-INF/**" />
> <!-- Missing option to add -X as parameter -->
> <zip destfile="${output.dir}/book.epub" update="true"
> keepcompression="true" encoding="UTF-8" excludes="*.html">
> <zipfileset src="${output.dir}/mimetype.zip" />
> <zipfileset src="${output.dir}/temp.zip" />
> </zip>
>
> I read in Bobs description for epub3 (
> http://sourceforge.net/projects/docbook/files/epub3/) that I need to
> specify -X for the Ant task to avoid this error. Is this something I can do
> with the Apache Ant task?
>
> Best regards, Lars
>
>
> 2014-02-17 17:50 GMT+01:00 Nils Cordes <[email protected]>:
>
> Hi Lars,
>>
>> I had the same issue and fixed it that way.
>>
>> See the comment of Matt Garrish at
>> http://idpf.org/comment/370#comment-370
>> "When you zip your EPUB, the mimetype file must be the first one you add
>> (mimetype == 8 characters)."
>>
>> Ciao
>>
>> Nils
>>
>>
>> Nils Cordes
>> Plesser Str. 11
>> 12435 Berlin
>> Deutschland
>> Telefon: +49 176 10091551
>> E-Mail: [email protected]
>> Web: http://nilscordes.de
>>
>>
>>
>> 2014-02-17 17:33 GMT+01:00 Lars Vogel <[email protected]>:
>>
>> Hi Nils,
>>>
>>> This is IMHI correct, I create it in the first step. Also this seems to
>>> be unrelated to the error message.
>>>
>>> Best regards, Lars
>>> Am 17.02.2014 17:28 schrieb "Nils Cordes" <[email protected]>:
>>>
>>>> Hey Lars,
>>>>
>>>> I think there is an error in the zip part of your Ant buildfile. Try to
>>>> change "temp.mimetype" to "mimetype.zip".
>>>>
>>>> <zip destfile="${output.dir}/mimetype.zip" ...
>>>> <zipfileset src="${output.dir}/mimetype.zip" ...
>>>>
>>>> Best regards
>>>>
>>>> Nils
>>>>
>>>>
>>>>
>>>> 2014-02-17 16:32 GMT+01:00 Lars Vogel <[email protected]>:
>>>>
>>>>> Hi,
>>>>>
>>>>> I'm generating epub from Docbook via Apache Ant and I'm getting the
>>>>> following error during the validation with Epubcheck.
>>>>>
>>>>> [java] Epubcheck Version 3.0ERROR:
>>>>> /home/vogella/workspace/docu/de.vogella.publishing/../output/epub/book.epub:
>>>>> Extra field length for first filename must be 0, but was 20
>>>>>
>>>>> Any suggestion what might be causing the error.
>>>>>
>>>>> I generate the epub via the following snippet (see below).
>>>>>
>>>>> Thanks for any help, Lars
>>>>>
>>>>> <target name="build-epub_eclipsercp" description="Generates EPUB
>>>>> files from DocBook XML">
>>>>> <xslt style="${epub.stylesheet}" extension=".html"
>>>>> basedir="${output.dir}/tmp2" destdir="${output.dir}/tmp">
>>>>> <include name="*80_Book_Eclipse_RCP*/*book.xml" />
>>>>> <param name="epub.stylesheet" expression="style.css" />
>>>>> <param name="html.stylesheet" expression="${stylesheet}" />
>>>>> <param name="section.autolabel" expression="1" />
>>>>> <param name="chapter.autolabel" expression="1" />
>>>>> <param name="show.comments" expression="0" />
>>>>> <param name="section.autolabel.max.depth" expression="1" />
>>>>> <param name="toc.section.depth" expression="1" />
>>>>> <param name="section.label.includes.component.label" expression="1"
>>>>> />
>>>>> <param name="make.valid.html" expression="1" />
>>>>> <param name="html.cleanup" expression="1" />
>>>>> <param name="chunker.output.encoding" expression="UTF-8" />
>>>>> <param name="ignore.image.scaling" expression="1" />
>>>>> <outputproperty name="indent" value="yes" />
>>>>> <classpath refid="saxon.class.path" />
>>>>> </xslt>
>>>>>
>>>>> <copy todir="${output.dir}/tmp/OEBPS">
>>>>> <fileset dir="OEBPS">
>>>>> </fileset>
>>>>> </copy>
>>>>>
>>>>> <copy todir="${output.dir}/tmp/META-INF">
>>>>> <fileset dir="META-INF">
>>>>> </fileset>
>>>>> </copy>
>>>>>
>>>>> <!-- Don't know how to avoid genereation of "${destfilename}.html" by
>>>>> Saxon -->
>>>>> <delete file="${output.dir}/tmp/book.html" />
>>>>>
>>>>> <echo message="Generating book.epub" level="info" />
>>>>>
>>>>> <!-- We create temporary zips so that minetype is the first one in the
>>>>> final zip -->
>>>>> <zip destfile="${output.dir}/temp.mimetype"
>>>>> basedir="${output.dir}/tmp" compress="false" includes="mimetype" />
>>>>> <zip destfile="${output.dir}/temp.zip" basedir="${output.dir}/tmp/"
>>>>> level="9" compress="true" excludes="mimetype" includes="OEBPS/**
>>>>> META-INF/**" />
>>>>> <zip destfile="${output.dir}/book.epub" update="true"
>>>>> keepcompression="true" encoding="UTF-8" excludes="*.html">
>>>>> <zipfileset src="${output.dir}/temp.mimetype" />
>>>>> <zipfileset src="${output.dir}/temp.zip" />
>>>>> </zip>
>>>>>
>>>>> <!-- Have to delete these directories would be nicer to place then in
>>>>> tmp output dir
>>>>> <delete dir="./OEBPS" />
>>>>> <delete dir="./META-INF" />
>>>>> -->
>>>>>
>>>>> <!-- Make sure the epubcheck lib has a subfolder lib with saxon.jar
>>>>> and jing.jar in it
>>>>> -->
>>>>> <epub.check epub="book" />
>>>>>
>>>>> </target>
>>>>>
>>>>>
>>>>
>>
>