Commit a9dac60b authored by Takuto Ikuta's avatar Takuto Ikuta Committed by Commit Bot

Generate deterministic zip file for remoting

build_utils.ZipDir uses fixed timestamp and this makes zipped file deterministic.

This is a part of effort to utilize cache of test execution on swarming.

Bug: 870611
Change-Id: Ie370f1f5a3e08834c6280b0088f90b31d038e3be
Reviewed-on: https://chromium-review.googlesource.com/1163349
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Reviewed-by: default avatarJamie Walch <jamiewalch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581034}
parent e3d2517b
......@@ -21,6 +21,10 @@ import subprocess
import sys
import zipfile
sys.path.append(os.path.join(
os.path.dirname(__file__), os.pardir, os.pardir, os.pardir,
"build", "android", "gyp"))
from util import build_utils
def cleanDir(dir):
"""Deletes and recreates the dir to make sure it is clean.
......@@ -54,23 +58,6 @@ def buildDefDictionary(definitions):
return defs
def createZip(zip_path, directory):
"""Creates a zipfile at zip_path for the given directory.
Args:
zip_path: Path to zip file to create.
directory: Directory with contents to archive.
"""
zipfile_base = os.path.splitext(os.path.basename(zip_path))[0]
zip = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED)
for (root, dirs, files) in os.walk(directory):
for f in files:
full_path = os.path.join(root, f)
rel_path = os.path.relpath(full_path, directory)
zip.write(full_path, os.path.join(zipfile_base, rel_path))
zip.close()
def remapSrcFile(dst_root, src_roots, src_file):
"""Calculates destination file path and creates directory.
......@@ -206,7 +193,7 @@ def buildHostArchive(temp_dir, zip_path, source_file_roots, source_files,
else:
shutil.copy2(bs, dst_file)
createZip(zip_path, temp_dir)
build_utils.ZipDir(zip_path, temp_dir)
def error(msg):
......
......@@ -36,6 +36,10 @@ action("remoting_me2me_host_archive") {
script = "//remoting/host/installer/build-installer-archive.py"
sources = [
"//build/android/gyp/util/build_utils.py",
]
args = [
rebase_path("$target_gen_dir/remoting_installation", root_build_dir),
rebase_path(zip_path, root_build_dir),
......
......@@ -8,6 +8,10 @@ import("//remoting/host/installer/win/generate_clsids.gni")
action("remoting_me2me_host_archive") {
script = "//remoting/host/installer/build-installer-archive.py"
sources = [
"//build/android/gyp/util/build_utils.py",
]
deps = [
"//remoting/host:remoting_native_messaging_manifests",
"//remoting/host:remoting_start_host",
......
......@@ -23,7 +23,11 @@ import shutil
import subprocess
import sys
import time
import zipfile
sys.path.append(os.path.join(
os.path.dirname(__file__), os.pardir, os.pardir,
"build", "android", "gyp"))
from util import build_utils
# Update the module path, assuming that this script is in src/remoting/webapp,
# and that the google_api_keys module is in src/google_apis. Note that
......@@ -46,18 +50,6 @@ def findAndReplace(filepath, findString, replaceString):
os.remove(oldFilepath)
def createZip(zip_path, directory):
"""Creates a zipfile at zip_path for the given directory."""
zipfile_base = os.path.splitext(os.path.basename(zip_path))[0]
zip = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED)
for (root, dirs, files) in os.walk(directory):
for f in files:
full_path = os.path.join(root, f)
rel_path = os.path.relpath(full_path, directory)
zip.write(full_path, os.path.join(zipfile_base, rel_path))
zip.close()
def replaceString(destination, placeholder, value):
findAndReplace(os.path.join(destination, 'plugin_settings.js'),
"'" + placeholder + "'", "'" + value + "'")
......@@ -344,7 +336,7 @@ def buildWebApp(buildtype, version, destination, zip_path,
context)
# Make the zipfile.
createZip(zip_path, destination)
build_utils.ZipDir(zip_path, destination)
return 0
......
......@@ -214,6 +214,10 @@ template("desktop_remoting_webapp") {
action(target_name) {
script = "//remoting/webapp/build-webapp.py"
sources = [
"//build/android/gyp/util/build_utils.py",
]
output_dir = invoker.output_dir
zip_path = invoker.zip_path
extra_files = invoker.extra_files
......
......@@ -22,10 +22,6 @@
# https://crbug.com/330263
'linux': [
'ppapi_nacl_tests_pnacl_newlib_x64.nexe',
# TODO(tikuta): Remove this when crbug.com/870611 is fixed.
'remoting-webapp.v2.zip',
'zucchini_apply_fuzzer_seed_corpus.zip',
],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment