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

Cleaup previous widevine vmp PRs #2693

Merged
merged 1 commit into from
Jun 19, 2019
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
2 changes: 0 additions & 2 deletions build/config.gni
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ declare_args() {
target_apk_base=""

skip_signing = false

brave_enable_cdm_host_verification = false
}

if (base_sparkle_update_url == "") {
Expand Down
19 changes: 19 additions & 0 deletions chromium_src/chrome/common/media/cdm_host_file_path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "chrome/common/media/cdm_host_file_path.h"

#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/stl_util.h"
#include "build/build_config.h"
#include "chrome/common/chrome_version.h"

#if defined(OS_MACOSX)
#include "base/mac/bundle_locations.h"
#include "chrome/common/buildflags.h"
#include "chrome/common/chrome_constants.h"
#endif

// All above headers copied from original cdm_host_file_path.cc are included
// to prevent below GOOGLE_CHROEM_BUILD affect them.

#define GOOGLE_CHROME_BUILD
#include "../../../../../chrome/common/media/cdm_host_file_path.cc" // NOLINT
#undef GOOGLE_CHROME_BUILD
94 changes: 18 additions & 76 deletions patches/chrome-tools-build-win-create_installer_archive.py.patch
Original file line number Diff line number Diff line change
@@ -1,92 +1,34 @@
diff --git a/chrome/tools/build/win/create_installer_archive.py b/chrome/tools/build/win/create_installer_archive.py
index b16b16bdc439014bf647f80ca9b7ce8215cfbb6c..cbe2de456427ec4ac1c9073f5b124dc36394281a 100755
index b16b16bdc439014bf647f80ca9b7ce8215cfbb6c..c9f18e177ac495bde65f2d0a80205d88136825f0 100755
--- a/chrome/tools/build/win/create_installer_archive.py
+++ b/chrome/tools/build/win/create_installer_archive.py
@@ -112,6 +112,71 @@ def CopyAllFilesToStagingDir(config, distribution, staging_dir, build_dir,
@@ -21,7 +21,7 @@ import re
import shutil
import subprocess
import sys
-
+from create_installer_archive_helper import SignAndCopyPreSignedBinaries, BraveCopyAllFilesToStagingDir

ARCHIVE_DIR = "installer_archive"

@@ -111,7 +111,7 @@ def CopyAllFilesToStagingDir(config, distribution, staging_dir, build_dir,
staging_dir, build_dir)
if enable_hidpi == '1':
CopySectionFilesToStagingDir(config, 'HIDPI', staging_dir, build_dir)

+ CopyBraveExtensionLocalization(config, staging_dir)
+ CopyBraveRewardsExtensionLocalization(config, staging_dir)
+
+def CopyBraveExtensionLocalization(config, staging_dir):
+ """Copies extension localization files from
+ \\brave\components/brave_extension\extension/brave_extension\_locales to
+ \\<out_gen_dir>\chrome\installer\mini_installer\mini_installer\temp_installer_archive\Chrome-bin\<version>\resources\brave_extension\_locales
+ """
+ brave_extension_dir = os.path.realpath(os.path.dirname(os.path.realpath(__file__)) )
+ brave_extension_dir = os.path.realpath(os.path.join(brave_extension_dir,
+ os.pardir, os.pardir, os.pardir, os.pardir, 'brave', 'components', 'brave_extension', 'extension', 'brave_extension'))
+ locales_src_dir_path = os.path.join(brave_extension_dir, '_locales')
+ locales_dest_path = staging_dir
+ locales_dest_path = os.path.join(locales_dest_path, config.get('GENERAL', 'brave_resources.pak'),
+ 'resources', 'brave_extension', '_locales')
+ locales_dest_path = os.path.realpath(locales_dest_path)
+ try:
+ shutil.rmtree(locales_dest_path)
+ except:
+ pass
+ 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 name in files:
+ rel_dir = os.path.relpath(root, locales_dest_path)
+ rel_file = os.path.join(rel_dir, name)
+ candidate = os.path.join('.', 'resources', 'brave_extension' '_locales', rel_file)
+ g_archive_inputs.append(candidate)
+
+def CopyBraveRewardsExtensionLocalization(config, staging_dir):
+ """Copies extension localization files from
+ \\brave\components\brave_rewards\extension\brave_rewards\_locales to
+ \\<out_gen_dir>\chrome\installer\mini_installer\mini_installer\temp_installer_archive\Chrome-bin\<version>\resources\brave_rewards\_locales
+ """
+ brave_extension_dir = os.path.realpath(os.path.dirname(os.path.realpath(__file__)) )
+ brave_extension_dir = os.path.realpath(os.path.join(brave_extension_dir,
+ os.pardir, os.pardir, os.pardir, os.pardir, 'brave', 'components', 'brave_rewards', 'resources', 'extension', 'brave_rewards'))
+ locales_src_dir_path = os.path.join(brave_extension_dir, '_locales')
+ locales_dest_path = staging_dir
+ locales_dest_path = os.path.join(locales_dest_path, config.get('GENERAL', 'brave_resources.pak'),
+ 'resources', 'brave_rewards', '_locales')
+ locales_dest_path = os.path.realpath(locales_dest_path)
+ try:
+ shutil.rmtree(locales_dest_path)
+ except:
+ pass
+ 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 name in files:
+ rel_dir = os.path.relpath(root, locales_dest_path)
+ rel_file = os.path.join(rel_dir, name)
+ candidate = os.path.join('.', 'resources', 'brave_rewards' '_locales', rel_file)
+ g_archive_inputs.append(candidate)
+
+def CopyPreSignedBinaries(output_dir, staging_dir, current_version):
+ """Copies already signed three binaries - brave.exe, chrome.dll and chrome_child.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)
+ shutil.copy(os.path.join(src_dir, 'brave.exe'), chrome_dir)
+ shutil.copy(os.path.join(src_dir, 'chrome.dll'), version_dir)
+ shutil.copy(os.path.join(src_dir, 'chrome_child.dll'), version_dir)
-
+ BraveCopyAllFilesToStagingDir(config, staging_dir, g_archive_inputs)

def CopySectionFilesToStagingDir(config, section, staging_dir, src_dir):
"""Copies installer archive files specified in section from src_dir to
@@ -531,6 +596,11 @@ def main(options):
@@ -530,6 +530,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)

+ if not options.skip_signing:
+ from sign_binaries import sign_binaries
+ sign_binaries(staging_dir)
+ CopyPreSignedBinaries(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
archive_file = CreateArchiveFile(options, staging_dir,
@@ -599,6 +669,7 @@ def _ParseOptions():
@@ -599,6 +600,7 @@ def _ParseOptions():
'with the installer archive {x86|x64}.')
parser.add_option('-v', '--verbose', action='store_true', dest='verbose',
default=False)
Expand Down
22 changes: 0 additions & 22 deletions patches/media-media_options.gni.patch

This file was deleted.

65 changes: 65 additions & 0 deletions script/create_installer_archive_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env python

# Copyright (c) 2019 The Brave Authors. All rights reserved.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/. */

import os
import shutil

CHROME_DIR = "Chrome-bin"


def SignAndCopyPreSignedBinaries(skip_signing, output_dir, staging_dir, current_version):
if not skip_signing:
from sign_binaries import sign_binaries
sign_binaries(staging_dir)
"""Copies already signed three binaries - brave.exe, chrome.dll and chrome_child.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)
shutil.copy(os.path.join(src_dir, 'brave.exe'), chrome_dir)
shutil.copy(os.path.join(src_dir, 'chrome.dll'), version_dir)
shutil.copy(os.path.join(src_dir, 'chrome_child.dll'), version_dir)


def BraveCopyAllFilesToStagingDir(config, staging_dir, g_archive_inputs):
current_dir = os.path.realpath(os.path.dirname(os.path.realpath(__file__)))

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,
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,
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
"""
locales_dest_path = staging_dir
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.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 name in files:
rel_dir = os.path.relpath(root, locales_dest_path)
rel_file = os.path.join(rel_dir, name)
candidate = os.path.join('.', 'resources', extension_name, '_locales', rel_file)
g_archive_inputs.append(candidate)