What is rebase-helper used for?
Rebase-helper automates a lot of manual tasks when a new upstream version of a package is released. How to install rebase-helper on RHEL 7 system?  Use this COPR repository where RPM package is already created.
 
http://copr-fe.cloud.fedoraproject.org/coprs/phracek/rebase-helper_EPEL/

Download the repo file and install rebase-helper via yum command.

yum install rebase-helper

Rebase-helper performs several tasks during the rebase:

  1. Downloads an archive with the new sources

  2. Tries to apply all downstream patches:

    • If a patch does not apply then rebase-helper resolves the conflict, it continues doing that until all patches apply

    • Goes to the point 2 until all patches apply

  1. Builds new and old binary packages (mostly RPMs)

  2. Performs number of tests to identify possible changes

    • added/changed/removed files/binaries/headers

    • library soname version bumps

    • checks API/ABI changes

Some of these tasks can be fully (or at least partially) automated to assist the maintainer.

Let's introduce rebase-helper in daily work.

Let's say that we want to update the iproute2 package from iproute2-3.12.0 version to version iproute2-3.14.0.

For this purpose we need to know either the latest upstream version or the name of the upstream tarball. In our case 3.14.0. In Fedora this is already mentioned in a BZ generated by an upstream monitoring service.

If the new tarball doesn't exist in the current directory then it is downloaded from an URL specified in a SPEC file. To update to the latest upstream version we execute this command: rebase-helper iproute2-3.14.0.tar.gz or rebase-helper 3.14.0 .

~$ rebase-helper iproute2-3.14.0.tar.gz

After the check whether the new upstream version is in the current directory, all patches are applied to the old source and to the new sources.

~$ rebase-helper iproute2-3.14.0.tar.gz
Results directory 'rebase-helper-results' exists, removing it
Applying patch 'man-pages.patch' to 'iproute2-3.12.0'
Applying patch 'man-pages.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.4.0-kernel.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.4.0-kernel.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.11.0-optflags.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.11.0-optflags.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.9.0-IPPROTO_IP_for_SA.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.9.0-IPPROTO_IP_for_SA.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-example-cbq-service.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-example-cbq-service.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-2.6.35-print-route.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-2.6.35-print-route.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-2.6.39-create-peer-veth-without-a-name.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-2.6.39-create-peer-veth-without-a-name.patch' to 'iproute2-3.14.0'
Applying patch iproute2-2.6.39-create-peer-veth-without-a-name.patch to new source failed. Press Enter to start merge-tool.

Currently rebase-helper uses the patch command for applying patches.

On the screen we can see that some patches were applied successfully on both sources.
In case that a patch doesn't applied properly to the new sources, we see a message that the patch has not been applied and the merge tool is started to correct the patch.

Rebase-helper uses the merge tool for comparing patches. The merge tool displays 3 tabs which is useful for comparing source versions.

The first tab shows the comparison between the old and the new version for the given source file without a patch (in our case ip/link_veth.c). We see how the file has been changed against the new upstream version.

Old_and_new_sources

In the middle tab, we see how the patch was applied on the old version. In our case, parameters were initialized on NULL.

Old_sources_with_patch

On the last tab, we see a merge of the source file between the new upstream version and the old patched version. We can select if we use the old patched version or the new upstream version.
Last_tab_with_upstream_version

In our case, we select the upstream version of course. We prefer upstream first:)

Save_the_source

When a new patch is regenerated, it is shown how the patch has been changed.

gen_diff
On the screen we see that the patch has been completely removed.

Finally, we correct the patch for the upstream version. In next steps, rebase-helper will ask whether we want to continue with other patches. In case we don't want to continue, rebase-helper finishes.

~$ rebase-helper iproute2-3.14.0.tar.gz
phracek@kiasportyw-brq-redhat-com: ~/work/Fedora/iproute (f19 %)$ rebase-helper iproute2-3.14.0.tar.gz
Results directory 'rebase-helper-results' exists, removing it
Applying patch 'man-pages.patch' to 'iproute2-3.12.0'
Applying patch 'man-pages.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.4.0-kernel.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.4.0-kernel.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.11.0-optflags.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.11.0-optflags.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.9.0-IPPROTO_IP_for_SA.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.9.0-IPPROTO_IP_for_SA.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-example-cbq-service.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-example-cbq-service.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-2.6.35-print-route.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-2.6.35-print-route.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-2.6.39-create-peer-veth-without-a-name.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-2.6.39-create-peer-veth-without-a-name.patch' to 'iproute2-3.14.0'
Applying patch iproute2-2.6.39-create-peer-veth-without-a-name.patch to new source failed. Press Enter to start merge-tool.
Applying patch failed. Starting merge-tool to fix conflicts manually.
Do you want to continue with another patch ([y]/n)? y

Because we want to finish updating to the latest version, we will continue.
If the patches are completely done then building of packages starts. First of all, SRPM packages are generated and afterwards RPM packages.
Packages are generated for the old version and also for the new version.

Rebase-helper uses the mock command for building packages.

~$ rebase-helper iproute2-3.14.0.tar.gz
Results directory 'rebase-helper-results' exists, removing it
Applying patch 'man-pages.patch' to 'iproute2-3.12.0'
Applying patch 'man-pages.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.4.0-kernel.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.4.0-kernel.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.11.0-optflags.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.11.0-optflags.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.9.0-IPPROTO_IP_for_SA.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.9.0-IPPROTO_IP_for_SA.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-example-cbq-service.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-example-cbq-service.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-2.6.35-print-route.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-2.6.35-print-route.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-2.6.39-create-peer-veth-without-a-name.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-2.6.39-create-peer-veth-without-a-name.patch' to 'iproute2-3.14.0'
Applying patch iproute2-2.6.39-create-peer-veth-without-a-name.patch to new source failed. Press Enter to start merge-tool.
Applying patch failed. Starting merge-tool to fix conflicts manually.
Do you want to continue with another patch ([y]/n)? y
Applying patch 'iproute2-3.12.0-lnstat-dump-to-stdout.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.12.0-lnstat-dump-to-stdout.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.10.0-rtnl_send.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.10.0-rtnl_send.patch' to 'iproute2-3.14.0'
Applying patch iproute2-3.10.0-rtnl_send.patch to new source failed. Press Enter to start merge-tool.
Applying patch failed. Starting merge-tool to fix conflicts manually.
Do you want to continue with another patch ([y]/n)? y
Applying patch 'iproute2-3.11.0-tc-ok.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.11.0-tc-ok.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.11.0-rtt.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.11.0-rtt.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.12.0-lnstat-interval.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.12.0-lnstat-interval.patch' to 'iproute2-3.14.0'
Building SRPM
Building SRPM finished successfully

Currently, the last step compares all packages generated by mock with the pkgdiff command. Detailed information is shown while rebase-helper is working. This information is shown also in case that rebase-helper fails.

~$ rebase-helper iproute2-3.14.0.tar.gz
Results directory 'rebase-helper-results' exists, removing it
Applying patch 'man-pages.patch' to 'iproute2-3.12.0'
Applying patch 'man-pages.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.4.0-kernel.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.4.0-kernel.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.11.0-optflags.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.11.0-optflags.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.9.0-IPPROTO_IP_for_SA.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.9.0-IPPROTO_IP_for_SA.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-example-cbq-service.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-example-cbq-service.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-2.6.35-print-route.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-2.6.35-print-route.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-2.6.39-create-peer-veth-without-a-name.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-2.6.39-create-peer-veth-without-a-name.patch' to 'iproute2-3.14.0'
Applying patch iproute2-2.6.39-create-peer-veth-without-a-name.patch to new source failed. Press Enter to start merge-tool.
Applying patch failed. Starting merge-tool to fix conflicts manually.
Do you want to continue with another patch ([y]/n)? y
Applying patch 'iproute2-3.12.0-lnstat-dump-to-stdout.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.12.0-lnstat-dump-to-stdout.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.10.0-rtnl_send.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.10.0-rtnl_send.patch' to 'iproute2-3.14.0'
Applying patch iproute2-3.10.0-rtnl_send.patch to new source failed. Press Enter to start merge-tool.
Applying patch failed. Starting merge-tool to fix conflicts manually.
Do you want to continue with another patch ([y]/n)? y
Applying patch 'iproute2-3.11.0-tc-ok.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.11.0-tc-ok.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.11.0-rtt.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.11.0-rtt.patch' to 'iproute2-3.14.0'
Applying patch 'iproute2-3.12.0-lnstat-interval.patch' to 'iproute2-3.12.0'
Applying patch 'iproute2-3.12.0-lnstat-interval.patch' to 'iproute2-3.14.0'
Building SRPM
Building SRPM finished successfully
Building RPMs
Building RPM finished successfully
Building SRPM
Building SRPM finished successfully
Building RPMs
Building RPM finished successfully
Comparing packages using pkgdiff...
Processing /home/phracek/work/Fedora/iproute/rebase-helper-results/files.xml file.
Processing /home/phracek/work/Fedora/iproute/rebase-helper-results/symbols.xml file.

Summary output is also available in log: /home/phracek/work/Fedora/iproute/rebase-helper-results/rebase-helper-results.log

Result HTML page from pkgdiff is store in: /home/phracek/work/Fedora/iproute/rebase-helper-results/pkgdiff_reports.html

WARNING Test suite is not enabled at build time.

Patches were neither modified nor deleted.

Old (S)RPM packages:
---------------------
SRPM package(s): are in directory :
- iproute-3.12.0-2.fc21.src.rpm
RPM package(s): are in directory /home/phracek/work/Fedora/iproute/rebase-helper-results/old/RPM :
- iproute-debuginfo-3.12.0-2.fc21.x86_64.rpm
- iproute-doc-3.12.0-2.fc21.x86_64.rpm
- iproute-devel-3.12.0-2.fc21.x86_64.rpm
- iproute-3.12.0-2.fc21.x86_64.rpm
Available Old logs:
- /home/phracek/work/Fedora/iproute/rebase-helper-results/old/SRPM/state.log
- /home/phracek/work/Fedora/iproute/rebase-helper-results/old/SRPM/mock_output.log
- /home/phracek/work/Fedora/iproute/rebase-helper-results/old/SRPM/root.log
- /home/phracek/work/Fedora/iproute/rebase-helper-results/old/SRPM/build.log
- /home/phracek/work/Fedora/iproute/rebase-helper-results/old/RPM/state.log
- /home/phracek/work/Fedora/iproute/rebase-helper-results/old/RPM/mock_output.log
- /home/phracek/work/Fedora/iproute/rebase-helper-results/old/RPM/root.log
- /home/phracek/work/Fedora/iproute/rebase-helper-results/old/RPM/build.log

New (S)RPM packages:
---------------------
SRPM package(s): are in directory :
- iproute-3.14.0-1.fc21.src.rpm
RPM package(s): are in directory /home/phracek/work/Fedora/iproute/rebase-helper-results/new/RPM :
- iproute-doc-3.14.0-1.fc21.x86_64.rpm
- iproute-devel-3.14.0-1.fc21.x86_64.rpm
- iproute-debuginfo-3.14.0-1.fc21.x86_64.rpm
- iproute-3.14.0-1.fc21.x86_64.rpm
Available New logs:
- /home/phracek/work/Fedora/iproute/rebase-helper-results/new/SRPM/state.log
- /home/phracek/work/Fedora/iproute/rebase-helper-results/new/SRPM/mock_output.log
- /home/phracek/work/Fedora/iproute/rebase-helper-results/new/SRPM/root.log
- /home/phracek/work/Fedora/iproute/rebase-helper-results/new/SRPM/build.log
- /home/phracek/work/Fedora/iproute/rebase-helper-results/new/RPM/state.log
- /home/phracek/work/Fedora/iproute/rebase-helper-results/new/RPM/mock_output.log
- /home/phracek/work/Fedora/iproute/rebase-helper-results/new/RPM/root.log
- /home/phracek/work/Fedora/iproute/rebase-helper-results/new/RPM/build.log
Following files were removed:
/usr/src/debug/iproute2-3.12.0/include/SNAPSHOT.h
Following files were added:
/usr/share/man/man8/tc-mqprio.8.gz
/usr/share/man/man8/tc-pie.8.gz
/usr/src/debug/iproute2-3.14.0/include/SNAPSHOT.h
/usr/src/debug/iproute2-3.14.0/ip/iplink_bond.c
/usr/src/debug/iproute2-3.14.0/ip/iplink_bond_slave.c
/usr/src/debug/iproute2-3.14.0/ip/iplink_hsr.c
/usr/src/debug/iproute2-3.14.0/tc/f_bpf.c
/usr/src/debug/iproute2-3.14.0/tc/q_pie.c
Following files were changed:
/usr/include/libnetlink.h (17.3%)
/usr/lib64/libnetlink.a (0.4%)
/usr/sbin/arpd (4.1%)
/usr/sbin/bridge (1.2%)
/usr/sbin/cbq (0.4%)
/usr/sbin/ifstat (1.2%)
/usr/sbin/ip (11.5%)
...
/usr/src/debug/iproute2-3.12.0/tc/q_htb.c (15.5%)
/usr/src/debug/iproute2-3.12.0/tc/q_multiq.c (10.4%)
/usr/src/debug/iproute2-3.12.0/tc/q_netem.c (4.2%)
/usr/src/debug/iproute2-3.12.0/tc/q_tbf.c (19.8%)
/usr/src/debug/iproute2-3.12.0/tc/tc_core.c (3.6%)
/usr/src/debug/iproute2-3.12.0/tc/tc_core.h (13.2%)
/usr/src/debug/iproute2-3.12.0/tc/tc_util.c (6.9%)
/usr/src/debug/iproute2-3.12.0/tc/tc_util.h (1.4%)
Detailed debug log is located in '/home/phracek/work/Fedora/iproute/rebase-helper-results/rebase-helper-debug.log'

We can see e.g.:

  • Two patches have been deleted.

  • Where the SRPM and RPM packages are stored.

  • Where the output from pkgdiff is stored.

If we open the pkgdiff output, we can see what has been changed against the old version.

pkgdiff

Future features in rebase-helper?

  • show report from the pkgdiff format

  • building packages with fedpkg

  • support more merging tools (vimdiff, ...)

  • package rebase with the git am commands

  • Integration rebase-helper into the upstream monitoring system

[1] - https://github.com/phracek/rebase-helper

[2] - https://www.youtube.com/watch?v=87D2_JliHuU

 

 

Last updated: September 19, 2022