buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antoine Toulme (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (BUILDR-533) Reading the manifest without building the zip index
Date Tue, 12 Oct 2010 14:17:32 GMT

     [ https://issues.apache.org/jira/browse/BUILDR-533?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Antoine Toulme resolved BUILDR-533.
-----------------------------------

    Resolution: Duplicate

Dup for BUILDR-524.

> Reading the manifest without building the zip index
> ---------------------------------------------------
>
>                 Key: BUILDR-533
>                 URL: https://issues.apache.org/jira/browse/BUILDR-533
>             Project: Buildr
>          Issue Type: Improvement
>          Components: Packaging
>    Affects Versions: 1.4.2
>            Reporter: Antoine Toulme
>            Assignee: Antoine Toulme
>             Fix For: 1.4.3
>
>
> When accessing the MANIFEST file in a jar, the convention in the java world is that it
should be the first entry. Actually, quite a few systems will just not work if the MANIFEST.MF
file is not the first entry.
> The way we currently access the MANIFEST file is suboptimal as we parse the whole zip,
and spend time to build the index. Worse, we run into issues quickly with corrupted zips (we
found out Maven3 could also produce some of those, not just Buildr :)).
> Hugues Malphettes provided an other way to access the MANIFEST.MF without building the
complete index.
> Around line 58 of packaging.rb
> # :call-seq:
> #   from_zip(file) => manifest
> #
> # Parse the MANIFEST.MF entry of a ZIP (or JAR) file and return a new Manifest.
> def from_zip(file)
>  Zip::ZipInputStream::open(file.to_s) { |io|
>    while (entry = io.get_next_entry)
>      if entry.name == 'META-INF/MANIFEST.MF'
>        return Manifest.parse io.read rescue Manifest.new
>      end
>    end
>  }
>  return Manifest.new
> #            Zip::ZipFile.open(file.to_s) do |zip|
> #              Manifest.parse zip.read('META-INF/MANIFEST.MF') rescue
> Manifest.new
> #            end
> end

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message