Skip to content

Commit

Permalink
Implement TEST=debians
Browse files Browse the repository at this point in the history
  • Loading branch information
mathias-luedtke committed Jul 22, 2021
1 parent 714b847 commit 3bf4a63
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
64 changes: 64 additions & 0 deletions industrial_ci/src/tests/debians.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash

# Copyright (c) 2021, Mathias Lüdtke
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Based on https://github.com/ros-industrial/industrial_ci/issues/697#issuecomment-876293987

function prepare_debians() {
true
}

function build_and_install_debian() (
local pkg_path=$1
shift
cd "$pkg_path"
ici_quiet_echo bloom-generate rosdebian --ros-distro="$ROS_DISTRO" --debian-inc="ici~"
ici_quiet_echo dpkg-buildpackage -b -uc -us
mv ../*.{buildinfo,changes,deb} .
ici_quiet_echo ici_asroot dpkg -i *.deb
)

function run_debians() {
export BUILDER=colcon
ici_source_builder
ici_run "${BUILDER}_setup" ici_quiet builder_setup
ici_run "setup_bloom" ici_quiet ici_install_pkgs_for_command bloom-generate python3-bloom debhelper
ici_run "setup_dpkg_dev" ici_quiet ici_install_pkgs_for_command dpkg-buildpackage dpkg-dev

ici_run "setup_rosdep" ici_setup_rosdep

if [ ! -f "$_ROS_KEYRING" ]; then
ici_run "setup_gpg_key" ici_setup_gpg_key
fi

local ws
ici_make_temp_dir ws

local sourcespace
ici_make_temp_dir sourcespace

for name in upstream target downstream; do
local sources=()
local current="$sourcespace/$name"
ici_parse_env_array sources "${name^^}_WORKSPACE"
ici_run "prepare_${name}_sourcespace" ici_prepare_sourcespace "$current" "${sources[@]}"
ici_run "install_${name}_dependencies" ici_quiet ici_install_dependencies "$UNDERLAY" "$ROSDEP_SKIP_KEYS" "$sourcespace"

while read -r -a pkg; do
ici_run "${pkg[0]}_debian" build_and_install_debian "$current/${pkg[1]}"
done < <(cd "$current" && colcon list -t)
done
}
5 changes: 5 additions & 0 deletions industrial_ci/src/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ function ici_quiet {
return "$err"
}

function ici_quiet_echo {
echo "Running '$*'..."
ici_quiet "$@"
}

function ici_asroot {
if [ "$EUID" -ne 0 ] && command -v sudo > /dev/null; then
sudo "$@"
Expand Down

0 comments on commit 3bf4a63

Please # to comment.