summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2015-09-30 16:01:14 -0700
committerTao Bao <tbao@google.com>2015-10-12 09:55:26 -0700
commit338da607e89bcb67394e0580fe02bb1ae0c69b8b (patch)
tree621e425ddaf8a35952b41cfe14086f20ec91664c /tools
parent1b5eef1b490cc143474ec74d58369aac9bf6629e (diff)
downloadbuild-338da607e89bcb67394e0580fe02bb1ae0c69b8b.zip
build-338da607e89bcb67394e0580fe02bb1ae0c69b8b.tar.gz
build-338da607e89bcb67394e0580fe02bb1ae0c69b8b.tar.bz2
DO NOT MERGE: Only use a fixed timestamp when packaging.
This CL changes to use a fixed timestamp only when packaging into the target_files zip. Bug: 24377993 Change-Id: I01d136f4b99e1eff80c559192d93db83a3c5c0a4 (cherry picked from commit 822f5840c0f498e33829a0a00f383d9be3a7e913)
Diffstat (limited to 'tools')
-rwxr-xr-xtools/releasetools/add_img_to_target_files.py19
-rwxr-xr-xtools/releasetools/build_image.py1
2 files changed, 20 insertions, 0 deletions
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index f7332b2..f2bf1e1 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -28,6 +28,7 @@ if sys.hexversion < 0x02070000:
print >> sys.stderr, "Python 2.7 or newer is required."
sys.exit(1)
+import datetime
import errno
import os
import tempfile
@@ -122,6 +123,12 @@ def CreateImage(input_dir, info_dict, what, block_list=None):
if fstab:
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":
fs_config_prefix = ""
else:
@@ -173,6 +180,12 @@ def AddUserdata(output_zip, prefix="IMAGES/"):
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
# mkyaffs2image. So we create a temp dir, and within it we create an
# empty dir named "data", and build the image from that.
@@ -210,6 +223,12 @@ def AddCache(output_zip, prefix="IMAGES/"):
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
# mkyaffs2image. So we create a temp dir, and within it we create an
# empty dir named "cache", and build the image from that.
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 4b43c0c..357a666 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -399,6 +399,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
mount_point: such as "system", "data" etc.
"""
d = {}
+
if "build.prop" in glob_dict:
bp = glob_dict["build.prop"]
if "ro.build.date.utc" in bp: