-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FABG-924] Simplify upstream patching
Signed-off-by: Aleksandar Likic <[email protected]>
- Loading branch information
Aleksandar Likic
committed
Dec 7, 2019
1 parent
648507b
commit fe2f155
Showing
18 changed files
with
121 additions
and
1,698 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
Fabric-sdk-go reuses fabric and fabric-ca code by first copying | ||
desired files from upstream repos and then patching them to work | ||
locally. The process of patching is a simple git merge which | ||
replays changes from the last successful patch. For this to work, | ||
the two steps (pulling files from upstream and patching) must | ||
always be maintained in their own separate commits each time we | ||
pull in the new upstream version. | ||
|
||
Note that replaying changes from old commits using a simple | ||
'git am' doesn't work well because a git patch created with | ||
'git format-patch' doesn't have a knowledge of the common | ||
ancestor of the master and the commit we want to replay, | ||
so we end up with many unexpected conflicts. | ||
|
||
Here are full steps for pulling code from upstream and patching: | ||
``` | ||
> make thirdparty-pin | ||
``` | ||
We must now commit upstream files first. This will keep the | ||
subsequent patch in its own clean commit so we can use it in the | ||
future. | ||
``` | ||
> git add . | ||
> git commit --signoff -m "Apply upstream" | ||
``` | ||
Now we need to replay changes from the last correct patch. | ||
We do it using git, with the help of a temporary branch where we | ||
first copy the changes we want to replay. This example assumes | ||
that the last correct patch was committed as ```5678```, and its | ||
parent is the commit ```1234```. | ||
``` | ||
> git format-patch --stdout 1234..5678 > ~/last.patch | ||
> git checkout -b fix 1234 | ||
> git am ~/last.patch | ||
> git checkout master | ||
> git merge fix | ||
``` | ||
If necessary, fix any conflicts and commit | ||
|
||
Amend as required, and push all commits. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright SecureKey Technologies Inc. All Rights Reserved. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
# This script fetches code originating from other upstream projects | ||
# These files are checked into internal paths. | ||
|
||
set -e | ||
|
||
if output=$(git status --porcelain) && [ -z "$output" ] | ||
then | ||
echo "Working directory clean, proceeding with upstream patching" | ||
else | ||
echo "ERROR: git status must be clean before applying upstream patches" | ||
exit 1 | ||
fi | ||
|
||
export UPSTREAM_COMMIT="${THIRDPARTY_FABRIC_COMMIT}" | ||
export UPSTREAM_BRANCH="${THIRDPARTY_FABRIC_BRANCH}" | ||
scripts/third_party_pins/fabric/apply_upstream.sh | ||
|
||
export UPSTREAM_COMMIT="${THIRDPARTY_FABRIC_CA_COMMIT}" | ||
export UPSTREAM_BRANCH="${THIRDPARTY_FABRIC_CA_BRANCH}" | ||
scripts/third_party_pins/fabric-ca/apply_upstream.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.