Merge "Revert "Remove changing uids/timestamps from zip/jar files""

am: 49d8c5196e

* commit '49d8c5196eb690fc987673c27cb61087c5886be4':
  Revert "Remove changing uids/timestamps from zip/jar files"
This commit is contained in:
Dan Willemsen 2015-10-29 21:33:39 +00:00 committed by android-build-merger
commit d8d06da814
13 changed files with 53 additions and 108 deletions

View file

@ -666,18 +666,12 @@ $(kernel_notice_file): \
# #
# This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come # This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come
# before the rules that use that variable to build the image. # before the rules that use that variable to build the image.
OTACERTS_ZIP_BUILT := $(call intermediates-dir-for,PACKAGING,otacerts)/otacerts.zip ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
OTACERTS_ZIP := $(TARGET_OUT_ETC)/security/otacerts.zip $(TARGET_OUT_ETC)/security/otacerts.zip: KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
ALL_DEFAULT_INSTALLED_MODULES += $(OTACERTS_ZIP) $(TARGET_OUT_ETC)/security/otacerts.zip: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR))
$(OTACERTS_ZIP_BUILT): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
$(OTACERTS_ZIP_BUILT): $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR)) | $(ZIPALIGN)
$(hide) rm -f $@ $(hide) rm -f $@
$(hide) mkdir -p $(dir $@) $(hide) mkdir -p $(dir $@)
$(hide) zip -qjX $@ $< $(hide) zip -qj $@ $<
$(remove-timestamps-from-package)
$(eval $(call copy-one-file,$(OTACERTS_ZIP_BUILT),$(OTACERTS_ZIP)))
.PHONY: otacerts .PHONY: otacerts
otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip
@ -935,13 +929,9 @@ $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
$(call build-recoveryimage-target, $@) $(call build-recoveryimage-target, $@)
ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true) ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
RECOVERY_RESOURCE_ZIP_BUILT := $(call intermediates-dir-for,PACKAGING,recovery_resource)/recovery_resource.zip $(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET)
$(RECOVERY_RESOURCE_ZIP_BUILT): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPALIGN)
$(hide) mkdir -p $(dir $@) $(hide) mkdir -p $(dir $@)
$(hide) find $(TARGET_RECOVERY_ROOT_OUT)/res -type f | sort | zip -0qrjX $@ -@ $(hide) find $(TARGET_RECOVERY_ROOT_OUT)/res -type f | sort | zip -0qrj $@ -@
$(remove-timestamps-from-package)
$(eval $(call copy-one-file,$(RECOVERY_RESOURCE_ZIP_BUILT),$(RECOVERY_RESOURCE_ZIP)))
endif endif
.PHONY: recoveryimage-nodeps .PHONY: recoveryimage-nodeps
@ -1132,19 +1122,19 @@ INSTALLED_PLATFORM_ZIP := $(PRODUCT_OUT)/platform.zip
$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES) $(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES)
$(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)") $(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)")
$(hide) rm -f $@ $(hide) rm -f $@
$(hide) cd $(dir $@) && zip -qryX $(notdir $@) \ $(hide) cd $(dir $@) && zip -qry $(notdir $@) \
$(TARGET_COPY_OUT_SYSTEM) \ $(TARGET_COPY_OUT_SYSTEM) \
$(patsubst $(PRODUCT_OUT)/%, %, $(TARGET_OUT_NOTICE_FILES)) \ $(patsubst $(PRODUCT_OUT)/%, %, $(TARGET_OUT_NOTICE_FILES)) \
$(addprefix symbols/,$(PDK_SYMBOL_FILES_LIST)) $(addprefix symbols/,$(PDK_SYMBOL_FILES_LIST))
ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
$(hide) cd $(dir $@) && zip -qryX $(notdir $@) \ $(hide) cd $(dir $@) && zip -qry $(notdir $@) \
$(TARGET_COPY_OUT_VENDOR) $(TARGET_COPY_OUT_VENDOR)
endif endif
ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),) ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),)
$(hide) cd $(OUT_DIR) && zip -qryX $(patsubst $(OUT_DIR)/%,%,$@) $(PDK_PLATFORM_JAVA_ZIP_CONTENTS) $(hide) cd $(OUT_DIR) && zip -qry $(patsubst $(OUT_DIR)/%,%,$@) $(PDK_PLATFORM_JAVA_ZIP_CONTENTS)
endif endif
ifneq ($(PDK_PLATFORM_ZIP_PRODUCT_BINARIES),) ifneq ($(PDK_PLATFORM_ZIP_PRODUCT_BINARIES),)
$(hide) zip -qryX $@ $(PDK_PLATFORM_ZIP_PRODUCT_BINARIES) $(hide) zip -qry $@ $(PDK_PLATFORM_ZIP_PRODUCT_BINARIES)
endif endif
.PHONY: platform .PHONY: platform
@ -1413,9 +1403,9 @@ $(BUILT_OTATOOLS_PACKAGE): $(OTATOOLS) | $(ACP)
$(hide) $(ACP) -p system/extras/verity/build_verity_metadata.py $(zip_root)/system/extras/verity/ $(hide) $(ACP) -p system/extras/verity/build_verity_metadata.py $(zip_root)/system/extras/verity/
$(hide) $(ACP) -r -d -p build/tools/releasetools/* $(zip_root)/releasetools $(hide) $(ACP) -r -d -p build/tools/releasetools/* $(zip_root)/releasetools
$(hide) rm -rf $@ $(zip_root)/releasetools/*.pyc $(hide) rm -rf $@ $(zip_root)/releasetools/*.pyc
$(hide) (cd $(zip_root) && zip -qryX $(abspath $@) *) $(hide) (cd $(zip_root) && zip -qry $(abspath $@) *)
$(hide) zip -qryX $(abspath $@) build/target/product/security/ $(hide) zip -qry $(abspath $@) build/target/product/security/
$(hide) find device vendor -name \*.pk8 -o -name \*.x509.pem -o -name oem.prop | xargs zip -qryX $(abspath $@)>/dev/null || true $(hide) find device vendor -name \*.pk8 -o -name \*.x509.pem -o -name oem.prop | xargs zip -qry $(abspath $@)>/dev/null || true
.PHONY: otatools-package .PHONY: otatools-package
otatools-package: $(BUILT_OTATOOLS_PACKAGE) otatools-package: $(BUILT_OTATOOLS_PACKAGE)
@ -1637,7 +1627,7 @@ ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
$(hide) $(ACP) -r $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD $(hide) $(ACP) -r $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD
endif endif
@# Zip everything up, preserving symlinks @# Zip everything up, preserving symlinks
$(hide) (cd $(zip_root) && zip -qryX ../$(notdir $@) .) $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
@# Run fs_config on all the system, vendor, boot ramdisk, @# Run fs_config on all the system, vendor, boot ramdisk,
@# and recovery ramdisk files in the zip, and save the output @# and recovery ramdisk files in the zip, and save the output
$(hide) zipinfo -1 $@ | awk 'BEGIN { FS="SYSTEM/" } /^SYSTEM\// {print "system/" $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -D $(TARGET_OUT) -S $(SELINUX_FC) > $(zip_root)/META/filesystem_config.txt $(hide) zipinfo -1 $@ | awk 'BEGIN { FS="SYSTEM/" } /^SYSTEM\// {print "system/" $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -D $(TARGET_OUT) -S $(SELINUX_FC) > $(zip_root)/META/filesystem_config.txt
@ -1650,7 +1640,7 @@ endif
ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
$(hide) zipinfo -1 $@ | awk 'BEGIN { FS="RECOVERY/RAMDISK/" } /^RECOVERY\/RAMDISK\// {print $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -D $(TARGET_OUT) -S $(SELINUX_FC) > $(zip_root)/META/recovery_filesystem_config.txt $(hide) zipinfo -1 $@ | awk 'BEGIN { FS="RECOVERY/RAMDISK/" } /^RECOVERY\/RAMDISK\// {print $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -D $(TARGET_OUT) -S $(SELINUX_FC) > $(zip_root)/META/recovery_filesystem_config.txt
endif endif
$(hide) (cd $(zip_root) && zip -qX ../$(notdir $@) META/*filesystem_config.txt) $(hide) (cd $(zip_root) && zip -q ../$(notdir $@) META/*filesystem_config.txt)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \ $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
./build/tools/releasetools/add_img_to_target_files -v -p $(HOST_OUT) $@ ./build/tools/releasetools/add_img_to_target_files -v -p $(HOST_OUT) $@
@ -1730,7 +1720,7 @@ $(SYMBOLS_ZIP):
@echo "Package symbols: $@" @echo "Package symbols: $@"
$(hide) rm -rf $@ $(hide) rm -rf $@
$(hide) mkdir -p $(dir $@) $(TARGET_OUT_UNSTRIPPED) $(hide) mkdir -p $(dir $@) $(TARGET_OUT_UNSTRIPPED)
$(hide) zip -qrX $@ $(TARGET_OUT_UNSTRIPPED) $(hide) zip -qr $@ $(TARGET_OUT_UNSTRIPPED)
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# A zip of the Android Apps. Not keeping full path so that we don't # A zip of the Android Apps. Not keeping full path so that we don't
@ -1747,7 +1737,7 @@ $(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE)
@echo "Package apps: $@" @echo "Package apps: $@"
$(hide) rm -rf $@ $(hide) rm -rf $@
$(hide) mkdir -p $(dir $@) $(hide) mkdir -p $(dir $@)
$(hide) zip -qjX $@ $(TARGET_OUT_APPS)/*/*.apk $(TARGET_OUT_APPS_PRIVILEGED)/*/*.apk $(hide) zip -qj $@ $(TARGET_OUT_APPS)/*/*.apk $(TARGET_OUT_APPS_PRIVILEGED)/*/*.apk
#------------------------------------------------------------------ #------------------------------------------------------------------
@ -1760,7 +1750,7 @@ EMMA_META_ZIP := $(PRODUCT_OUT)/emma_meta.zip
$(EMMA_META_ZIP) : $(EMMA_META_ZIP) :
@echo "Collecting Emma coverage meta files." @echo "Collecting Emma coverage meta files."
$(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "coverage.em" | \ $(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "coverage.em" | \
zip -@ -qX $@ zip -@ -q $@
endif # EMMA_INSTRUMENT=true endif # EMMA_INSTRUMENT=true
@ -1776,7 +1766,7 @@ $(PROGUARD_DICT_ZIP) :
$(hide) dict_files=`find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary`; \ $(hide) dict_files=`find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary`; \
if [ -n "$$dict_files" ]; then \ if [ -n "$$dict_files" ]; then \
unobfuscated_jars=$${dict_files//proguard_dictionary/classes.jar}; \ unobfuscated_jars=$${dict_files//proguard_dictionary/classes.jar}; \
zip -qX $@ $$dict_files $$unobfuscated_jars; \ zip -q $@ $$dict_files $$unobfuscated_jars; \
else \ else \
touch $(dir $@)/zipdummy; \ touch $(dir $@)/zipdummy; \
(cd $(dir $@) && zip -q $(notdir $@) zipdummy); \ (cd $(dir $@) && zip -q $(notdir $@) zipdummy); \
@ -1807,7 +1797,7 @@ INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES) $(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
@echo "Package: $@" @echo "Package: $@"
$(hide) zip -qjX $@ $(INTERNAL_EMULATOR_PACKAGE_FILES) $(hide) zip -qj $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
endif endif
# ----------------------------------------------------------------- # -----------------------------------------------------------------
@ -1942,7 +1932,7 @@ $(INTERNAL_SDK_TARGET): $(deps)
HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \ HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \ development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
chmod -R ug+rwX $(PRIVATE_DIR) && \ chmod -R ug+rwX $(PRIVATE_DIR) && \
cd $(dir $@) && zip -rqX $(notdir $@) $(PRIVATE_NAME) \ cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) \
) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 ) ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )

View file

@ -2094,13 +2094,13 @@ $(hide) mkdir -p $(addprefix $(dir $@)lib/,$(PRIVATE_JNI_SHARED_LIBRARIES_ABI))
$(foreach abi,$(PRIVATE_JNI_SHARED_LIBRARIES_ABI),\ $(foreach abi,$(PRIVATE_JNI_SHARED_LIBRARIES_ABI),\
$(call _add-jni-shared-libs-to-package-per-abi,$(abi),\ $(call _add-jni-shared-libs-to-package-per-abi,$(abi),\
$(patsubst $(abi):%,%,$(filter $(abi):%,$(PRIVATE_JNI_SHARED_LIBRARIES))))) $(patsubst $(abi):%,%,$(filter $(abi):%,$(PRIVATE_JNI_SHARED_LIBRARIES)))))
$(hide) (cd $(dir $@) && zip -qrX $(JNI_COMPRESS_FLAGS) $(notdir $@) lib) $(hide) (cd $(dir $@) && zip -qr $(JNI_COMPRESS_FLAGS) $(notdir $@) lib)
$(hide) rm -rf $(dir $@)lib $(hide) rm -rf $(dir $@)lib
endef endef
#TODO: update the manifest to point to the dex file #TODO: update the manifest to point to the dex file
define add-dex-to-package define add-dex-to-package
$(hide) zip -qjX $@ $(dir $(PRIVATE_DEX_FILE))classes*.dex $(hide) zip -qj $@ $(dir $(PRIVATE_DEX_FILE))classes*.dex
endef endef
# Add java resources added by the current module. # Add java resources added by the current module.
@ -2147,17 +2147,6 @@ $(hide) $(ZIPALIGN) \
$(hide) mv $@.aligned $@ $(hide) mv $@.aligned $@
endef endef
# Remove dynamic timestamps from packages
#
define remove-timestamps-from-package
$(hide) mv $@ $@.timed
$(hide) $(ZIPALIGN) \
-f -t \
1 \
$@.timed $@.untimed
$(hide) mv $@.untimed $@
endef
# Uncompress shared libraries embedded in an apk. # Uncompress shared libraries embedded in an apk.
# #
define uncompress-shared-libs define uncompress-shared-libs
@ -2165,7 +2154,7 @@ $(hide) if unzip -l $@ $(PRIVATE_EMBEDDED_JNI_LIBS) >/dev/null ; then \
rm -rf $(dir $@)uncompressedlibs && mkdir $(dir $@)uncompressedlibs; \ rm -rf $(dir $@)uncompressedlibs && mkdir $(dir $@)uncompressedlibs; \
unzip $@ $(PRIVATE_EMBEDDED_JNI_LIBS) -d $(dir $@)uncompressedlibs && \ unzip $@ $(PRIVATE_EMBEDDED_JNI_LIBS) -d $(dir $@)uncompressedlibs && \
zip -d $@ 'lib/*.so' && \ zip -d $@ 'lib/*.so' && \
( cd $(dir $@)uncompressedlibs && zip -D -r -X -0 ../$(notdir $@) lib ) && \ ( cd $(dir $@)uncompressedlibs && zip -D -r -0 ../$(notdir $@) lib ) && \
rm -rf $(dir $@)uncompressedlibs; \ rm -rf $(dir $@)uncompressedlibs; \
fi fi
endef endef

View file

@ -241,7 +241,7 @@ $(out_zip): $(full_target)
@echo Package docs: $@ @echo Package docs: $@
@rm -f $@ @rm -f $@
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
$(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_DOCS_DIR) && zip -rqX $$F * ) $(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_DOCS_DIR) && zip -rq $$F * )
$(LOCAL_MODULE)-docs.zip : $(out_zip) $(LOCAL_MODULE)-docs.zip : $(out_zip)

View file

@ -81,7 +81,7 @@ else # !LOCAL_IS_STATIC_JAVA_LIBRARY
$(common_javalib.jar): PRIVATE_DEX_FILE := $(built_dex) $(common_javalib.jar): PRIVATE_DEX_FILE := $(built_dex)
$(common_javalib.jar): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar) $(common_javalib.jar): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
$(common_javalib.jar): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS) $(common_javalib.jar): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS)
$(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(ZIPALIGN) $(common_javalib.jar) : $(built_dex) $(java_resource_sources)
@echo "target Jar: $(PRIVATE_MODULE) ($@)" @echo "target Jar: $(PRIVATE_MODULE) ($@)"
ifdef LOCAL_JACK_ENABLED ifdef LOCAL_JACK_ENABLED
$(create-empty-package) $(create-empty-package)
@ -92,7 +92,6 @@ endif
ifdef LOCAL_JACK_ENABLED ifdef LOCAL_JACK_ENABLED
$(add-carried-jack-resources) $(add-carried-jack-resources)
endif endif
$(remove-timestamps-from-package)
ifdef LOCAL_DEX_PREOPT ifdef LOCAL_DEX_PREOPT
ifneq ($(dexpreopt_boot_jar_module),) # boot jar ifneq ($(dexpreopt_boot_jar_module),) # boot jar

View file

@ -387,7 +387,7 @@ $(INTERNAL_CTS_TARGET): PRIVATE_DIR := $(cts_dir)/$(cts_name)
$(INTERNAL_CTS_TARGET): TMP_DIR := $(cts_dir)/temp $(INTERNAL_CTS_TARGET): TMP_DIR := $(cts_dir)/temp
$(INTERNAL_CTS_TARGET): $(cts_dir)/all_cts_files_stamp $(DEFAULT_TEST_PLAN) $(INTERNAL_CTS_TARGET): $(cts_dir)/all_cts_files_stamp $(DEFAULT_TEST_PLAN)
$(hide) echo "Package CTS: $@" $(hide) echo "Package CTS: $@"
$(hide) cd $(dir $@) && zip -rqX $(notdir $@) $(PRIVATE_NAME) $(hide) cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME)
.PHONY: cts .PHONY: cts
cts: $(INTERNAL_CTS_TARGET) adb cts: $(INTERNAL_CTS_TARGET) adb

View file

@ -111,13 +111,13 @@ $(full_target): $(sdk_addon_deps) | $(ACP)
$(ACP) -r $$d $(PRIVATE_STAGING_DIR)/docs ;\ $(ACP) -r $$d $(PRIVATE_STAGING_DIR)/docs ;\
done done
$(hide) mkdir -p $(dir $@) $(hide) mkdir -p $(dir $@)
$(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_STAGING_DIR)/.. && zip -rqX $$F $(notdir $(PRIVATE_STAGING_DIR)) ) $(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_STAGING_DIR)/.. && zip -rq $$F $(notdir $(PRIVATE_STAGING_DIR)) )
$(full_target_img): PRIVATE_STAGING_DIR := $(call append-path,$(staging),$(addon_dir_img))/images/$(TARGET_CPU_ABI) $(full_target_img): PRIVATE_STAGING_DIR := $(call append-path,$(staging),$(addon_dir_img))/images/$(TARGET_CPU_ABI)
$(full_target_img): $(full_target) $(addon_img_source_prop) $(full_target_img): $(full_target) $(addon_img_source_prop)
@echo Packaging SDK Addon System-Image: $@ @echo Packaging SDK Addon System-Image: $@
$(hide) mkdir -p $(dir $@) $(hide) mkdir -p $(dir $@)
$(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_STAGING_DIR)/.. && zip -rqX $$F $(notdir $(PRIVATE_STAGING_DIR)) ) $(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_STAGING_DIR)/.. && zip -rq $$F $(notdir $(PRIVATE_STAGING_DIR)) )
.PHONY: sdk_addon .PHONY: sdk_addon

View file

@ -59,4 +59,4 @@ $(my_package_zip) : $(my_built_modules)
$(call copy-tests-in-batch,$(wordlist 1201,9999,$(PRIVATE_COPY_PAIRS))) $(call copy-tests-in-batch,$(wordlist 1201,9999,$(PRIVATE_COPY_PAIRS)))
$(hide) $(foreach f, $(PRIVATE_PICKUP_FILES),\ $(hide) $(foreach f, $(PRIVATE_PICKUP_FILES),\
cp -RfL $(f) $(dir $@);) cp -RfL $(f) $(dir $@);)
$(hide) cd $(dir $@) && zip -rqX $(notdir $@) * $(hide) cd $(dir $@) && zip -rq $(notdir $@) *

View file

@ -6,7 +6,6 @@ usage: zipalign [-f] [-v] <align> infile.zip outfile.zip
-c : check alignment only (does not modify file) -c : check alignment only (does not modify file)
-f : overwrite existing outfile.zip -f : overwrite existing outfile.zip
-p : page align stored shared object files -p : page align stored shared object files
-t : remove dynamic timestamps
-v : verbose output -v : verbose output
<align> is in bytes, e.g. "4" provides 32-bit alignment <align> is in bytes, e.g. "4" provides 32-bit alignment
infile.zip is an existing Zip archive infile.zip is an existing Zip archive
@ -39,5 +38,3 @@ The "-p" flag aligns any file with a ".so" extension, and which is stored
uncompressed in the zip archive, to a 4096-byte page boundary. This uncompressed in the zip archive, to a 4096-byte page boundary. This
facilitates directly loading shared libraries from inside a zip archive. facilitates directly loading shared libraries from inside a zip archive.
The "-t" flag removes all timestamps that could change from the archive.

View file

@ -39,7 +39,6 @@ void usage(void)
fprintf(stderr, " -c: check alignment only (does not modify file)\n"); fprintf(stderr, " -c: check alignment only (does not modify file)\n");
fprintf(stderr, " -f: overwrite existing outfile.zip\n"); fprintf(stderr, " -f: overwrite existing outfile.zip\n");
fprintf(stderr, " -p: page align stored shared object files\n"); fprintf(stderr, " -p: page align stored shared object files\n");
fprintf(stderr, " -t: remove dynamic timestamps\n");
fprintf(stderr, " -v: verbose output\n"); fprintf(stderr, " -v: verbose output\n");
fprintf(stderr, " -z: recompress using Zopfli\n"); fprintf(stderr, " -z: recompress using Zopfli\n");
} }
@ -65,7 +64,7 @@ static int getAlignment(bool pageAlignSharedLibs, int defaultAlignment,
* Copy all entries from "pZin" to "pZout", aligning as needed. * Copy all entries from "pZin" to "pZout", aligning as needed.
*/ */
static int copyAndAlign(ZipFile* pZin, ZipFile* pZout, int alignment, bool zopfli, static int copyAndAlign(ZipFile* pZin, ZipFile* pZout, int alignment, bool zopfli,
bool pageAlignSharedLibs, bool removeTime) bool pageAlignSharedLibs)
{ {
int numEntries = pZin->getNumEntries(); int numEntries = pZin->getNumEntries();
ZipEntry* pEntry; ZipEntry* pEntry;
@ -89,10 +88,10 @@ static int copyAndAlign(ZipFile* pZin, ZipFile* pZout, int alignment, bool zopfl
// (long) pEntry->getUncompressedLen()); // (long) pEntry->getUncompressedLen());
if (zopfli) { if (zopfli) {
status = pZout->addRecompress(pZin, pEntry, removeTime, &pNewEntry); status = pZout->addRecompress(pZin, pEntry, &pNewEntry);
bias += pNewEntry->getCompressedLen() - pEntry->getCompressedLen(); bias += pNewEntry->getCompressedLen() - pEntry->getCompressedLen();
} else { } else {
status = pZout->add(pZin, pEntry, padding, removeTime, &pNewEntry); status = pZout->add(pZin, pEntry, padding, &pNewEntry);
} }
} else { } else {
const int alignTo = getAlignment(pageAlignSharedLibs, alignment, pEntry); const int alignTo = getAlignment(pageAlignSharedLibs, alignment, pEntry);
@ -108,7 +107,7 @@ static int copyAndAlign(ZipFile* pZin, ZipFile* pZout, int alignment, bool zopfl
//printf("--- %s: orig at %ld(+%d) len=%ld, adding pad=%d\n", //printf("--- %s: orig at %ld(+%d) len=%ld, adding pad=%d\n",
// pEntry->getFileName(), (long) pEntry->getFileOffset(), // pEntry->getFileName(), (long) pEntry->getFileOffset(),
// bias, (long) pEntry->getUncompressedLen(), padding); // bias, (long) pEntry->getUncompressedLen(), padding);
status = pZout->add(pZin, pEntry, padding, removeTime, &pNewEntry); status = pZout->add(pZin, pEntry, padding, &pNewEntry);
} }
if (status != NO_ERROR) if (status != NO_ERROR)
@ -127,8 +126,7 @@ static int copyAndAlign(ZipFile* pZin, ZipFile* pZout, int alignment, bool zopfl
* output file exists and "force" wasn't specified. * output file exists and "force" wasn't specified.
*/ */
static int process(const char* inFileName, const char* outFileName, static int process(const char* inFileName, const char* outFileName,
int alignment, bool force, bool zopfli, bool pageAlignSharedLibs, int alignment, bool force, bool zopfli, bool pageAlignSharedLibs)
bool removeTime)
{ {
ZipFile zin, zout; ZipFile zin, zout;
@ -159,7 +157,7 @@ static int process(const char* inFileName, const char* outFileName,
return 1; return 1;
} }
int result = copyAndAlign(&zin, &zout, alignment, zopfli, pageAlignSharedLibs, removeTime); int result = copyAndAlign(&zin, &zout, alignment, zopfli, pageAlignSharedLibs);
if (result != 0) { if (result != 0) {
printf("zipalign: failed rewriting '%s' to '%s'\n", printf("zipalign: failed rewriting '%s' to '%s'\n",
inFileName, outFileName); inFileName, outFileName);
@ -230,7 +228,6 @@ int main(int argc, char* const argv[])
bool verbose = false; bool verbose = false;
bool zopfli = false; bool zopfli = false;
bool pageAlignSharedLibs = false; bool pageAlignSharedLibs = false;
bool removeTime = false;
int result = 1; int result = 1;
int alignment; int alignment;
char* endp; char* endp;
@ -263,9 +260,6 @@ int main(int argc, char* const argv[])
case 'p': case 'p':
pageAlignSharedLibs = true; pageAlignSharedLibs = true;
break; break;
case 't':
removeTime = true;
break;
default: default:
fprintf(stderr, "ERROR: unknown flag -%c\n", *cp); fprintf(stderr, "ERROR: unknown flag -%c\n", *cp);
wantUsage = true; wantUsage = true;
@ -296,7 +290,7 @@ int main(int argc, char* const argv[])
result = verify(argv[1], alignment, verbose, pageAlignSharedLibs); result = verify(argv[1], alignment, verbose, pageAlignSharedLibs);
} else { } else {
/* create the new archive */ /* create the new archive */
result = process(argv[1], argv[2], alignment, force, zopfli, pageAlignSharedLibs, removeTime); result = process(argv[1], argv[2], alignment, force, zopfli, pageAlignSharedLibs);
/* trust, but verify */ /* trust, but verify */
if (result == 0) { if (result == 0) {

View file

@ -386,14 +386,6 @@ void ZipEntry::setModWhen(time_t when)
mCDE.mLastModFileDate = mLFH.mLastModFileDate = zdate; mCDE.mLastModFileDate = mLFH.mLastModFileDate = zdate;
} }
/*
* Set static timestamps
*/
void ZipEntry::removeTimestamps()
{
mCDE.mLastModFileTime = mLFH.mLastModFileTime = 0;
mCDE.mLastModFileDate = mLFH.mLastModFileDate = 28 << 9 | 1 << 5 | 1;
}
/* /*
* =========================================================================== * ===========================================================================

View file

@ -185,12 +185,6 @@ protected:
*/ */
void setModWhen(time_t when); void setModWhen(time_t when);
/*
* Set a static modification date. This only affects the standard
* zip modification date, not the universal time extra field.
*/
void removeTimestamps();
/* /*
* Return the offset of the local file header. * Return the offset of the local file header.
*/ */

View file

@ -359,7 +359,7 @@ bail:
*/ */
status_t ZipFile::addCommon(const char* fileName, const void* data, size_t size, status_t ZipFile::addCommon(const char* fileName, const void* data, size_t size,
const char* storageName, int sourceType, int compressionMethod, const char* storageName, int sourceType, int compressionMethod,
bool removeTime, ZipEntry** ppEntry) ZipEntry** ppEntry)
{ {
ZipEntry* pEntry = NULL; ZipEntry* pEntry = NULL;
status_t result = NO_ERROR; status_t result = NO_ERROR;
@ -499,12 +499,8 @@ status_t ZipFile::addCommon(const char* fileName, const void* data, size_t size,
*/ */
pEntry->setDataInfo(uncompressedLen, endPosn - startPosn, crc, pEntry->setDataInfo(uncompressedLen, endPosn - startPosn, crc,
compressionMethod); compressionMethod);
if (removeTime) { modWhen = getModTime(inputFp ? fileno(inputFp) : fileno(mZipFp));
pEntry->removeTimestamps(); pEntry->setModWhen(modWhen);
} else {
modWhen = getModTime(inputFp ? fileno(inputFp) : fileno(mZipFp));
pEntry->setModWhen(modWhen);
}
pEntry->setLFHOffset(lfhPosn); pEntry->setLFHOffset(lfhPosn);
mEOCD.mNumEntries++; mEOCD.mNumEntries++;
mEOCD.mTotalNumEntries++; mEOCD.mTotalNumEntries++;
@ -543,7 +539,7 @@ bail:
* If "ppEntry" is non-NULL, a pointer to the new entry will be returned. * If "ppEntry" is non-NULL, a pointer to the new entry will be returned.
*/ */
status_t ZipFile::add(const ZipFile* pSourceZip, const ZipEntry* pSourceEntry, status_t ZipFile::add(const ZipFile* pSourceZip, const ZipEntry* pSourceEntry,
int padding, bool removeTime, ZipEntry** ppEntry) int padding, ZipEntry** ppEntry)
{ {
ZipEntry* pEntry = NULL; ZipEntry* pEntry = NULL;
status_t result; status_t result;
@ -575,8 +571,6 @@ status_t ZipFile::add(const ZipFile* pSourceZip, const ZipEntry* pSourceEntry,
if (result != NO_ERROR) if (result != NO_ERROR)
goto bail; goto bail;
} }
if (removeTime)
pEntry->removeTimestamps();
/* /*
* From here on out, failures are more interesting. * From here on out, failures are more interesting.
@ -652,7 +646,7 @@ bail:
* If "ppEntry" is non-NULL, a pointer to the new entry will be returned. * If "ppEntry" is non-NULL, a pointer to the new entry will be returned.
*/ */
status_t ZipFile::addRecompress(const ZipFile* pSourceZip, const ZipEntry* pSourceEntry, status_t ZipFile::addRecompress(const ZipFile* pSourceZip, const ZipEntry* pSourceEntry,
bool removeTime, ZipEntry** ppEntry) ZipEntry** ppEntry)
{ {
ZipEntry* pEntry = NULL; ZipEntry* pEntry = NULL;
status_t result; status_t result;
@ -680,9 +674,6 @@ status_t ZipFile::addRecompress(const ZipFile* pSourceZip, const ZipEntry* pSour
if (result != NO_ERROR) if (result != NO_ERROR)
goto bail; goto bail;
if (removeTime)
pEntry->removeTimestamps();
/* /*
* From here on out, failures are more interesting. * From here on out, failures are more interesting.
*/ */

View file

@ -77,17 +77,17 @@ public:
* *
* If "ppEntry" is non-NULL, a pointer to the new entry will be returned. * If "ppEntry" is non-NULL, a pointer to the new entry will be returned.
*/ */
status_t add(const char* fileName, int compressionMethod, bool removeTime, status_t add(const char* fileName, int compressionMethod,
ZipEntry** ppEntry) ZipEntry** ppEntry)
{ {
return add(fileName, fileName, compressionMethod, removeTime, ppEntry); return add(fileName, fileName, compressionMethod, ppEntry);
} }
status_t add(const char* fileName, const char* storageName, status_t add(const char* fileName, const char* storageName,
int compressionMethod, bool removeTime, ZipEntry** ppEntry) int compressionMethod, ZipEntry** ppEntry)
{ {
return addCommon(fileName, NULL, 0, storageName, return addCommon(fileName, NULL, 0, storageName,
ZipEntry::kCompressStored, ZipEntry::kCompressStored,
compressionMethod, removeTime, ppEntry); compressionMethod, ppEntry);
} }
/* /*
@ -96,12 +96,11 @@ public:
* If "ppEntry" is non-NULL, a pointer to the new entry will be returned. * If "ppEntry" is non-NULL, a pointer to the new entry will be returned.
*/ */
status_t addGzip(const char* fileName, const char* storageName, status_t addGzip(const char* fileName, const char* storageName,
bool removeTime, ZipEntry** ppEntry) ZipEntry** ppEntry)
{ {
return addCommon(fileName, NULL, 0, storageName, return addCommon(fileName, NULL, 0, storageName,
ZipEntry::kCompressDeflated, ZipEntry::kCompressDeflated,
ZipEntry::kCompressDeflated, ZipEntry::kCompressDeflated, ppEntry);
removeTime, ppEntry);
} }
/* /*
@ -110,11 +109,11 @@ public:
* If "ppEntry" is non-NULL, a pointer to the new entry will be returned. * If "ppEntry" is non-NULL, a pointer to the new entry will be returned.
*/ */
status_t add(const void* data, size_t size, const char* storageName, status_t add(const void* data, size_t size, const char* storageName,
int compressionMethod, bool removeTime, ZipEntry** ppEntry) int compressionMethod, ZipEntry** ppEntry)
{ {
return addCommon(NULL, data, size, storageName, return addCommon(NULL, data, size, storageName,
ZipEntry::kCompressStored, ZipEntry::kCompressStored,
compressionMethod, removeTime, ppEntry); compressionMethod, ppEntry);
} }
/* /*
@ -125,7 +124,7 @@ public:
* If "ppEntry" is non-NULL, a pointer to the new entry will be returned. * If "ppEntry" is non-NULL, a pointer to the new entry will be returned.
*/ */
status_t add(const ZipFile* pSourceZip, const ZipEntry* pSourceEntry, status_t add(const ZipFile* pSourceZip, const ZipEntry* pSourceEntry,
int padding, bool removeTime, ZipEntry** ppEntry); int padding, ZipEntry** ppEntry);
/* /*
* Add an entry by copying it from another zip file, recompressing with * Add an entry by copying it from another zip file, recompressing with
@ -134,7 +133,7 @@ public:
* If "ppEntry" is non-NULL, a pointer to the new entry will be returned. * If "ppEntry" is non-NULL, a pointer to the new entry will be returned.
*/ */
status_t addRecompress(const ZipFile* pSourceZip, const ZipEntry* pSourceEntry, status_t addRecompress(const ZipFile* pSourceZip, const ZipEntry* pSourceEntry,
bool removeTime, ZipEntry** ppEntry); ZipEntry** ppEntry);
/* /*
* Mark an entry as having been removed. It is not actually deleted * Mark an entry as having been removed. It is not actually deleted
@ -233,7 +232,7 @@ private:
/* common handler for all "add" functions */ /* common handler for all "add" functions */
status_t addCommon(const char* fileName, const void* data, size_t size, status_t addCommon(const char* fileName, const void* data, size_t size,
const char* storageName, int sourceType, int compressionMethod, const char* storageName, int sourceType, int compressionMethod,
bool removeTime, ZipEntry** ppEntry); ZipEntry** ppEntry);
/* copy all of "srcFp" into "dstFp" */ /* copy all of "srcFp" into "dstFp" */
status_t copyFpToFp(FILE* dstFp, FILE* srcFp, unsigned long* pCRC32); status_t copyFpToFp(FILE* dstFp, FILE* srcFp, unsigned long* pCRC32);