This repository is currently being migrated. It's locked while the migration is in progress.
forked from jspricke/ros-deb-builder-action
-
Notifications
You must be signed in to change notification settings - Fork 1
/
prepare
executable file
·70 lines (57 loc) · 2.7 KB
/
prepare
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
# SPDX-License-Identifier: BSD-3-Clause
while getopts d:h OPTCHAR; do
case "$OPTCHAR" in
d)
DEB_DISTRO="$OPTARG"
;;
h)
echo "usage: $0 [-d]"
echo " -d To specify the distribution of the chroot."
exit
;;
*)
echo "Error parsing arguments"
exit 1
;;
esac
done
shift "$((OPTIND - 1))"
echo "Install dependencies"
set -ex
# TODO: drop once new distros are available
test "$(lsb_release -cs)" = "jammy" && sudo add-apt-repository -y ppa:v-launchpad-jochen-sprickerhof-de/sbuild
sudo apt update
# Try different package combinations:
# first is for a clean jammy with the PPA
# second is for Debian bookworm and newer
# third is for OSRF package names
# TODO: get OSRF to add proper package relations
sudo DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends sbuild mmdebstrap distro-info debian-archive-keyring ccache uidmap vcstool python3-rosdep2 catkin python3-bloom curl apt-cacher-ng git-lfs || \
sudo DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends sbuild mmdebstrap distro-info debian-archive-keyring ccache uidmap vcstool python3-rosdep2 colcon python3-colcon-package-information python3-colcon-ros python3-bloom curl apt-cacher-ng git-lfs || \
sudo DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends sbuild mmdebstrap distro-info debian-archive-keyring ccache uidmap python3-vcstool python3-rosdep python3-colcon-cmake python3-colcon-installed-package-information python3-colcon-library-path python3-colcon-package-information python3-colcon-pkg-config python3-colcon-recursive-crawl python3-colcon-test-result python3-bloom curl apt-cacher-ng git-lfs
echo "Setup build environment"
mkdir -p "$HOME/.cache/sbuild"
mmdebstrap --variant=buildd --include=apt,ccache,auto-apt-proxy,ca-certificates \
--customize-hook='chroot "$1" update-ccache-symlinks' \
--components=main,universe "$DEB_DISTRO" "$HOME/.cache/sbuild/$DEB_DISTRO-amd64.tar"
ccache --zero-stats --max-size=10.0G
# allow ccache access from sbuild
chmod a+X "$HOME" "$HOME/.cache"
chmod -R a+rwX "$HOME/.cache/ccache"
cat << "EOF" > "$HOME/.sbuildrc"
$build_environment = { "CCACHE_DIR" => "/build/ccache" };
$path = "/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games";
$build_path = "/build/package/";
$dsc_dir = "package";
$unshare_bind_mounts = [ { directory => "$HOME/.cache/ccache", mountpoint => "/build/ccache" } ];
$verbose = 1;
EOF
echo "$SBUILD_CONF" >> "$HOME/.sbuildrc"
test -z "$REPOS_FILE" -a ! -f sources.repos && exit
REPOS_FILE="${REPOS_FILE:-sources.repos}"
echo "Checkout workspace"
mkdir -p src
if [ -z "$SKIP_VCS_IMPORT" ]; then
vcs import --recursive --input "$REPOS_FILE" src
fi