Commit Graph

6 Commits

Author SHA1 Message Date
Colin Cross 297d9bceda soong_zip: set local header crc and size for symlinks
Getting a crc and size into the local header requires setting it
before writing the payload, or using a streaming data header after
the payload with the crc and size.  Stored (uncompressed) entries
are not allowed to use a streaming data header.

Symlinks are always stored uncompressed, so set the crc and size
in the file header before writing the payload.

Also set the mode to 0777 to match the behavior of zip.

This relands I66c5d41f0a5b23b828d6a03a3790afedc5a97625 with fixes
for the size and mode.

Test: m checkbuild
Test: zipdetails on zip with symlink created with soong_zip has same
      crc in local header and central header.
Test: Compare zipdetails output of zip containing symlink created
      by soong_zip and by zip --symlinks -X.
Bug: 110716403
Change-Id: Iec0bc9056a0d9cdab76f015844aca9c711e72e5b
2018-06-22 23:16:16 -07:00
Colin Cross 5aff065626 Revert "soong_zip: set local header crc for symlinks"
This reverts commit b88c4dfb87.

This made it worse, now that the local header crc matches the global
header, unzip will attempt to unzip the symlink.  However, the local
header size is still incorrect, so it produces an empty file instead
of a symlink.

Bug: 110716403
Change-Id: Ifd9aabc04d180b7ead4aec8566c151206b6b7c57
2018-06-23 06:14:01 +00:00
Colin Cross b88c4dfb87 soong_zip: set local header crc for symlinks
Getting a crc into the local header requires setting it before writing
the payload, or using a streaming data header after the payload with
the crc.  Stored (uncompressed) entries are not allowed to use a
streaming data header.

Symlinks are always stored uncompressed, so set the crc in the file
header before writing the payload.

Test: m checkbuild
Test: zipdetails on zip with symlink created with soong_zip has same
      crc in local header and central header.
Bug: 110716403
Change-Id: I66c5d41f0a5b23b828d6a03a3790afedc5a97625
2018-06-23 03:23:19 +00:00
Nan Zhang 674dd932d8 Add Respfile support for soong_zip.
Sometime the size of our command line passed to soong_zip go program
exceeds the cmdline size limit. So add an RespFile support with "@" special
character prefix.

The args in the cmdline will be considered together with the
args in RespFile during soong_zip running.

Test: real tests in my local machine, and compare the
res/libphonenumber.jar before and after changes.

./cmd -o test.zip '""'-C -> [./cmd,-o,test.zip,""-C]
./cmd -o test.zip '-C -f -> [./cmd,-o,test.zip,-C -f]
./cmd -o test.zip '\"'-C -f -> [./cmd,-o,test.zip,\"-C -f]
./cmd -o test.zip '\\'-C -f -> [./cmd,-o,test.zip,\\-C -f]
./cmd -o test.zip '\a'-C -f -> [./cmd,-o,test.zip,\a-C -f]

./cmd -o test.zip \'-C -> [./cmd,-o,test.zip,'-C]
./cmd -o test.zip \\-C -> [./cmd,-o,test.zip,\-C]
./cmd -o test.zip \"-C -> [./cmd,-o,test.zip,"-C]

./cmd -o test.zip "'"-C -> [./cmd,-o,test.zip,'-C]
./cmd -o test.zip "\\"-C -f -> [./cmd,-o,test.zip,\a-C -f]
./cmd -o test.zip "\""-C -f -> [./cmd,-o,test.zip,"a-C -f]

Bug: b/72484223

Change-Id: I83c3630b70c8396c8e8a3f266244d868d754c4e8
2018-02-13 15:13:01 -08:00
Colin Cross f83c150269 Add --write_if_changed argument to soong_zip
Simplify making restat rules by adding a --write_if_changed argument
to soong_zip that generates the output file into memory and then
compares it to the version on disk before writing it out.

Test: builds
Change-Id: I5059a1e3a11e79b0ca538b3b829bc7479c126ce6
2017-11-13 15:11:08 -08:00
Jeff Gaston 11b5c51d4e split soong_zip into a library and a binary
to make it faster/easier to invoke from other Go programs
(such as multiproduct_kati)

Bug: 67478260
Test: m -j
Change-Id: Idd2671a44290550197c88f53dd11a6dd39c85cc5
2017-10-19 18:18:04 +00:00