Skip to content

Commit

Permalink
ci: auto-3way patches and detect changes (#23033)
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon committed Apr 8, 2020
1 parent 6a0c701 commit bafcac7
Show file tree
Hide file tree
Showing 32 changed files with 308 additions and 352 deletions.
24 changes: 23 additions & 1 deletion .circleci/config.yml
Expand Up @@ -217,7 +217,25 @@ step-gclient-sync: &step-gclient-sync
$GCLIENT_EXTRA_ARGS \
"$CIRCLE_REPOSITORY_URL"
gclient sync --with_branch_heads --with_tags
ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 gclient sync --with_branch_heads --with_tags
# Re-export all the patches to check if there were changes.
python src/electron/script/export_all_patches.py src/electron/patches/config.json
cd src/electron
git update-index --refresh || true
if ! git diff-index --quiet HEAD --; then
# There are changes to the patches. Make a git commit with the updated patches
git add patches
GIT_COMMITTER_NAME="Electron Bot" GIT_COMMITTER_EMAIL="anonymous@electronjs.org" git commit -m "update patches" --author="Electron Bot <anonymous@electronjs.org>"
# Export it
mkdir -p ../../patches
git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
echo
echo "======================================================================"
echo "There were changes to the patches when applying."
echo "Check the CI artifacts for a patch you can apply to fix it."
echo "======================================================================"
exit 1
fi
fi
step-setup-env-for-build: &step-setup-env-for-build
Expand Down Expand Up @@ -764,6 +782,8 @@ steps-checkout-fast: &steps-checkout-fast
- *step-set-git-cache-path
# This sync call only runs if .circle-sync-done is an EMPTY file
- *step-gclient-sync
- store_artifacts:
path: patches
# These next few steps reset Electron to the correct commit regardless of which cache was restored
- run:
name: Wipe Electron
Expand Down Expand Up @@ -795,6 +815,8 @@ steps-checkout-and-save-cache: &steps-checkout-and-save-cache
- *step-set-git-cache-path
# This sync call only runs if .circle-sync-done is an EMPTY file
- *step-gclient-sync
- store_artifacts:
path: patches
- *step-save-git-cache
# These next few steps reset Electron to the correct commit regardless of which cache was restored
- run:
Expand Down
2 changes: 2 additions & 0 deletions DEPS
Expand Up @@ -152,3 +152,5 @@ hooks = [
recursedeps = [
'src',
]

# Touch DEPS to bust cache
Expand Up @@ -28,10 +28,10 @@ index ab39ee01a47c15da57b531d2c711649f1685091b..7a0f3b32b101b34195c57637b227062d
Nick Shaforostov
+Jaime Bernardo
diff --git a/src/common/angleutils.h b/src/common/angleutils.h
index 131d5796da4399df1144bc349c506cde8220973a..3a1391e29b72e7ec356e44c7ced202cc29773fb3 100644
index d5d3ca8312a61e2debf304cac21f3536ef6cb472..3c93d1bfdca21bab33168c144ea5fb6002bff5ee 100644
--- a/src/common/angleutils.h
+++ b/src/common/angleutils.h
@@ -345,4 +345,10 @@ std::string ToString(const T &value)
@@ -333,4 +333,10 @@ std::string ToString(const T &value)
# define ANGLE_MAYBE_UNUSED
#endif // __has_cpp_attribute(maybe_unused)

Expand Down
2 changes: 1 addition & 1 deletion patches/chromium/.patches
Expand Up @@ -100,4 +100,4 @@ move_readablestream_requests_onto_the_stack_before_iteration.patch
streams_convert_state_dchecks_to_checks.patch
audiocontext_haspendingactivity_unless_it_s_closed.patch
protect_automatic_pull_handlers_with_mutex.patch
cherry-pick-adc8f05aa3ab.patch
handle_err_cache_race_in_dodoneheadersaddtoentrycomplete.patch
114 changes: 0 additions & 114 deletions patches/chromium/cherry-pick-db71a0afc1d0.patch

This file was deleted.

@@ -1,7 +1,7 @@
From adc8f05aa3abbde50a7b9171c7311aba08c07b00 Mon Sep 17 00:00:00 2001
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Alex Turner <alexmt@chromium.org>
Date: Fri, 20 Sep 2019 20:21:41 +0000
Subject: [PATCH] Handle ERR_CACHE_RACE in DoDoneHeadersAddToEntryComplete
Subject: Handle ERR_CACHE_RACE in DoDoneHeadersAddToEntryComplete

Crashes have been observed in the wild that may be due to
ERR_CACHE_RACE being sent to STATE_DONE_HEADERS_ADD_TO_ENTRY_COMPLETE.
Expand All @@ -16,15 +16,12 @@ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1814843
Commit-Queue: Alex Turner <alexmt@chromium.org>
Reviewed-by: Shivani Sharma <shivanisha@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698597}
---
net/http/http_cache_transaction.cc | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc
index 6f2577de617ec..bc1193f4b7d43 100644
index b1249dfda91060aa1792ee6841b54eaaa2bf95da..05c2e8a52860cb718ee2dbbfc1210956492d8db9 100644
--- a/net/http/http_cache_transaction.cc
+++ b/net/http/http_cache_transaction.cc
@@ -1430,8 +1430,15 @@ int HttpCache::Transaction::DoDoneHeadersAddToEntryComplete(int result) {
@@ -1433,8 +1433,15 @@ int HttpCache::Transaction::DoDoneHeadersAddToEntryComplete(int result) {
DCHECK(response_.headers);

cache_pending_ = false;
Expand All @@ -41,7 +38,7 @@ index 6f2577de617ec..bc1193f4b7d43 100644
DCHECK_NE(response_.headers->response_code(), 304);
DCHECK(cache_->CanTransactionWriteResponseHeaders(
entry_, this, partial_ != nullptr, false));
@@ -2078,6 +2085,7 @@ int HttpCache::Transaction::DoHeadersPhaseCannotProceed(int result) {
@@ -2081,6 +2088,7 @@ int HttpCache::Transaction::DoHeadersPhaseCannotProceed(int result) {
SetRequest(net_log_);

entry_ = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion patches/node/build_add_gn_build_files.patch
Expand Up @@ -1534,7 +1534,7 @@ index 0000000000000000000000000000000000000000..f3c5c798c0aefcb8cf9b1570a7b4817c
+ args = rebase_path(inputs + outputs, root_build_dir)
+}
diff --git a/src/node_version.h b/src/node_version.h
index 2d105483ba10533d992de3265121e6ab9edce2ed..8a8fd5f7fad4a69b65e06d67225a398385d3bbbf 100644
index f09ac411472981efec6d186a032aa46d9fca7fd1..dcddea36bfafa49a6a02f2e4c6cf26d3be7fb5c6 100644
--- a/src/node_version.h
+++ b/src/node_version.h
@@ -89,7 +89,10 @@
Expand Down
Expand Up @@ -10,7 +10,7 @@ THe fix for this should land in node-gyp as discussed in above issue,
landing this as temporary patch.

diff --git a/common.gypi b/common.gypi
index bde7d7300f44596abe5cdfac0639ecb1bb4d885f..412f613e7cfcf563fa6a000b932723166ab567da 100644
index f07e65f719a1a5939997dfcae7bc787ee6391f4d..f4d03a2fdfd47a4e6a71c7146d92ce7cbc44993d 100644
--- a/common.gypi
+++ b/common.gypi
@@ -19,7 +19,7 @@
Expand Down
Expand Up @@ -5,10 +5,10 @@ Subject: chore: add ability to prevent / warn non context-aware native modules
being loaded

diff --git a/src/env.h b/src/env.h
index 2dd6bdb75f02e2ccb07129996d16df99c0c4ccf2..ecb845803776f5ff6e7eec712ec7a5ebea2e8d0a 100644
index fe0f52a0a95d67a89b79c34983975060e971e15e..0500fce2610f2a3fe3ce975fd60cc94d571af07c 100644
--- a/src/env.h
+++ b/src/env.h
@@ -884,6 +884,15 @@ class Environment : public MemoryRetainer {
@@ -885,6 +885,15 @@ class Environment : public MemoryRetainer {
uint64_t thread_id = kNoThreadId);
~Environment();

Expand All @@ -24,7 +24,7 @@ index 2dd6bdb75f02e2ccb07129996d16df99c0c4ccf2..ecb845803776f5ff6e7eec712ec7a5eb
void InitializeLibuv(bool start_profiler_idle_notifier);
inline const std::vector<std::string>& exec_argv();
inline const std::vector<std::string>& argv();
@@ -1234,6 +1243,9 @@ class Environment : public MemoryRetainer {
@@ -1235,6 +1244,9 @@ class Environment : public MemoryRetainer {
inline void ThrowError(v8::Local<v8::Value> (*fun)(v8::Local<v8::String>),
const char* errmsg);

Expand Down
4 changes: 2 additions & 2 deletions patches/node/export_environment_knodecontexttagptr.patch
Expand Up @@ -5,10 +5,10 @@ Subject: export Environment::kNodeContextTagPtr


diff --git a/src/env.h b/src/env.h
index 82ed066f9cde4851fa3375d0faffe4bfcf2bf411..2dd6bdb75f02e2ccb07129996d16df99c0c4ccf2 100644
index 8647c5408f9eac006df6d655918eedc53b936d72..fe0f52a0a95d67a89b79c34983975060e971e15e 100644
--- a/src/env.h
+++ b/src/env.h
@@ -1304,7 +1304,7 @@ class Environment : public MemoryRetainer {
@@ -1305,7 +1305,7 @@ class Environment : public MemoryRetainer {
uint64_t thread_id_;
std::unordered_set<worker::Worker*> sub_worker_contexts_;

Expand Down
2 changes: 1 addition & 1 deletion patches/node/fix_enable_worker_threads.patch
Expand Up @@ -12,7 +12,7 @@ This commit fixes this problem by changing node_worker to use the three-arg
implementation of `NewIsolate` to prevent it trying to use a possibly-null ptr.

diff --git a/src/node_worker.cc b/src/node_worker.cc
index 8f97f5c351..2bfbb28e61 100644
index 8f97f5c3514639ab799c316b67bd782dfbda17f8..edc5a7fcaf8995df790151037ca0c6894fb1885c 100644
--- a/src/node_worker.cc
+++ b/src/node_worker.cc
@@ -112,7 +112,10 @@ class WorkerThreadData {
Expand Down
Expand Up @@ -17,6 +17,19 @@ index b91a5059cd1f19d87e5876c372f3ded60681a5df..f81cf8dfb892a8ddd9084c5d9477b178
public:
static void Initialize(v8::Local<v8::Object> target,
v8::Local<v8::Value> unused,
diff --git a/src/node_options.cc b/src/node_options.cc
index 01dddb979042c098326a8b1ff37397642733f49b..f91a23c1d7ee8a141d349c486b7520c175094b8b 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -237,7 +237,7 @@ const EnvironmentOptionsParser _eop_instance{_dop_instance};

// This Parse is not dead code. It is used by embedders (e.g., Electron).
template <>
-void Parse(
+void NODE_EXTERN Parse(
StringVector* const args, StringVector* const exec_args,
StringVector* const v8_args,
DebugOptions* const options,
diff --git a/src/node_options.h b/src/node_options.h
index ce86827024126c6b0d8462c811360057c298ec5b..d53307f9589d4487c220526b8e49b6c7fbd29daf 100644
--- a/src/node_options.h
Expand All @@ -39,16 +52,3 @@ index ce86827024126c6b0d8462c811360057c298ec5b..d53307f9589d4487c220526b8e49b6c7
StringVector* const args, StringVector* const exec_args,
StringVector* const v8_args, OptionsType* const options,
OptionEnvvarSettings required_env_settings, StringVector* const errors);
diff --git a/src/node_options.cc b/src/node_options.cc
index 01dddb979042c098326a8b1ff37397642733f49b..f91a23c1d7ee8a141d349c486b7520c175094b8b 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -237,7 +237,7 @@ const EnvironmentOptionsParser _eop_instance{_dop_instance};

// This Parse is not dead code. It is used by embedders (e.g., Electron).
template <>
-void Parse(
+void NODE_EXTERN Parse(
StringVector* const args, StringVector* const exec_args,
StringVector* const v8_args,
DebugOptions* const options,
21 changes: 12 additions & 9 deletions patches/node/fix_uv_fs_mkdir_for_invalid_names.patch
@@ -1,7 +1,10 @@
From ecff27857dafe3f5d30a6ab8646ea69a93e4940a Mon Sep 17 00:00:00 2001
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bartosz Sosnowski <bartosz@janeasystems.com>
Date: Thu, 11 Jul 2019 12:45:38 +0200
Subject: [PATCH] win, fs: mkdir return UV_EINVAL for invalid names
Subject: win, fs: mkdir return UV_EINVAL for invalid names
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Makes uv_fs_mkdir return UV_EINVAL for invalid filenames instead of
UV_ENOENT.
Expand All @@ -14,10 +17,10 @@ Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c
index 15094121..31242b51 100644
index 7d78d466c8738f6f0741c0a8e8fd439c7e854730..0c4bbacd0acfe59b3f66cf5f54b528c1d5c80145 100644
--- a/deps/uv/src/win/fs.c
+++ b/deps/uv/src/win/fs.c
@@ -1180,8 +1180,13 @@ void fs__unlink(uv_fs_t* req) {
@@ -850,8 +850,13 @@ void fs__unlink(uv_fs_t* req) {

void fs__mkdir(uv_fs_t* req) {
/* TODO: use req->mode. */
Expand All @@ -34,10 +37,10 @@ index 15094121..31242b51 100644


diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c
index 35a992d8..95f6b5e9 100644
index 2cf8f287fe331d15bfab06179824d63f7cd19280..649ff0a3804ef81d3aa41ce6201b738f6b0b006a 100644
--- a/deps/uv/test/test-fs.c
+++ b/deps/uv/test/test-fs.c
@@ -4060,4 +4060,16 @@ TEST_IMPL(fs_fchmod_archive_readonly) {
@@ -3873,4 +3873,16 @@ TEST_IMPL(fs_fchmod_archive_readonly) {

return 0;
}
Expand All @@ -55,18 +58,18 @@ index 35a992d8..95f6b5e9 100644
+}
#endif
diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h
index 3c5f21b9..ffa7e545 100644
index a48f6f3806806af6bf844558d08fa9679e268112..911426f7e1d2d84452a8d247b46e93ed65e5ffdd 100644
--- a/deps/uv/test/test-list.h
+++ b/deps/uv/test/test-list.h
@@ -380,6 +380,7 @@ TEST_DECLARE (fs_exclusive_sharing_mode)
@@ -374,6 +374,7 @@ TEST_DECLARE (fs_exclusive_sharing_mode)
TEST_DECLARE (fs_file_flag_no_buffering)
TEST_DECLARE (fs_open_readonly_acl)
TEST_DECLARE (fs_fchmod_archive_readonly)
+TEST_DECLARE (fs_invalid_mkdir_name)
#endif
TEST_DECLARE (strscpy)
TEST_DECLARE (threadpool_queue_work_simple)
@@ -973,6 +974,7 @@ TASK_LIST_START
@@ -961,6 +962,7 @@ TASK_LIST_START
TEST_ENTRY (fs_file_flag_no_buffering)
TEST_ENTRY (fs_open_readonly_acl)
TEST_ENTRY (fs_fchmod_archive_readonly)
Expand Down
Expand Up @@ -110,7 +110,7 @@ index b6a3376e735094f970ef61a52ef9bb6d6101647a..bb70c2305fd44cfea46a8df5e65d1af5

Sign.prototype.sign = function sign(options, encoding) {
diff --git a/src/env.h b/src/env.h
index ecb845803776f5ff6e7eec712ec7a5ebea2e8d0a..1516d77be8514ce55d8d21b78a7cd85ead2cb95f 100644
index 0500fce2610f2a3fe3ce975fd60cc94d571af07c..7ce3d3f467e9a44c33d24df5968f16e09558f2ec 100644
--- a/src/env.h
+++ b/src/env.h
@@ -173,7 +173,6 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2;
Expand Down

0 comments on commit bafcac7

Please sign in to comment.