diff options
author | Nan Zhang <nanzhang@google.com> | 2017-09-13 13:17:43 -0700 |
---|---|---|
committer | Nan Zhang <nanzhang@google.com> | 2017-09-13 23:01:49 -0700 |
commit | d5998cce7dee2c7e4200c3e8e7285095e5ba1a85 (patch) | |
tree | 7169a26931667dc1f4d054bc2bc973d8de41a576 /third_party | |
parent | 58aebd40d414abfa926c0a70548b4f2c51c034c8 (diff) | |
download | build_soong-d5998cce7dee2c7e4200c3e8e7285095e5ba1a85.tar.gz build_soong-d5998cce7dee2c7e4200c3e8e7285095e5ba1a85.tar.bz2 build_soong-d5998cce7dee2c7e4200c3e8e7285095e5ba1a85.zip |
Don't add data_descripters when merging uncompress zip entries for merge_zips.
Also filter out META-INF/TRANSITIVE dir, and report warnings when
merge_zips see duplicates entries with different CRC hash.
Bug: b/65455145
Test: m clean && m -j java (locally)
Change-Id: I47172ffa27df71f3280f35f6b540a7b5a0c14550
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/zip/android.go | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/third_party/zip/android.go b/third_party/zip/android.go index bde3afa4..d35513fd 100644 --- a/third_party/zip/android.go +++ b/third_party/zip/android.go @@ -32,7 +32,6 @@ func (w *Writer) CopyFrom(orig *File, newName string) error { fileHeader := orig.FileHeader fileHeader.Name = newName fh := &fileHeader - fh.Flags |= DataDescriptorFlag // The zip64 extras change between the Central Directory and Local File Header, while we use // the same structure for both. The Local File Haeder is taken care of by us writing a data @@ -57,24 +56,26 @@ func (w *Writer) CopyFrom(orig *File, newName string) error { } io.Copy(w.cw, io.NewSectionReader(orig.zipr, dataOffset, int64(orig.CompressedSize64))) - // Write data descriptor. - var buf []byte - if fh.isZip64() { - buf = make([]byte, dataDescriptor64Len) - } else { - buf = make([]byte, dataDescriptorLen) - } - b := writeBuf(buf) - b.uint32(dataDescriptorSignature) - b.uint32(fh.CRC32) - if fh.isZip64() { - b.uint64(fh.CompressedSize64) - b.uint64(fh.UncompressedSize64) - } else { - b.uint32(fh.CompressedSize) - b.uint32(fh.UncompressedSize) + if orig.hasDataDescriptor() { + // Write data descriptor. + var buf []byte + if fh.isZip64() { + buf = make([]byte, dataDescriptor64Len) + } else { + buf = make([]byte, dataDescriptorLen) + } + b := writeBuf(buf) + b.uint32(dataDescriptorSignature) + b.uint32(fh.CRC32) + if fh.isZip64() { + b.uint64(fh.CompressedSize64) + b.uint64(fh.UncompressedSize64) + } else { + b.uint32(fh.CompressedSize) + b.uint32(fh.UncompressedSize) + } + _, err = w.cw.Write(buf) } - _, err = w.cw.Write(buf) return err } |