patcher: Skip missing platform-specific third-party directories

This commit is contained in:
Marshall Greenblatt 2022-07-26 10:09:01 -07:00
parent 9af494d36c
commit 5034749463
2 changed files with 14 additions and 1 deletions

View File

@ -166,6 +166,14 @@ for patch in patches:
msg('Reading patch file %s' % patch_file)
if 'path' in patch:
patch_root_abs = os.path.abspath(os.path.join(src_dir, patch['path']))
if not os.path.isdir(patch_root_abs):
line = 'Target directory does not exist: %s' % patch_root_abs
msg(line)
if options.resave:
# Report as a fatal error for manual resave only, as the missing
# directory may be platform-specific.
failed_patches[patch['name']] = [line]
continue
else:
patch_root_abs = src_dir

View File

@ -30,7 +30,8 @@ def write_note(type, note):
def apply_patch_file(patch_file, patch_dir):
''' Apply a specific patch file in optional patch directory. '''
patch_path = os.path.join(cef_patch_dir, 'patches', patch_file + '.patch')
patch_name = patch_file + '.patch'
patch_path = os.path.join(cef_patch_dir, 'patches', patch_name)
if patch_dir is None or len(patch_dir) == 0:
patch_dir = src_dir
@ -39,6 +40,10 @@ def apply_patch_file(patch_file, patch_dir):
# Apply patch relative to the Chromium 'src' directory.
patch_dir = os.path.join(src_dir, patch_dir)
patch_dir = os.path.abspath(patch_dir)
if not os.path.isdir(patch_dir):
sys.stdout.write('\nApply %s in %s\n' % (patch_name, patch_dir))
sys.stdout.write('... target directory does not exist (skipping).\n')
return 'skip'
result = git_apply_patch_file(patch_path, patch_dir)
if result == 'fail':