auto-submit[bot] a8961f9449 Reverts "[fuchsia] Remove pm use in build_fuchsia_artifacts (#55832)" (flutter/engine#55922)
Reverts: flutter/engine#55832
Initiated by: zijiehe-google-com
Reason for reverting: may break roller.
Original PR Author: zijiehe-google-com

Reviewed By: {jrwang}

This change reverts the following previous change:
This change removes the in-house built pm-based build rules in favor of the high level fuchsia_component / fuchsia_package in the gn-sdk.

Also the use of pm in build_fuchsia_artifacts.py is removed as the placements of the binaries changed.
https://github.com/flutter/engine/pull/55445 was a previous attempt and it generates [a malformatted cipd](https://chrome-infra-packages.appspot.com/p/flutter/fuchsia/+/vU1Op26qgO5XYs9S8AqQMvBwgITD9hq3-2dIu2H5-iwC).

Bug: http://b/353729557, http://b/368608542

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-10-17 01:12:46 +00:00

69 lines
1.3 KiB
Python
Executable File

#!/usr/bin/env python3
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Copies paths, creates if they do not exist.
"""
import argparse
import errno
import json
import os
import platform
import shutil
import subprocess
import sys
def EnsureParentExists(path):
dir_name, _ = os.path.split(path)
if not os.path.exists(dir_name):
os.makedirs(dir_name)
def SameStat(s1, s2):
return s1.st_ino == s2.st_ino and s1.st_dev == s2.st_dev
def SameFile(f1, f2):
if not os.path.exists(f2):
return False
s1 = os.stat(f1)
s2 = os.stat(f2)
return SameStat(s1, s2)
def CopyPath(src, dst):
try:
EnsureParentExists(dst)
shutil.copytree(src, dst)
except OSError as exc:
if exc.errno == errno.ENOTDIR:
if not SameFile(src, dst):
shutil.copyfile(src, dst)
else:
raise
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--file-list', dest='file_list', action='store', required=True)
args = parser.parse_args()
files = open(args.file_list, 'r')
files_to_copy = files.read().split()
num_files = len(files_to_copy) // 2
for i in range(num_files):
CopyPath(files_to_copy[i], files_to_copy[num_files + i])
return 0
if __name__ == '__main__':
sys.exit(main())