Merge "Remove ApiDemos and other packages modules in /data/app"
diff --git a/core/Makefile b/core/Makefile
index 136690f..8452494 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -3230,3 +3230,9 @@
ifneq ($(sdk_repo_goal),)
include $(TOPDIR)development/build/tools/sdk_repo.mk
endif
+
+#------------------------------------------------------------------
+# Find lsdump paths
+FIND_LSDUMPS_FILE := $(PRODUCT_OUT)/lsdump_paths.txt
+$(FIND_LSDUMPS_FILE) : $(LSDUMP_PATHS)
+ $(hide) rm -rf $@ && echo "$^" > $@
diff --git a/core/main.mk b/core/main.mk
index ef55b4e..0317a89 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1256,6 +1256,9 @@
.PHONY: findbugs
findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
+.PHONY: findlsdumps
+findlsdumps: $(FIND_LSDUMPS_FILE)
+
#xxx scrape this from ALL_MODULE_NAME_TAGS
.PHONY: modules
modules:
diff --git a/tools/releasetools/check_target_files_signatures.py b/tools/releasetools/check_target_files_signatures.py
index a3a5c1c..b9f39a6 100755
--- a/tools/releasetools/check_target_files_signatures.py
+++ b/tools/releasetools/check_target_files_signatures.py
@@ -39,19 +39,18 @@
"""
+import os
+import re
+import subprocess
import sys
+import zipfile
+
+import common
if sys.hexversion < 0x02070000:
print >> sys.stderr, "Python 2.7 or newer is required."
sys.exit(1)
-import os
-import re
-import shutil
-import subprocess
-import zipfile
-
-import common
# Work around a bug in Python's zipfile module that prevents opening of zipfiles
# if any entry has an extra field of between 1 and 3 bytes (which is common with
@@ -244,44 +243,41 @@
# This is the list of wildcards of files we extract from |filename|.
apk_extensions = ['*.apk']
- self.certmap, compressed_extension = common.ReadApkCerts(zipfile.ZipFile(filename, "r"))
+ self.certmap, compressed_extension = common.ReadApkCerts(
+ zipfile.ZipFile(filename, "r"))
if compressed_extension:
apk_extensions.append("*.apk" + compressed_extension)
d = common.UnzipTemp(filename, apk_extensions)
- try:
- self.apks = {}
- self.apks_by_basename = {}
- for dirpath, _, filenames in os.walk(d):
- for fn in filenames:
- # Decompress compressed APKs before we begin processing them.
- if compressed_extension and fn.endswith(compressed_extension):
- # First strip the compressed extension from the file.
- uncompressed_fn = fn[:-len(compressed_extension)]
+ self.apks = {}
+ self.apks_by_basename = {}
+ for dirpath, _, filenames in os.walk(d):
+ for fn in filenames:
+ # Decompress compressed APKs before we begin processing them.
+ if compressed_extension and fn.endswith(compressed_extension):
+ # First strip the compressed extension from the file.
+ uncompressed_fn = fn[:-len(compressed_extension)]
- # Decompress the compressed file to the output file.
- common.Gunzip(os.path.join(dirpath, fn),
- os.path.join(dirpath, uncompressed_fn))
+ # Decompress the compressed file to the output file.
+ common.Gunzip(os.path.join(dirpath, fn),
+ os.path.join(dirpath, uncompressed_fn))
- # Finally, delete the compressed file and use the uncompressed file
- # for further processing. Note that the deletion is not strictly required,
- # but is done here to ensure that we're not using too much space in
- # the temporary directory.
- os.remove(os.path.join(dirpath, fn))
- fn = uncompressed_fn
+ # Finally, delete the compressed file and use the uncompressed file
+ # for further processing. Note that the deletion is not strictly
+ # required, but is done here to ensure that we're not using too much
+ # space in the temporary directory.
+ os.remove(os.path.join(dirpath, fn))
+ fn = uncompressed_fn
+ if fn.endswith(".apk"):
+ fullname = os.path.join(dirpath, fn)
+ displayname = fullname[len(d)+1:]
+ apk = APK(fullname, displayname)
+ self.apks[apk.filename] = apk
+ self.apks_by_basename[os.path.basename(apk.filename)] = apk
- if fn.endswith(".apk"):
- fullname = os.path.join(dirpath, fn)
- displayname = fullname[len(d)+1:]
- apk = APK(fullname, displayname)
- self.apks[apk.filename] = apk
- self.apks_by_basename[os.path.basename(apk.filename)] = apk
-
- self.max_pkg_len = max(self.max_pkg_len, len(apk.package))
- self.max_fn_len = max(self.max_fn_len, len(apk.filename))
- finally:
- shutil.rmtree(d)
+ self.max_pkg_len = max(self.max_pkg_len, len(apk.package))
+ self.max_fn_len = max(self.max_fn_len, len(apk.filename))
def CheckSharedUids(self):
"""Look for any instances where packages signed with different
@@ -291,7 +287,7 @@
if apk.shared_uid:
apks_by_uid.setdefault(apk.shared_uid, []).append(apk)
- for uid in sorted(apks_by_uid.keys()):
+ for uid in sorted(apks_by_uid):
apks = apks_by_uid[uid]
for apk in apks[1:]:
if apk.certs != apks[0].certs:
@@ -466,3 +462,5 @@
print " ERROR: %s" % (e,)
print
sys.exit(1)
+ finally:
+ common.Cleanup()
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index 7d76dcb..dd8dcd0 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -1354,8 +1354,8 @@
return value
# Stage the output zip package for package signing.
- temp_zip_file = tempfile.NamedTemporaryFile()
- output_zip = zipfile.ZipFile(temp_zip_file, "w",
+ staging_file = common.MakeTempFile(suffix='.zip')
+ output_zip = zipfile.ZipFile(staging_file, "w",
compression=zipfile.ZIP_DEFLATED)
if source_file is not None:
@@ -1410,10 +1410,6 @@
else:
print("Warning: cannot find care map file in target_file package")
- # source_info must be None for full OTAs.
- if source_file is None:
- assert source_info is None
-
AddCompatibilityArchiveIfTrebleEnabled(
target_zip, output_zip, target_info, source_info)
@@ -1431,8 +1427,7 @@
# compute the ZIP entry offsets, write back the final metadata and do the
# final signing.
prelim_signing = common.MakeTempFile(suffix='.zip')
- SignOutput(temp_zip_file.name, prelim_signing)
- common.ZipClose(temp_zip_file)
+ SignOutput(staging_file, prelim_signing)
# Open the signed zip. Compute the final metadata that's needed for streaming.
prelim_signing_zip = zipfile.ZipFile(prelim_signing, 'r')