ros-infrastructure / bloom

A release automation tool which makes releasing catkin (http://ros.org/wiki/catkin) packages easier.
Other
58 stars 93 forks source link

How to delete a certain patch from a release repo ? #685

Open SamerKhshiboun opened 2 years ago

SamerKhshiboun commented 2 years ago

Hi, Currently on our release repo we have several patches let say:

0001-....patch 0002-...patch 0003-...patch If I want to modify/remove the 0002-..patch how can I do it?

Currently I can only find guides for adding patches using git-bloom-patch, but how to delete/modify I cannot find.

Appriciate your help Thanks 😀

nuclearsandwich commented 1 year ago

Hi Samer,

I haven't found a reliable workflow for interacting directly with bloom's internal patch interface. What I tend to do when I need to update patches for a release is checkout the patched branch, modify the patches there manually, push the changes to the release repository, and then run a fresh bloom-release in order to update the patch branches that way.

Sometimes it's not possible to apply patches that remove or modify existing patches cleanly and when that happens I'll usually truncate the release branch, temporarily removing all patches, and then cherry-pick the specific changes I want to retain before running bloom-release to update the patch branches.

For example, we patch the deb and rpm releases of the fastrtps package to modify the CMake configuration: https://github.com/ros2-gbp/fastrtps-release/commits/debian/rolling/fastrtps

To make those changes originally I performed the following

git clone https://github.com/ros2-gbp/fastrtps-release
cd fastrtps-release
git checkout -b debian/rolling/fastrtps origin/debian/rolling/fastrtps
# edit debian/rules directly
git add debian/rules
git commit -m 'Set CMake flags for Fast-RTPS.'
git push origin debian/rolling/fastrtps
cd ..
bloom-release -r rolling fastrtps

If I wanted to remove that patch, I would do the following:

# View the commit history of the release branch either on GitHub or locally and make note of the commit ID directly prior to the most recent patch application.(8e96ed6e56ea76b1f9ade34fac5670f3ccc6d6f6, in this example)
git clone https://github.com/ros2-gbp/fastrtps-release
cd fastrtps-release
git checkout -b debian/rolling/fastrtps origin/debian/rolling/fastrtps
git reset --hard $PRIOR_COMMIT_ID # This will be 8e96ed6e56ea76b1f9ade34fac5670f3ccc6d6f6 for this example but yours will be unique
git push --force-with-lease origin debian/rolling/fastrtps
cd ..
bloom-release -r rolling fastrtps

It is worth capturing this information and adding it to bloom's user documentation. If you would like to take that on please feel free to open a pull request for feedback.

SamerKhshiboun commented 1 year ago

Hi @nuclearsandwich and Thanks for the informative answer ! Really appreciated !

I have documented my last release of our librealsense2 ROS2 package, and from it I can say these things:

Adding / Removing / Editing Patches, before pressing the last ENTER of the Bloom Configuration, go to another terminal:

  1. cd to the /tmp/ directory that shown in the screen
  2. git checkout release/humble/librealsense2
  3. make changes, and git add and git commit them
  4. git-bloom-release export
  5. go back to the main terminal, and press Enter

This way it worked for me. I really appreciate your help, and maybe when I release the next version, I will document it in a formal way that I can also add it to bloom readme and open a PR.

Thanks, Samer