am ce9635ec: am 2124d7e1: Merge "Only use a fixed timestamp when packaging."

* commit 'ce9635ec7ad6bcc6b9bc74136edb91847fe9e4ff':
  Only use a fixed timestamp when packaging.
This commit is contained in:
Tao Bao 2015-10-01 00:00:06 +00:00 committed by Android Git Automerger
commit 128f01cf58
2 changed files with 23 additions and 6 deletions

View File

@ -28,6 +28,7 @@ if sys.hexversion < 0x02070000:
print >> sys.stderr, "Python 2.7 or newer is required." print >> sys.stderr, "Python 2.7 or newer is required."
sys.exit(1) sys.exit(1)
import datetime
import errno import errno
import os import os
import shutil import shutil
@ -123,6 +124,12 @@ def CreateImage(input_dir, info_dict, what, block_list=None):
if fstab: if fstab:
image_props["fs_type"] = fstab["/" + what].fs_type image_props["fs_type"] = fstab["/" + what].fs_type
# Use a fixed timestamp (01/01/2009) when packaging the image.
# Bug: 24377993
epoch = datetime.datetime.fromtimestamp(0)
timestamp = (datetime.datetime(2009, 1, 1) - epoch).total_seconds()
image_props["timestamp"] = int(timestamp)
if what == "system": if what == "system":
fs_config_prefix = "" fs_config_prefix = ""
else: else:
@ -169,6 +176,12 @@ def AddUserdata(output_zip, prefix="IMAGES/"):
print "creating userdata.img..." print "creating userdata.img..."
# Use a fixed timestamp (01/01/2009) when packaging the image.
# Bug: 24377993
epoch = datetime.datetime.fromtimestamp(0)
timestamp = (datetime.datetime(2009, 1, 1) - epoch).total_seconds()
image_props["timestamp"] = int(timestamp)
# The name of the directory it is making an image out of matters to # The name of the directory it is making an image out of matters to
# mkyaffs2image. So we create a temp dir, and within it we create an # mkyaffs2image. So we create a temp dir, and within it we create an
# empty dir named "data", or a symlink to the DATA dir, # empty dir named "data", or a symlink to the DATA dir,
@ -213,6 +226,12 @@ def AddCache(output_zip, prefix="IMAGES/"):
print "creating cache.img..." print "creating cache.img..."
# Use a fixed timestamp (01/01/2009) when packaging the image.
# Bug: 24377993
epoch = datetime.datetime.fromtimestamp(0)
timestamp = (datetime.datetime(2009, 1, 1) - epoch).total_seconds()
image_props["timestamp"] = int(timestamp)
# The name of the directory it is making an image out of matters to # The name of the directory it is making an image out of matters to
# mkyaffs2image. So we create a temp dir, and within it we create an # mkyaffs2image. So we create a temp dir, and within it we create an
# empty dir named "cache", and build the image from that. # empty dir named "cache", and build the image from that.

View File

@ -20,7 +20,6 @@ Build image output_image_file from input_directory and properties_file.
Usage: build_image input_directory properties_file output_image_file Usage: build_image input_directory properties_file output_image_file
""" """
import datetime
import os import os
import os.path import os.path
import re import re
@ -401,11 +400,10 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
""" """
d = {} d = {}
# Use a fixed timestamp (01/01/2009) for all the files in an image. if "build.prop" in glob_dict:
# Bug: 24377993 bp = glob_dict["build.prop"]
epoch = datetime.datetime.fromtimestamp(0) if "ro.build.date.utc" in bp:
timestamp = (datetime.datetime(2009, 1, 1) - epoch).total_seconds() d["timestamp"] = bp["ro.build.date.utc"]
d["timestamp"] = int(timestamp)
def copy_prop(src_p, dest_p): def copy_prop(src_p, dest_p):
if src_p in glob_dict: if src_p in glob_dict: