Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support delta brave_installer #5484

Merged
merged 1 commit into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,27 @@ if (!is_ios) {
}
}

if (is_win) {
# create_installer_archive.py assumes that last_chrome_installer folder has
# courgette.exe.
if (build_delta_installer) {
copy("copy_courgette_binary") {
visibility = [ ":mini_installer_dependencies" ]
sources = [ "$root_out_dir/courgette.exe" ]
outputs = [ "$root_out_dir/$last_chrome_installer/{{source_file_part}}" ]
deps = [ "//courgette:copy_courgette_binaries" ]
}
}

group("mini_installer_dependencies") {
deps = [ ":brave" ]

if (build_delta_installer) {
deps += [ ":copy_courgette_binary" ]
}
}
}

group("brave") {
deps = ["build/$target_os:brave"]
if (!is_android && !is_ios) {
Expand Down Expand Up @@ -183,7 +204,6 @@ group("create_dist") {
}
if (is_win) {
deps += [
"//chrome/installer/mini_installer",
"build/win:create_signed_installer"
]

Expand Down
4 changes: 4 additions & 0 deletions build/config.gni
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ declare_args() {
brave_android_key_password = ""

skip_signing = false

# Used for generating delta installer on Win.
build_delta_installer = false
last_chrome_installer = ""
}

if (base_sparkle_update_url == "") {
Expand Down
32 changes: 8 additions & 24 deletions patches/chrome-installer-mini_installer-BUILD.gn.patch
Original file line number Diff line number Diff line change
@@ -1,38 +1,22 @@
diff --git a/chrome/installer/mini_installer/BUILD.gn b/chrome/installer/mini_installer/BUILD.gn
index 7d835183ab85b5b0eb628bba236ca44279b69366..862b8424b2ad0c5ebf11cdbe52a1691461ee4275 100644
index 7d835183ab85b5b0eb628bba236ca44279b69366..a4dbbfbc21f08ddc6a7c20b112fc5acb915f0aac 100644
--- a/chrome/installer/mini_installer/BUILD.gn
+++ b/chrome/installer/mini_installer/BUILD.gn
@@ -12,6 +12,10 @@ import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
@@ -11,6 +11,7 @@ import("//third_party/icu/config.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
import("//ui/base/ui_features.gni")
import("//v8/gni/v8.gni")
+import("//brave/build/config.gni")

+if (brave_chromium_build) {
+ import("//brave/build/config.gni")
+}
+
declare_args() {
# The Chrome archive is compressed in official builds to reduce the size of
# the installer. By default: non-official or component builds, a build mode
@@ -183,6 +187,22 @@ template("generate_mini_installer") {
@@ -183,6 +184,9 @@ template("generate_mini_installer") {
"//third_party/icu:icudata",
chrome_dll_target,
]
+ if (brave_chromium_build) {
+ if (skip_signing) { args += [ "--skip_signing" ] }
+ inputs -= [
+ "$root_out_dir/chrome.exe",
+ ]
+ inputs += [
+ "$root_out_dir/brave.exe",
+ "$root_out_dir/brave_resources.pak",
+ "$root_out_dir/brave_100_percent.pak",
+ "$root_out_dir/brave_200_percent.pak",
+ ]
+ deps += [
+ "//brave:packed_resources",
+ "//brave/build/win:copy_exe",
+ ]
+ }
+ if (skip_signing) { args += [ "--skip_signing" ] }
+ if (build_delta_installer) { args += [ "--setup_exe_format=DIFF", "--diff_algorithm=COURGETTE", "--last_chrome_installer",rebase_path("$root_out_dir/$last_chrome_installer", root_build_dir) ] }
+ deps += [ "//brave:mini_installer_dependencies" ]

if (enable_hidpi) {
args += [ "--enable_hidpi=1" ]
28 changes: 18 additions & 10 deletions patches/chrome-tools-build-win-create_installer_archive.py.patch
Original file line number Diff line number Diff line change
@@ -1,33 +1,41 @@
diff --git a/chrome/tools/build/win/create_installer_archive.py b/chrome/tools/build/win/create_installer_archive.py
index ffbf9ec0727b9a81eb4b8488ae67b797ec81a437..cdd0f6769f6629b855a56f267724673a79fec836 100755
index ffbf9ec0727b9a81eb4b8488ae67b797ec81a437..8d9052c3f6b6e068c5409d695362f187c142382a 100755
--- a/chrome/tools/build/win/create_installer_archive.py
+++ b/chrome/tools/build/win/create_installer_archive.py
@@ -20,7 +20,7 @@ import os
import shutil
import subprocess
import sys
-
@@ -42,6 +42,7 @@ SETUP_PATCH_FILE_PREFIX = "setup_patch"
TEMP_ARCHIVE_DIR = "temp_installer_archive"
VERSION_FILE = "VERSION"

+from create_installer_archive_helper import SignAndCopyPreSignedBinaries, BraveCopyAllFilesToStagingDir

ARCHIVE_DIR = "installer_archive"
g_archive_inputs = []

@@ -112,6 +112,7 @@ def CopyAllFilesToStagingDir(config, distribution, staging_dir, build_dir,
@@ -112,6 +113,7 @@ def CopyAllFilesToStagingDir(config, distribution, staging_dir, build_dir,
if enable_hidpi == '1':
CopySectionFilesToStagingDir(config, 'HIDPI', staging_dir, build_dir,
verbose)
+ BraveCopyAllFilesToStagingDir(config, staging_dir, g_archive_inputs)

if include_snapshotblob == '1':
CopySectionFilesToStagingDir(config, 'SNAPSHOTBLOB', staging_dir, build_dir,
@@ -551,6 +552,7 @@ def main(options):
@@ -179,7 +181,7 @@ def GetPrevVersion(build_dir, temp_dir, last_chrome_installer, output_name):
output_name + ARCHIVE_SUFFIX)
cmd = [lzma_exec,
'x',
- '-o"%s"' % temp_dir,
+ '-o%s' % temp_dir,
Copy link
Member Author

@simonhong simonhong May 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W/o this change, lzma_exec generates temp_dir under c:/ instead of using cwd's one.

Copy link
Member

@bsclifton bsclifton May 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ever possible for temp_dir to have spaces? If so, you might try something like -o.\"%s"' % temp_dir

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, thanks for catching. It would be much safer.
Changed to -o./"%s" % temp_dir.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't understand why this is needed, how does it work for chrome?

Copy link
Member Author

@simonhong simonhong May 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussing with @bridiver , This is reverted to '-o%s' % temp_dir, because relative path in out doesn't have space.
and asked about this in chromium shared slack channel.

prev_archive_file,
'Chrome-bin/*/chrome.dll',]
RunSystemCommand(cmd, options.verbose)
@@ -551,6 +553,7 @@ def main(options):
if prev_version:
version_numbers = prev_version.split('.')
prev_build_number = version_numbers[2] + '.' + version_numbers[3]
+ SignAndCopyPreSignedBinaries(options.skip_signing, options.output_dir, staging_dir, current_version)

# Name of the archive file built (for example - chrome.7z or
# patch-<old_version>-<new_version>.7z or patch-<new_version>.7z
@@ -622,6 +624,7 @@ def _ParseOptions():
@@ -622,6 +625,7 @@ def _ParseOptions():
'with the installer archive {x86|x64}.')
parser.add_option('-v', '--verbose', action='store_true', dest='verbose',
default=False)
Expand Down