Media/WebRTC/libwebrtc Update Process
This page describes the process for updating the in tree, vendored copy of libwebrtc using the fast-forward scripts.
Contents
Operation Checklist
Prerequisites
- Create a new bug for the fast-forward update. It should depend on the previous fast-forward bug. Bug 1800920 is an example.
- Update the default config file for the next fast-forward operation. This should be done in a separate bug, but if it has not been done prior, can be done at the beginning of the fast-forward operation as the first commit on elm.
bash dom/media/webrtc/third_party_build/update_default_config.sh
- After the updated default config lands on mozilla-central, follow the Resetting_Elm steps below.
- Builds are done after vendoring in each commit. Having a
.mozconfig
file that enables cache (either sccache or ccache) will improve the performance of the scripts. - Starting with a fresh clone of elm is recommended for each new chromium milestone.
hg clone --stream ssh://hg.mozilla.org/projects/elm (cd elm && ./mach --no-interactive bootstrap --application-choice=browser && ./mach build)
Update steps
# Start from the elm checkout cd elm # Prepare the github repo bash dom/media/webrtc/third_party_build/prep_repo.sh # Prepare no-op tracking files for cherry-pick commits bash dom/media/webrtc/third_party_build/build_no_op_commits.sh # Save the newly updated patch-stack (source dom/media/webrtc/third_party_build/use_config_env.sh ; \ ./mach python dom/media/webrtc/third_party_build/save_patch_stack.py \ --repo-path $MOZ_LIBWEBRTC_SRC \ --target-branch-head $MOZ_TARGET_UPSTREAM_BRANCH_HEAD \ --separate-commit-bug-number $MOZ_FASTFORWARD_BUG ) # Run loop-ff.sh bash dom/media/webrtc/third_party_build/loop-ff.sh
Push to elm
# after the loop-ff.sh script completes, run the following steps # to push the new version of libwebrtc to elm ./mach bootstrap --application=browser --no-system-changes ./mach build hg push -r tip
Daily rebase on elm
Periodically, ideally daily to minimize surprises from mozilla-central, rebasing elm onto the latest mozilla-central is recommended. Rebases should be completed until the request for merging elm to moz-central is made.
Historical note: we use a script to rebase because 1) it regenerates the moz.build files on the commits where those are changed. This avoids the typically massive rebase conflict if anyone has touched the build files. 2) it exports/imports each commit individually to limit rebase conflicts on individual patches, making it easier to deal with issues.
bash dom/media/webrtc/third_party_build/elm/elm_rebase.sh
Requesting merge from elm to mozilla-central
Typically, immediately after the code-freeze has lifted, a request is made for the sheriffs to merge elm to mozilla-central. This done via email, recently to Sebastian Hengst.
Post-merge Steps
- After the merge from elm to mozilla-central is complete, the moz-libwebrtc github repo should be updated with the new branch of the commit stack for the new release. There is script that will make the proper branch name and do the push:
bash dom/media/webrtc/third_party_build/push_official_branch.sh
Operational notes
- Running
prep-repo.sh
with a fresh github clone of moz-libwebrtc will likely display instructions on how to add recent moz-central changes made inthird_party/libwebrtc
to the top of the patch stack in github. This is expected and necessary for successfully vendoring changes intothird_party/libwebrtc
. - Two main types of errors will cause
loop-ff.sh
to exit; the first is a rebase conflict, the second is a build error due to api changes in upstream code. - When making changes to fix build issues in moz-libwebrtc (any changes under third_party/libwebrtc), mercurial commit messages follow the pattern:
Bug {current-fast-forward-bug-number} - (fix-{upstream-sha}) {description} # then run (source dom/media/webrtc/third_party_build/use_config_env.sh ; ./mach python dom/media/webrtc/third_party_build/save_patch_stack.py \ --repo-path $MOZ_LIBWEBRTC_SRC \ --target-branch-head $MOZ_TARGET_UPSTREAM_BRANCH_HEAD )
- When making changes to fix Mozilla code (code outside of third_party/libwebrtc) in response to changes upstream, mercurial commit messages follow the pattern:
Bug {current-fast-forward-bug-number} (MOZ) - {description}
- If loop-ff.sh reveals an issue that is best dealt with in a followup, one can commit a temporary patch marked with
REPO-elm
in the first line of its description, i.e. the "title". The temporary commit allows loop-ff.sh to continue, whereasREPO-elm
makes sure the commit cannot be pushed to any other mozilla repo than elm (and try). - While loop-ff.sh is running, in a separate terminal window it may be helpful to see the overall progress by running:
tail -f ~/log-loop-ff.txt | grep loop-ff
- If a particularly complicated rebase conflict is encountered, it is helpful to tar up the moz-libwebrtc directory to allow a complete reset without losing current progress.
(cd {path-to}/moz-central && rm log_resume.txt) # resets the resume logic in loop-ff.sh (cd {path-to}/moz-libwebrtc && git rebase --abort) # don't finish this rebase (cd {path-to}/moz-libwebrtc/.. && tar czf moz-libwebrtc.tar.gz && cd moz-libwebrtc)
- Stopping the loop-ff.sh manually is best done when in the
Test build
phase using Ctrl-c. - GYP generated Java files
Resetting Elm
Before each new merge cycle. Elm needs to be reset to Central.
- Ensure you have filed a bug for the next merge cycle, and further ensure that the next merge cycle bug has the previous merge cycle bug as a dependency.
- File a bug as a clone of Bug 1822294 and add your new bug as dependency to the next merge cycle bug.
- Wait for the repo admins to reset the repository.
- Make sure to land the updated update_example_config.sh
- Celebrate