Skip to content

Commit

Permalink
COLCON_PKG_SELECTION: env variable specifying package selection options
Browse files Browse the repository at this point in the history
  • Loading branch information
rhaschke committed Sep 9, 2023
1 parent e2d8d4e commit 65e6841
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/generic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ on:
type: string
description: ROS sources to compile. See README.md for details.
required: false
COLCON_PKG_SELECTION:
type: string
description: colcon package selection arguments
required: false

# workflow control
SKIP_EXISTING:
Expand Down Expand Up @@ -138,6 +142,7 @@ jobs:
# leave some time for the remaining steps too (github cancels the job after 360 minutes)
timeout-minutes: ${{ inputs.BUILD_TIMEOUT || vars.BUILD_TIMEOUT || 340 }}
env:
COLCON_PKG_SELECTION: ${{ inputs.COLCON_PKG_SELECTION || vars.COLCON_PKG_SELECTION || '' }}
EXTRA_SBUILD_CONFIG: ${{ inputs.EXTRA_SBUILD_CONFIG || vars.EXTRA_SBUILD_CONFIG }}
EXTRA_SBUILD_OPTS: ${{ inputs.EXTRA_SBUILD_OPTS || vars.EXTRA_SBUILD_OPTS }}
DEB_BUILD_OPTIONS: ${{ inputs.DEB_BUILD_OPTIONS || vars.DEB_BUILD_OPTIONS || 'nocheck' }}
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/interactive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@ on:
description: 'ROS sources to compile:'
required: true
default: '*.repos'
COLCON_PKG_SELECTION:
type: string
description: 'colcon package selection:'
required: false
SKIP_EXISTING:
type: boolean
description: Skip building packages already existing in the repository
description: Skip existing packages?
required: false
DEPLOY_MODE:
type: choice
description: |
How to deploy?
Uses vars.DEPLOY_URL and secrets.DEPLOY_PRIVATE_KEY
description: How to deploy?
required: true
default: skip
options:
Expand All @@ -39,7 +41,7 @@ on:
- append
BRANCH:
type: string
description: 'Branch to use (<deb distro>-<ros distro>):'
description: 'Branch to use:'
required: false

env:
Expand All @@ -53,6 +55,7 @@ jobs:
DEB_DISTRO: ${{ inputs.DEB_DISTRO || vars.DEB_DISTRO }}
ROS_DISTRO: ${{ inputs.ROS_DISTRO || vars.ROS_DISTRO || 'one' }}
ROS_SOURCES: ${{ inputs.ROS_SOURCES || vars.ROS_SOURCES }}
COLCON_PKG_SELECTION: ${{ inputs.COLCON_PKG_SELECTION || vars.COLCON_PKG_SELECTION || '' }}
# proceed from existing debs artifact if run_attempt > 1
DOWNLOAD_DEBS: ${{ github.run_attempt != '1' }}
SKIP_EXISTING: ${{ inputs.SKIP_EXISTING || vars.SKIP_EXISTING || false}}
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ repos:
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]

- repo: local
hooks:
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ variable | type | default | semantics
`ROS_DISTRO` | string | one | ROS distribution codename to compile for
`DEB_DISTRO` | string | jammy | The Debian/Ubuntu distribution codename to compile for.
`ROS_SOURCES` | string | `*.repos` | [ROS sources to compile](#what-to-build)
`COLCON_PKG_SELECTION` | string | `` | [colcon package selectio argument(s)](#where-to-start-building-from)
`SKIP_EXISTING` | boolean | false | [Skip (re)building packages already existing in the repository](#where-to-start-building-from)
`DOWNLOAD_DEBS` | boolean | false | [Continue building from previous debs artifact?](#where-to-start-building-from)
`BUILD_TIMEOUT` | number | 340 | Cancel build after this time, before github will do (minutes)
Expand All @@ -48,6 +49,12 @@ Building a complete ROS distro from scratch takes a lot of time, often more than

The example workflow [splitted.yaml](.github/workflows/splitted.yaml) uses `DOWNLOAD_DEBS` to build a large ROS distro from several `.repos` files.

Specifying `COLCON_PKG_SELECTION` allows to limit the build to a subset of packages via [colcon package selection options](https://colcon.readthedocs.io/en/released/reference/package-selection-arguments.html). For example:
- To rebuild a specific package and all its downstream dependencies:
`--packages-above-and-dependencies <pkg ...>`
- To rebuild a single package (only use if ABI/API hasn't changed):
`--packages-select <pkg ...>`

### What to build?

`ROS_SOURCES` specifies a (space-separated) list of inputs suitable for `vcs import`.
6 changes: 4 additions & 2 deletions src/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ function deb_pkg_name {
}

function register_local_pkgs_with_rosdep {
for pkg in $(colcon list --topological-order --names-only); do
#shellcheck disable=SC2086
for pkg in $(colcon list --topological-order --names-only $COLCON_PKG_SELECTION); do
cat << EOF >> "$DEBS_PATH/local.yaml"
$pkg:
$DISTRIBUTION:
Expand Down Expand Up @@ -101,7 +102,8 @@ function build_source {
ici_timed "Register new packages with rosdep" register_local_pkgs_with_rosdep

local pkg_paths
pkg_paths="$(colcon list --topological-order --paths-only)"
#shellcheck disable=SC2086
pkg_paths="$(colcon list --topological-order --paths-only $COLCON_PKG_SELECTION)"
local count=1
local total
total="$(echo "$pkg_paths" | wc -l)"
Expand Down
1 change: 1 addition & 0 deletions src/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export EXTRA_ROSDEP_SOURCES=${EXTRA_ROSDEP_SOURCES:-}

## build options
export ROS_SOURCES=${ROS_SOURCES:-*.repos}
export COLCON_PKG_SELECTION=${COLCON_PKG_SELECTION:-}
export EXTRA_SBUILD_CONFIG=${EXTRA_SBUILD_CONFIG:-}
export CONTINUE_ON_ERROR=${CONTINUE_ON_ERROR:-false}
export EXTRA_SBUILD_OPTS=${EXTRA_SBUILD_OPTS:-}
Expand Down
1 change: 1 addition & 0 deletions src/scripts/generic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ cat <<EOF
ROS_DISTRO=$ROS_DISTRO
DEB_DISTRO=$DEB_DISTRO
ROS_SOURCES=$ROS_SOURCES
COLCON_PKG_SELECTION=$COLCON_PKG_SELECTION
EXTRA_DEB_SOURCES=$EXTRA_DEB_SOURCES
EXTRA_ROSDEP_SOURCES=$EXTRA_ROSDEP_SOURCES
Expand Down
3 changes: 2 additions & 1 deletion src/scripts/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ echo apt-cacher-ng apt-cacher-ng/tunnelenable boolean true | ici_asroot debconf-
# Install packages on host
DEBIAN_FRONTEND=noninteractive ici_timed "Install packages" ici_apt_install \
mmdebstrap sbuild schroot devscripts libdistro-info-perl ccache curl apt-cacher-ng \
python3-pip python3-rosdep python3-vcstool python3-colcon-package-information python3-colcon-ros
python3-pip python3-rosdep python3-vcstool \
python3-colcon-package-information python3-colcon-package-selection python3-colcon-ros

# Install patched bloom to handle ROS "one" distro key when resolving python and ROS version
ici_timed "Install bloom" ici_asroot pip install -U git+https://github.com/rhaschke/bloom.git@ros-one
Expand Down

0 comments on commit 65e6841

Please sign in to comment.