Merge "releasetools: Remove the workarounds for mkyaffs2image." am: d2a09ef2d1 am: 9c531a9bef

am: c15e55f802

Change-Id: I1b5d4df1f4cb9237ab8e7b66b4c68f8fb3d6b69d
This commit is contained in:
Tao Bao
2017-10-18 22:29:15 +00:00
committed by android-build-merger

View File

@@ -52,7 +52,6 @@ if sys.hexversion < 0x02070000:
sys.exit(1) sys.exit(1)
import datetime import datetime
import errno
import hashlib import hashlib
import os import os
import shlex import shlex
@@ -215,22 +214,6 @@ def AddDtbo(output_zip, prefix="IMAGES/"):
def CreateImage(input_dir, info_dict, what, output_file, block_list=None): def CreateImage(input_dir, info_dict, what, output_file, block_list=None):
print("creating " + what + ".img...") print("creating " + what + ".img...")
# The name of the directory it is making an image out of matters to
# mkyaffs2image. It wants "system" but we have a directory named
# "SYSTEM", so create a symlink.
temp_dir = tempfile.mkdtemp()
OPTIONS.tempfiles.append(temp_dir)
try:
os.symlink(os.path.join(input_dir, what.upper()),
os.path.join(temp_dir, what))
except OSError as e:
# bogus error on my mac version?
# File "./build/tools/releasetools/img_from_target_files"
# os.path.join(OPTIONS.input_tmp, "system"))
# OSError: [Errno 17] File exists
if e.errno == errno.EEXIST:
pass
image_props = build_image.ImagePropFromGlobalDict(info_dict, what) image_props = build_image.ImagePropFromGlobalDict(info_dict, what)
fstab = info_dict["fstab"] fstab = info_dict["fstab"]
mount_point = "/" + what mount_point = "/" + what
@@ -272,7 +255,7 @@ def CreateImage(input_dir, info_dict, what, output_file, block_list=None):
hash_seed = "hash_seed-" + uuid_seed hash_seed = "hash_seed-" + uuid_seed
image_props["hash_seed"] = str(uuid.uuid5(uuid.NAMESPACE_URL, hash_seed)) image_props["hash_seed"] = str(uuid.uuid5(uuid.NAMESPACE_URL, hash_seed))
succ = build_image.BuildImage(os.path.join(temp_dir, what), succ = build_image.BuildImage(os.path.join(input_dir, what.upper()),
image_props, output_file.name) image_props, output_file.name)
assert succ, "build " + what + ".img image failed" assert succ, "build " + what + ".img image failed"
@@ -322,21 +305,11 @@ def AddUserdata(output_zip, prefix="IMAGES/"):
timestamp = (datetime.datetime(2009, 1, 1) - epoch).total_seconds() timestamp = (datetime.datetime(2009, 1, 1) - epoch).total_seconds()
image_props["timestamp"] = int(timestamp) image_props["timestamp"] = int(timestamp)
# The name of the directory it is making an image out of matters to if OPTIONS.info_dict.get("userdata_img_with_data") == "true":
# mkyaffs2image. So we create a temp dir, and within it we create an user_dir = os.path.join(OPTIONS.input_tmp, "DATA")
# empty dir named "data", or a symlink to the DATA dir,
# and build the image from that.
temp_dir = tempfile.mkdtemp()
OPTIONS.tempfiles.append(temp_dir)
user_dir = os.path.join(temp_dir, "data")
empty = (OPTIONS.info_dict.get("userdata_img_with_data") != "true")
if empty:
# Create an empty dir.
os.mkdir(user_dir)
else: else:
# Symlink to the DATA dir. user_dir = tempfile.mkdtemp()
os.symlink(os.path.join(OPTIONS.input_tmp, "DATA"), OPTIONS.tempfiles.append(user_dir)
user_dir)
fstab = OPTIONS.info_dict["fstab"] fstab = OPTIONS.info_dict["fstab"]
if fstab: if fstab:
@@ -469,13 +442,8 @@ def AddCache(output_zip, prefix="IMAGES/"):
timestamp = (datetime.datetime(2009, 1, 1) - epoch).total_seconds() timestamp = (datetime.datetime(2009, 1, 1) - epoch).total_seconds()
image_props["timestamp"] = int(timestamp) image_props["timestamp"] = int(timestamp)
# The name of the directory it is making an image out of matters to user_dir = tempfile.mkdtemp()
# mkyaffs2image. So we create a temp dir, and within it we create an OPTIONS.tempfiles.append(user_dir)
# empty dir named "cache", and build the image from that.
temp_dir = tempfile.mkdtemp()
OPTIONS.tempfiles.append(temp_dir)
user_dir = os.path.join(temp_dir, "cache")
os.mkdir(user_dir)
fstab = OPTIONS.info_dict["fstab"] fstab = OPTIONS.info_dict["fstab"]
if fstab: if fstab: