Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

rebase-helper for RHEL 7

January 27, 2015
Petr Hracek
Related topics:
Linux
Related products:
Red Hat Enterprise Linux

Share:

    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

    Recent Posts

    • How to run AI models in cloud development environments

    • How Trilio secures OpenShift virtual machines and containers

    • How to implement observability with Node.js and Llama Stack

    • How to encrypt RHEL images for Azure confidential VMs

    • How to manage RHEL virtual machines with Podman Desktop

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue