Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unofficial ros_gz: README for forking gbp and script for renaming #898

Merged
merged 3 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions bloom/ros_gz/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Release new version of Gazebo unofficial wrappers

1. Background
* Upstream versions released using this tutorial
2. Initial setup
* Create the alternative -release repository
* Create a custom track in tracks.yaml

## 1. Background

Each ROS release defines one version of Gazebo supported officially through
all the ROS packages. The different combinations of ROS <-> Gazebo can be
found in the [REP-3](http://www.ros.org/reps/rep-2000.html). Some examples:

* ROS 2 Foxy: Citadel
* ROS 2 Humble: Fortress

Some use cases require the use of alternative combinations of ROS and Gazebo
versions. The `ros_gz` code is usually prepared to be compatible with
different versions of Gazebo, especially the latest ones.

Although using the officially supported version is the recommended way
specially for non experienced users, some use cases might need to use a
newer version of Gazebo than the one selected in REP-2000.

### Upstream versions released using this tutorial

The `gbp -release repository` hosts the latest version released by the
maintainers of `ros_gz`. When using these instructions to release a new custom
version the version of `ros_gz` released will be the latest one existing in the
official `gbp -release repository`. The version would be the same but the
release number will start on 1000.

## 2. Initial setup

To release a modified version of `ros_gz` which supports a different major
version of gazebo, before running bloom some actions need to be taken:

## 2. Initial setup

### 2.1 Create the alternative -release repository

For a new official wrappers the notation used below correspond to `ros_ign-release`:

1. Fork (manually or using gh) current gbp repository:
https://github.com/ros2-gbp/ros_ign-release

1. Clone the new repo, go to the directory and run rename-gazebo-ros-pkgs.bash
- Usage: *$ rename-ros_gz-pkgs.bash <desired_gz_version> <space separted list of rosdistros to release>*


### 2.2 Create a custom track in tracks.yml

Copy the existing ROS 2 yaml track information and rename it to `${ros2}_gz${version}`.
For example, the `humble` track to be used as base for Garden would be `humble_gzgarden`.

New versioning requires bumping to large numbers. Set:

```
release_inc: '1000'
```

All non ubuntu generators can be removed.
54 changes: 54 additions & 0 deletions bloom/ros_gz/rename-ros_gz-pkgs.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
#
# This script should be run on a fork of ros_ign-release/ros_gz-release repository
# and will modify control.em bloom templates for:
#
# - Rename the Package name modifying -gz- by -gz$DISTRO-
# - Define a conflict on current official name: $(Package)
#

if [[ ${#} -lt 2 ]]; then
echo "Usage: ${0} <gz_release_to_use>> <space separted list of rosdistros to release>"
exit 1
fi

# Safety check for ros2-gbp repo
if [[ -n $(git config --get remote.origin.url | grep git@github.com:ros2-gbp/ros_ign-release.git) ]]; then
echo "This script refuses to modify the ros2-gbp repository. You probably don't want this."
exit 1
fi

GZ_RELEASE=${1}
ROS_DISTROS=${*:2}

PKGS="ros_gz ros_gz_bridge ros_gz_image ros_gz_interfaces ros_gz_sim ros_gz_sim_demos"

for pkg in ${PKGS}; do
for distro in ${ROS_DISTROS}; do
echo " - Processing $pkg in $distro"
if ! git checkout "debian/$distro/$pkg"; then
echo "The branch debian/$distro/$pkg was not found in the repo"
echo "Did you forget to run git fetch?"
exit 1
fi
# Add GZ_VERSION env variable in rules file
sed -i -e "/export DH_VERBOSE/a\export GZ_VERSION=${GZ_RELEASE}" debian/rules.em
git commit debian/rules.em -m "Export GZ_VERSION in rules file"
git push origin "debian/$distro/$pkg"
if grep 'Package.replace' debian/control.em; then
echo " + skip ${pkg} for ${distro}: seems to have changes in place"
continue
fi
# Modify package name. Note that regexp can not be stricker than
# *-gz since there is a package named package ros-gz
sed -i -e "s/Package: @(Package)/Package: @(Package.replace('-gz','-gz${GZ_RELEASE}'))/" debian/control.em
sed -i -e "s/Source: @(Package)/Source: @(Package.replace('-gz','-gz${GZ_RELEASE}'))/" debian/control.em
sed -i -e "s/@(Package)/@(Package.replace('-gz','-gz${GZ_RELEASE}'))/" debian/changelog.em
git commit debian/control.em debian/changelog.em -m "Patch name to release ${GZ_RELEASE} version"
# Include conflict with initial package name in ROS
sed -i -e '/^Depends/a\Conflicts: \@(Package)' debian/control.em

git commit debian/control.em -m "Set up a conflict with official ROS packages"
git push origin "debian/$distro/$pkg"
done
done