[fuchsia] Use manifest file to better replicate the existing build (#10102)

* Use manifest file to better replicate the existing build

Also fix app/bin error

* Add remaining shit

* patch in the remaining stuff

* Update BUILD.gn
This commit is contained in:
Kaushik Iska 2019-07-24 13:57:46 -07:00 committed by GitHub
parent 72341ed032
commit 4bf81b8cf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 2 deletions

View File

@ -197,6 +197,7 @@ template("jit_runner") {
fuchsia_sdk_base = "//fuchsia/sdk/$host_os/arch/$host_cpu"
fuchsia_sdk_lib = "$fuchsia_sdk_base/lib"
sysroot_lib = "$fuchsia_sdk_base/sysroot/lib"
sysroot_dist_lib = "$fuchsia_sdk_base/sysroot/dist/lib"
libraries = [
{
@ -231,6 +232,10 @@ template("jit_runner") {
name = "libc.so"
path = rebase_path("$sysroot_lib")
},
{
name = "ld.so.1"
path = rebase_path("$sysroot_dist_lib")
},
# Note, we use the md5 hashes here because of gn limitations of json parsing.
# This is a hack, and we can migrate to a better way soon.
@ -244,6 +249,11 @@ template("jit_runner") {
path = rebase_path(
"$clang_base/${clang_manifest_json.md5_916c01a85e3353f124776599819ecb1c}")
},
{
name = "libunwind.so.1"
path = rebase_path(
"$clang_base/${clang_manifest_json.md5_beb70f40d525448b39ea87d9f5811e56}")
},
]
meta = [

View File

@ -14,9 +14,29 @@ import subprocess
import sys
# Generates the manifest and returns the file.
def GenerateManifest(package_dir):
full_paths = []
for root, dirs, files in os.walk(package_dir):
for f in files:
common_prefix = os.path.commonprefix([root, package_dir])
rel_path = os.path.relpath(os.path.join(root, f), common_prefix)
from_package = os.path.abspath(os.path.join(package_dir, rel_path))
full_paths.append('%s=%s' % (rel_path, from_package))
parent_dir = os.path.abspath(os.path.join(package_dir, os.pardir))
manifest_file_name = os.path.basename(package_dir) + '.manifest'
manifest_path = os.path.join(parent_dir, manifest_file_name)
with open(manifest_path, 'w') as f:
for item in full_paths:
f.write("%s\n" % item)
return manifest_path
def CreateFarPackage(pm_bin, package_dir, signing_key, dst_dir):
manifest_path = GenerateManifest(package_dir)
pm_command_base = [
pm_bin, '-m', package_dir, '-k', signing_key, '-o', dst_dir
pm_bin, '-m', manifest_path, '-k', signing_key, '-o', dst_dir
]
# Build the package

View File

@ -39,7 +39,7 @@ template("package_dir") {
far_base_dir = "$root_out_dir/${pkg_target_name}_far"
copy_sources = [ "$root_out_dir/${invoker.binary}" ]
copy_outputs = [ "$far_base_dir/app/bin" ]
copy_outputs = [ "$far_base_dir/bin/app" ]
foreach(res, pkg.resources) {
copy_sources += [ res.path ]

View File

@ -30,6 +30,8 @@ def main():
key, val = line.strip().split('=')
md5 = hashlib.md5(key.encode()).hexdigest()
hash_key = 'md5_%s' % md5
# Uncomment this line to get the hash keys
# print val, hash_key
output[hash_key] = os.path.dirname(val)
print(json.dumps(output))