Fix synchronization for old versions of WebRTC.

This commit is contained in:
Kirill Kirilenko 2024-08-19 19:33:12 +03:00
parent 92fb3fdc01
commit 4475233318
2 changed files with 66 additions and 25 deletions

View file

@ -5,30 +5,48 @@ REM see https://chromiumdash.appspot.com/branches
REM and https://chromiumdash.appspot.com/schedule
set WEBRTC_REVISION=4280
set DEPOT_TOOLS_COMPATIBLE_REVISION=a964ca1296b
if not "%1"=="" set WEBRTC_REVISION="%1"
set REPO_ROOT=%~dp0
set PATH=%REPO_ROOT%depot_tools;%PATH%
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
cd %REPO_ROOT%
cd "%REPO_ROOT%"
if not exist "depot_tools" (
echo Cloning Depot Tools...
git.exe clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
cd "%REPO_ROOT%\depot_tools"
python.exe update_depot_tools_toggle.py --disable
)
echo Updating Depot Tools...
cd %REPO_ROOT%\depot_tools
call update_depot_tools.bat
set PATH=%REPO_ROOT%depot_tools;%PATH%
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
if not exist "%REPO_ROOT%\webrtc" (
echo "Updating Depot Tools to the latest revision..."
cd "%REPO_ROOT%\depot_tools"
git.exe checkout -q -f main
git.exe pull
cd %REPO_ROOT%
if not exist "webrtc" (
echo Cloning WebRTC...
mkdir webrtc
cd webrtc
fetch --nohooks --no-history webrtc
mkdir "%REPO_ROOT%\webrtc"
cd "%REPO_ROOT%\webrtc"
fetch --nohooks webrtc
cd "%REPO_ROOT%\webrtc\src"
call gclient sync --nohooks --with_branch_heads
)
REM Latest Depot Tools versions are not compatible
REM with old WebRTC versions, so we peek revision
REM from around the same time as the WebRTC and
REM forbid gclient to auto-update Depot Tools.
cd "%REPO_ROOT%\webrtc\src"
FOR /F "tokens=*" %%g IN ("git.exe log -n 1 --pretty=format:%ci \"branch-heads/%WEBRTC_REVISION%\"") do (SET LAST_WEBRTC_COMMIT_DATE=%%g)
cd "%REPO_ROOT%\depot_tools"
FOR /F "tokens=*" %%g IN ("git rev-list -n 1 --before=\"%LAST_WEBRTC_COMMIT_DATE%\" main") do (SET DEPOT_TOOLS_COMPATIBLE_REVISION=%%g)
echo "Updating Depot Tools to a compatible revision %DEPOT_TOOLS_COMPATIBLE_REVISION%..."
git.exe checkout -q -f %DEPOT_TOOLS_COMPATIBLE_REVISION%
echo Updating WebRTC to version %WEBRTC_REVISION%...
cd %REPO_ROOT%\webrtc\src
call gclient sync --with_branch_heads --reset
@ -37,3 +55,8 @@ git.exe checkout -f -B %WEBRTC_REVISION% branch-heads/%WEBRTC_REVISION%
call gclient sync --force -D --reset
cd %REPO_ROOT%
echo Updating Depot Tools...
cd %REPO_ROOT%\depot_tools
call update_depot_tools.bat

46
sync.sh
View file

@ -4,38 +4,56 @@ set -e
# To determine last stable WebRTC revision,
# see https://chromiumdash.appspot.com/branches
# and https://chromiumdash.appspot.com/schedule
WEBRTC_REVISION=4280
WEBRTC_REVISION=4692
if [ $# -eq 1 ]; then
WEBRTC_REVISION=$1
WEBRTC_REVISION=$1
fi
REPO_ROOT=$(dirname $(readlink -f $0))
export PATH=${REPO_ROOT}/depot_tools:$PATH
cd ${REPO_ROOT}
if [ ! -d depot_tools ];
then
echo "Cloning Depot Tools..."
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
cd ${REPO_ROOT}/depot_tools
python update_depot_tools_toggle.py --disable
else
echo "Updating Depot Tools to the latest revision..."
cd ${REPO_ROOT}/depot_tools
git checkout -q -f main
git pull
fi
echo "Updating Depot Tools..."
cd ${REPO_ROOT}/depot_tools
./update_depot_tools
export PATH=${REPO_ROOT}/depot_tools:$PATH
cd ${REPO_ROOT}
if [ ! -d webrtc ];
if [ ! -d ${REPO_ROOT}/webrtc ];
then
echo "Cloning WebRTC..."
mkdir webrtc
cd webrtc
fetch --nohooks --no-history webrtc
mkdir ${REPO_ROOT}/webrtc
cd ${REPO_ROOT}/webrtc
fetch --nohooks webrtc
cd ${REPO_ROOT}/webrtc/src
gclient sync --nohooks --with_branch_heads
else
echo "Updating WebRTC branches info..."
gclient sync --nohooks --with_branch_heads
fi
# Latest Depot Tools versions are not compatible
# with old WebRTC versions, so we peek revision
# from around the same time as the WebRTC and
# forbid gclient to auto-update Depot Tools.
cd ${REPO_ROOT}/webrtc/src
LAST_WEBRTC_COMMIT_DATE=$(git log -n 1 --pretty=format:%ci "branch-heads/${WEBRTC_REVISION}")
cd ${REPO_ROOT}/depot_tools
DEPOT_TOOLS_COMPATIBLE_REVISION=$(git rev-list -n 1 --before="$LAST_WEBRTC_COMMIT_DATE" main)
echo "Updating Depot Tools to a compatible revision ${DEPOT_TOOLS_COMPATIBLE_REVISION}..."
git checkout -q -f ${DEPOT_TOOLS_COMPATIBLE_REVISION}
echo "Updating WebRTC to version ${WEBRTC_REVISION}..."
cd ${REPO_ROOT}/webrtc/src
gclient sync --with_branch_heads --reset
git fetch
git checkout -f -B ${WEBRTC_REVISION} branch-heads/${WEBRTC_REVISION}
git clean -ffd
git checkout -B ${WEBRTC_REVISION} branch-heads/${WEBRTC_REVISION}
gclient sync --force -D --reset