summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2016-03-18 02:25:20 +0100
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2016-03-18 02:25:20 +0100
commit882914410c98e48b6de5df0721164b963b55b63e (patch)
treec17fe30cceac5b0f7b2dc39c84f4e0c1f44a5a5e /tools
parent700d8f580e79ddc2f853cec8acc848706cbcbff5 (diff)
parent078a4dc15aa20587d95a3ca6555721d9110b288e (diff)
downloadbuild-882914410c98e48b6de5df0721164b963b55b63e.zip
build-882914410c98e48b6de5df0721164b963b55b63e.tar.gz
build-882914410c98e48b6de5df0721164b963b55b63e.tar.bz2
Merge branch 'cm-13.0' of https://github.com/CyanogenMod/android_build into replicant-6.0
Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
Diffstat (limited to 'tools')
-rw-r--r--tools/releasetools/common.py24
-rw-r--r--tools/releasetools/edify_generator.py4
-rwxr-xr-xtools/releasetools/ota_from_target_files.py15
-rw-r--r--tools/releasetools/sparse_img.py26
-rwxr-xr-xtools/repopick.py6
5 files changed, 57 insertions, 18 deletions
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 4f8db79..26cc674 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -1402,7 +1402,8 @@ PARTITION_TYPES = {
"squashfs": "EMMC",
"ext2": "EMMC",
"ext3": "EMMC",
- "vfat": "EMMC"
+ "vfat": "EMMC",
+ "osip": "OSIP"
}
def GetTypeAndDevice(mount_point, info):
@@ -1489,18 +1490,27 @@ fi
'bonus_args': bonus_args}
# The install script location moved from /system/etc to /system/bin
- # in the L release. Parse the init.rc file to find out where the
+ # in the L release. Parse init.*.rc files to find out where the
# target-files expects it to be, and put it there.
sh_location = "etc/install-recovery.sh"
- try:
- with open(os.path.join(input_dir, "BOOT", "RAMDISK", "init.rc")) as f:
+ found = False
+ init_rc_dir = os.path.join(input_dir, "BOOT", "RAMDISK")
+ init_rc_files = os.listdir(init_rc_dir)
+ for init_rc_file in init_rc_files:
+ if (not init_rc_file.startswith('init.') or
+ not init_rc_file.endswith('.rc')):
+ continue
+
+ with open(os.path.join(init_rc_dir, init_rc_file)) as f:
for line in f:
m = re.match(r"^service flash_recovery /system/(\S+)\s*$", line)
if m:
sh_location = m.group(1)
- print("putting script in", sh_location)
+ found = True
break
- except (OSError, IOError) as e:
- print("failed to read init.rc: %s" % e)
+ if found:
+ break
+
+ print("putting script in", sh_location)
output_sink(sh_location, sh)
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index 80b8a44..825a7eb 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -323,6 +323,10 @@ class EdifyGenerator(object):
self.script.append(
'write_raw_image(package_extract_file("%(fn)s"), "%(device)s");'
% args)
+ elif partition_type == "OSIP":
+ self.script.append(
+ 'write_osip_image(package_extract_file("%(fn)s"), "%(device)s");'
+ % args)
elif partition_type == "EMMC":
if mapfn:
args["map"] = mapfn
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index ff0ccb9..bc40873 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -637,13 +637,14 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
if HasVendorPartition(input_zip):
system_progress -= 0.1
- script.AppendExtra("if is_mounted(\"/data\") then")
- script.ValidateSignatures("data")
- script.AppendExtra("else")
- script.Mount("/data")
- script.ValidateSignatures("data")
- script.Unmount("/data")
- script.AppendExtra("endif;")
+ if not OPTIONS.wipe_user_data:
+ script.AppendExtra("if is_mounted(\"/data\") then")
+ script.ValidateSignatures("data")
+ script.AppendExtra("else")
+ script.Mount("/data")
+ script.ValidateSignatures("data")
+ script.Unmount("/data")
+ script.AppendExtra("endif;")
if "selinux_fc" in OPTIONS.info_dict:
WritePolicyConfig(OPTIONS.info_dict["selinux_fc"], output_zip)
diff --git a/tools/releasetools/sparse_img.py b/tools/releasetools/sparse_img.py
index 10022d0..fa4406c 100644
--- a/tools/releasetools/sparse_img.py
+++ b/tools/releasetools/sparse_img.py
@@ -212,6 +212,16 @@ class SparseImage(object):
nonzero_blocks = []
reference = '\0' * self.blocksize
+ # Workaround for bug 23227672. For squashfs, we don't have a system.map. So
+ # the whole system image will be treated as a single file. But for some
+ # unknown bug, the updater will be killed due to OOM when writing back the
+ # patched image to flash (observed on lenok-userdebug MEA49). Prior to
+ # getting a real fix, we evenly divide the non-zero blocks into smaller
+ # groups (currently 1024 blocks or 4MB per group).
+ # Bug: 23227672
+ MAX_BLOCKS_PER_GROUP = 1024
+ nonzero_groups = []
+
f = self.simg_f
for s, e in remaining:
for b in range(s, e):
@@ -234,12 +244,22 @@ class SparseImage(object):
nonzero_blocks.append(b)
nonzero_blocks.append(b+1)
- assert zero_blocks or nonzero_blocks or clobbered_blocks
+ if len(nonzero_blocks) >= MAX_BLOCKS_PER_GROUP:
+ nonzero_groups.append(nonzero_blocks)
+ # Clear the list.
+ nonzero_blocks = []
+
+ if nonzero_blocks:
+ nonzero_groups.append(nonzero_blocks)
+ nonzero_blocks = []
+
+ assert zero_blocks or nonzero_groups or clobbered_blocks
if zero_blocks:
out["__ZERO"] = rangelib.RangeSet(data=zero_blocks)
- if nonzero_blocks:
- out["__NONZERO"] = rangelib.RangeSet(data=nonzero_blocks)
+ if nonzero_groups:
+ for i, blocks in enumerate(nonzero_groups):
+ out["__NONZERO-%d" % i] = rangelib.RangeSet(data=blocks)
if clobbered_blocks:
out["__COPY"] = clobbered_blocks
diff --git a/tools/repopick.py b/tools/repopick.py
index 64db7bf..1840a56 100755
--- a/tools/repopick.py
+++ b/tools/repopick.py
@@ -255,7 +255,11 @@ if __name__ == '__main__':
continue
change = int(change)
- review = [x for x in reviews if x['number'] == change][0]
+ review = next((x for x in reviews if x['number'] == change), None)
+ if review is None:
+ print('Change %d not found, skipping' % change)
+ continue
+
mergables.append({
'subject': review['subject'],
'project': review['project'],