Improve error when Win. delta update build fails
Previously, trying to generate a delta update with
--last_chrome_installer from the same source and target versions gave:
...
Did not find an archive input file for ".../chrome.dll"
Now we get:
Cannot create delta update files between the same source and target
version 99.1.38.5. Please increment the Chrome version (for
instance by rebasing your changes against a later upstream
version). Or pass files representing a lower version to
--last_chrome_installer.
This commit also fixes some pylint errors in the affected code.
This commit is contained in:
@@ -11,14 +11,26 @@ import shutil
|
||||
CHROME_DIR = "Chrome-bin"
|
||||
|
||||
|
||||
def SignAndCopyPreSignedBinaries(skip_signing, output_dir, staging_dir, current_version):
|
||||
def CheckDeltaUpdatePrecondition(last_chrome_installer, prev_version,
|
||||
curr_version):
|
||||
if last_chrome_installer and prev_version == curr_version:
|
||||
raise Exception("Cannot create delta update files between the same "
|
||||
"source and target version %s. Please increment the "
|
||||
"Chrome version (for instance by rebasing your changes "
|
||||
"against a later upstream version). Or pass files "
|
||||
"representing a lower version to "
|
||||
"--last_chrome_installer." % prev_version)
|
||||
|
||||
|
||||
def SignAndCopyPreSignedBinaries(skip_signing, output_dir, staging_dir,
|
||||
current_version):
|
||||
if not skip_signing:
|
||||
from sign_binaries import sign_binaries, sign_binary
|
||||
sign_binaries(staging_dir)
|
||||
sign_binary(os.path.join(output_dir, 'setup.exe'))
|
||||
"""Copies already signed three binaries - brave.exe and chrome.dll
|
||||
These files are signed during the build phase to create widevine sig files.
|
||||
"""
|
||||
# Copies already signed three binaries - brave.exe and chrome.dll
|
||||
# These files are signed during the build phase to create widevine sig
|
||||
# files.
|
||||
src_dir = os.path.join(output_dir, 'signed_binaries')
|
||||
chrome_dir = os.path.join(staging_dir, CHROME_DIR)
|
||||
version_dir = os.path.join(chrome_dir, current_version)
|
||||
@@ -31,33 +43,38 @@ def BraveCopyAllFilesToStagingDir(config, staging_dir, g_archive_inputs):
|
||||
|
||||
brave_extension_locales_src_dir_path = os.path.realpath(
|
||||
os.path.join(current_dir, os.pardir, 'components',
|
||||
'brave_extension', 'extension', 'brave_extension', '_locales'))
|
||||
CopyExtensionLocalization('brave_extension', brave_extension_locales_src_dir_path,
|
||||
'brave_extension', 'extension', 'brave_extension',
|
||||
'_locales'))
|
||||
CopyExtensionLocalization('brave_extension',
|
||||
brave_extension_locales_src_dir_path,
|
||||
config, staging_dir, g_archive_inputs)
|
||||
|
||||
brave_rewards_locales_src_dir_path = os.path.realpath(
|
||||
os.path.join(current_dir, os.pardir, 'components',
|
||||
'brave_rewards', 'resources', 'extension', 'brave_rewards', '_locales'))
|
||||
CopyExtensionLocalization('brave_rewards', brave_rewards_locales_src_dir_path,
|
||||
'brave_rewards', 'resources', 'extension', 'brave_rewards',
|
||||
'_locales'))
|
||||
CopyExtensionLocalization('brave_rewards',
|
||||
brave_rewards_locales_src_dir_path,
|
||||
config, staging_dir, g_archive_inputs)
|
||||
|
||||
|
||||
def CopyExtensionLocalization(extension_name, locales_src_dir_path, config, staging_dir, g_archive_inputs):
|
||||
def CopyExtensionLocalization(extension_name, locales_src_dir_path, config,
|
||||
staging_dir, g_archive_inputs):
|
||||
"""Copies extension localization files from locales_src_dir_path to
|
||||
\\<out_gen_dir>\\chrome\\installer\\mini_installer\\mini_installer\\temp_installer_archive
|
||||
\\Chrome-bin\\<version>\\resources\\extension_name\\_locales
|
||||
\\<out_gen_dir>\\chrome\\installer\\mini_installer\\mini_installer
|
||||
\\temp_installer_archive\\Chrome-bin\\<version>\\resources\\extension_name
|
||||
\\_locales
|
||||
"""
|
||||
locales_dest_path = staging_dir
|
||||
locales_dest_path = os.path.join(locales_dest_path, config.get('GENERAL', 'brave_resources.pak'),
|
||||
locales_dest_path = os.path.join(locales_dest_path,
|
||||
config.get('GENERAL',
|
||||
'brave_resources.pak'),
|
||||
'resources', extension_name, '_locales')
|
||||
locales_dest_path = os.path.realpath(locales_dest_path)
|
||||
try:
|
||||
shutil.rmtree(locales_dest_path)
|
||||
except Exception as e:
|
||||
pass
|
||||
shutil.rmtree(locales_dest_path, ignore_errors=True)
|
||||
shutil.copytree(locales_src_dir_path, locales_dest_path)
|
||||
# Files are copied, but we need to inform g_archive_inputs about that
|
||||
for root, dirs, files in os.walk(locales_dest_path):
|
||||
for root, _, files in os.walk(locales_dest_path):
|
||||
for name in files:
|
||||
rel_dir = os.path.relpath(root, locales_dest_path)
|
||||
rel_file = os.path.join(rel_dir, name)
|
||||
|
||||
Reference in New Issue
Block a user