Skip to content

Commit 5c2ed48

Browse files
authored
Fix issues with apt installer on 18.04 (#56)
* Add --apt-allow-insecure to apt installer * This a workaround for security changes in apt. Using this flag will allow 18.04 users to bundle for ROS kinetic and melodic. * Add integration tests for ROS Melodic
1 parent e3b4bb7 commit 5c2ed48

8 files changed

+76
-8
lines changed

.dockerignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
integration/test_workspace/build
2+
integration/test_workspace/install
3+
integration/test_workspace/*_bundle
4+
integration/*/*.tar
5+
integration/*/*.tar.gz
6+

.travis.yml

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
language: python
22
python: "3.5"
33
dist: xenial
4+
env:
5+
- TOXENV=unittest
6+
- ROS_DISTRO=kinetic TOXENV=py35-pypi
7+
- ROS_DISTRO=kinetic TOXENV=py35-github
8+
- ROS_DISTRO=melodic TOXENV=py35-pypi
9+
- ROS_DISTRO=melodic TOXENV=py35-github
410
services:
511
- docker
612
sudo: true

Dockerfile Dockerfile.kinetic

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ COPY . /opt/package
88
WORKDIR /opt/package
99

1010
RUN apt-get update && \
11-
apt-get install -y python3-pip python3-apt python-pip
11+
apt-get install -y python3-pip python3-apt python-pip enchant
1212

1313
RUN rosdep update && \
1414
rosdep install --from-paths integration/test_workspace --ignore-src -r -y

Dockerfile.melodic

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM ros:melodic
2+
3+
SHELL ["/bin/bash", "-c"]
4+
5+
RUN echo "yaml https://s3-us-west-2.amazonaws.com/rosdep/base.yaml" > /etc/ros/rosdep/sources.list.d/19-aws-sdk.list
6+
7+
COPY . /opt/package
8+
WORKDIR /opt/package
9+
10+
RUN apt-get update && \
11+
apt-get install -y python3-pip python3-apt python-pip enchant
12+
13+
RUN rosdep update && \
14+
rosdep install --from-paths integration/test_workspace --ignore-src -r -y
15+
16+
RUN pip3 install --upgrade pip setuptools
17+
RUN pip3 install -r requirements.txt
18+
RUN pip3 install -e .
19+
20+
WORKDIR /opt/package/integration/test_workspace
21+
RUN source /opt/ros/melodic/setup.sh; colcon build
22+
RUN source /opt/ros/melodic/setup.sh; colcon bundle --bundle-version 1 --bundle-base v1 --apt-allow-insecure
23+
RUN source /opt/ros/melodic/setup.sh; colcon bundle --bundle-version 2 --bundle-base v2 --apt-allow-insecure
24+
25+

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ To build your ROS workspace into a bundle execute:
2727
This will parse your dependencies, download apt and pip dependencies, install the dependencies into the bundle, and
2828
then install your built workspace into the bundle. The final output is located at `bundle/output.tar`
2929

30+
## Ubuntu 18.04
31+
32+
**This version of Ubuntu is not yet officially supported**
33+
34+
We are currently tracking an [issue](https://github.com/colcon/colcon-bundle/issues/3) to support 18.04.
35+
In the mean time, if you would like to build on 18.04 you can use the `--apt-allow-insecure` flag in order to work
36+
around the `apt` security issues we are running into.
37+
3038
## In Docker
3139

3240
The simplest way to get up and running without affecting your local development environment is to use Docker.

colcon_bundle/installer/apt.py

+18
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def __init__(self): # noqa: D107
2020
self._cache_dir = None
2121
self.context = None
2222
self.include_sources = False
23+
self.allow_insecure = False
2324
self.sources_path = None
2425
self.metadata = {}
2526
satisfies_version(
@@ -50,6 +51,12 @@ def add_arguments(self, *, parser): # noqa: D102
5051
'--apt-sources-list', default=sources_list_path,
5152
help='Path to the apt sources list that should be used for package'
5253
'installation in the bundle.')
54+
parser.add_argument(
55+
'--apt-allow-insecure', action='store_true',
56+
help='Sets Acquire::AllowInsecureRepositories and '
57+
'Acquire::AllowDowngradeToInsecureRepositories to True. See '
58+
'apt-secure(8) manpage for more information.'
59+
)
5360

5461
def should_load(self): # noqa: D102
5562
try:
@@ -80,6 +87,7 @@ def initialize(self, context): # noqa: D102
8087
self._cache = apt.Cache(
8188
rootdir=self._cache_dir, progress=apt.progress.text.OpProgress())
8289
self.include_sources = self.context.args.include_sources
90+
self.allow_insecure = self.context.args.apt_allow_insecure
8391
self.sources_path = os.path.join(self._cache_dir, 'sources')
8492
self.setup()
8593

@@ -93,6 +101,16 @@ def setup(self): # noqa: D102
93101
apt.apt_pkg.config.set('Dir::Etc::TrustedParts',
94102
apt.apt_pkg.config.find_file(
95103
'Dir::Etc::TrustedParts'))
104+
apt.apt_pkg.config.set('Acquire::BrokenProxy', 'true')
105+
apt.apt_pkg.config.set('Acquire::http::Pipeline-Depth', '0')
106+
apt.apt_pkg.config.set('Acquire::http::No-Cache', 'true')
107+
108+
if self.allow_insecure:
109+
apt.apt_pkg.config.set(
110+
'Acquire::AllowInsecureRepositories', 'True')
111+
apt.apt_pkg.config.set(
112+
'Acquire::AllowDowngradeToInsecureRepositories', 'True')
113+
96114
apt.apt_pkg.config.clear('APT::Update::Post-Invoke-Success')
97115

98116
sources_list_file = os.path.join(self._cache_dir, 'etc', 'apt',

run_integration_test.sh

+10-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rm -rf integration/v2.tar
1111
# Preparing dependencies generated by tox to requirements.txt for docker use
1212
pip freeze > requirements.txt
1313
# Build bundles
14-
docker build -t test-container .
14+
docker build -f Dockerfile.${ROS_DISTRO} -t test-container .
1515
# Copy bundles into local directory
1616
docker run -v=$(pwd):/workspace test-container /workspace/integration/copy-bundles.sh
1717

@@ -33,5 +33,12 @@ mkdir ./v1_bundle
3333
tar -xzOf ./v1.tar.gz bundle.tar | tar -xf - --directory ./v1_bundle
3434

3535
# Run tests
36-
docker run -it -v $(pwd):/workspace ubuntu:xenial /workspace/test_v1.sh
37-
docker run -it -v $(pwd):/workspace ubuntu:xenial /workspace/test_v2.sh
36+
if [[ $act = "kinetic" ]]
37+
then
38+
docker run -it -v $(pwd):/workspace ubuntu:xenial /workspace/test_v1.sh
39+
docker run -it -v $(pwd):/workspace ubuntu:xenial /workspace/test_v2.sh
40+
else
41+
docker run -it -v $(pwd):/workspace ubuntu:bionic /workspace/test_v1.sh
42+
docker run -it -v $(pwd):/workspace ubuntu:bionic /workspace/test_v2.sh
43+
fi
44+

tox.ini

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
[tox]
2-
envlist = unittest,py35-{pypi, github}
3-
4-
51
[testenv:unittest]
62
deps = -rrequirements_devel.txt
73
commands = {envpython} -m pytest --cov=colcon_ros --cov-branch
84

95
[testenv:py35-pypi]
6+
passenv = *
107
deps =
118
colcon-core
129
colcon-ros-bundle
1310
commands = ./run_integration_test.sh
1411

1512
[testenv:py35-github]
13+
passenv = *
1614
deps =
1715
-e git+https://github.com/colcon/colcon-cmake.git#egg=colcon-cmake
1816
-e git+https://github.com/colcon/colcon-core.git#egg=colcon-core

0 commit comments

Comments
 (0)