If you are a package maintainer for Fedora, or if you regularly spin up your own versions of RPMs for install on your Fedora system, you have probably gone through the process of updating a package when a new version of software is released upstream.
Rebase-helper is a handy tool to help package maintainers update a package to the latest upstream version. It automates many of the manual tasks the package maintainer usually performs when a new upstream version of code is released.
Rebase-helper can be installed from the Fedora repositories with the command:
sudo dnf install -y rebase-helper
Rebase-helper uses several other programs such as abipkgdiff, rpmdiff, mock, fedpkg, and meld, and these programs are installed automatically as dependencies of rebase-helper. Note that rebase-helper is also available as an EPEL-7 package, so it can also be installed on CentOS and Red Hat Enterprise Linux too.
Using the rebase-helper CLI
To use rebase-helper to rebase a Fedora Package, first go to where you have checked out the package from FedPkg, then run rebase helper with the upstream version you want to rebase to, for example:
Rebase-helper will then run automatically, covering the following basic steps:
- Downloading of the new source archives from the upstream (as defined in the specfile)
- Rebases downstream patches on top of the latest upstream version using git rebase command.
- If patching was successful, rebase-helper then builds two sets of RPMs. One using the “old” sources and a second one using the “new” sources. Available build tools are mock, rpmbuild, fedpkg.
- If “new” RPMs build fails, downloads logs like build.log and root.log
- If the build is successful, downloads all available RPM packages.
- If all builds succeed, rebase-helper runs several checkers,
like pkgdiff, rpmdiff, abipkgdiff.
- Finally, rebase-helper compares old and new packages and reports results.
Integration with the upstream monitoring service
Fedora also uses rebase-helper automatically as part of the upstream monitoring service. The upstream monitoring service regularly checks the upstream sources of many of the packages in Fedora, and automatically files bugs for the package maintainers to update them if a new upstream version is released.
The upstream monitoring service now automatically uses rebase-helper to attempt to rebase and create a scratch build of the new release. After the integration of rebase-helper into upstream monitoring services, bugzilla is now updated with the results of the attempted rebase, and the maintainer can now see if the automatic rebase worked, or if it encountered a problem and the information is posted to bugzilla to help diagnose and fix the issue:
What is new in rebase-helper?
In the last year, the rebase-helper developers have implemented several new features, including:
In the new non-interactive mode, patches are first either rebased automatically or in case of failure, the patch is skipped and reported at the end. Second, building packages (old as well as new) are done by rebase-helper automatically. In case the build of new package fails, rebase-helper tries to analyze the build.log and correct the SPEC file. After this is done, the build of a new package is re-tried one more time.
Using git for rebasing the downstream patches
Previously, the patch and meld tools were used for rebasing patches on top of new upstream releases. rebase-helper now uses the existing git rebase workflow for applying patches to the new upstream version.This allows the user to specify in .gitconfig file, which program will be used for comparing or merging patches, in case the patches don’t apply cleanly.
fedpkg build support
Rebase-helper is now able to build packages on the Fedora buildsystem (koji) as scratch builds.
Rebase-helper now can compare and report changes between old and new sets of packages with the abipkgdiff tool is important change in rebase-helper.
For further information about the rebase-helper project, check out the presentation from DevConf 2016 on rebase-helper and the upstream monitoring service. Also the official documentation for rebase-helper is available on Read The Docs, and the source for rebase helper is available on GitHub.