Skip to content

Run tailor-distro on Noble #102

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pipeline {
"--build-arg AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY .")
}
parent_image.inside() {
sh('pip3 install -e tailor-distro')
sh('pip3 install -e tailor-distro --break-system-packages')
}
docker.withRegistry(params.docker_registry, docker_credentials) {
parent_image.push()
Expand Down Expand Up @@ -275,7 +275,7 @@ pipeline {
unstash(name: debianStash(recipe_label))
sh("""
ccache -z
cd $workspace_dir && dpkg-buildpackage -uc -us -b
cd $workspace_dir && dpkg-buildpackage -uc -us -b --jobs=auto
ccache -s -v
""")
stash(name: packageStash(recipe_label), includes: "*.deb")
Expand Down
26 changes: 13 additions & 13 deletions environment/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:focal
FROM ubuntu:noble

LABEL tailor="environment"

Expand All @@ -18,7 +18,7 @@ RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8

RUN apt-get update && apt-get install --no-install-recommends -y \
python3-rosdep \
bzip2 \
python3-dev \
python3-pip \
python3-setuptools \
Expand All @@ -29,26 +29,26 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
xz-utils

# Install aptly for managing mirror debs
RUN echo "deb http://repo.aptly.info/ squeeze main" >> /etc/apt/sources.list && \
curl --silent https://www.aptly.info/pubkey.txt | apt-key add - && \
apt-get update && apt-get install --no-install-recommends -y aptly
RUN curl -LO --output-dir /tmp https://github.com/aptly-dev/aptly/releases/download/v1.5.0/aptly_1.5.0_linux_amd64.tar.gz && \
tar xzf /tmp/aptly_1.5.0_linux_amd64.tar.gz --strip-components 1 -C /usr/local/bin

# Install locusrobotics deb-s3 fork for managing bundle debs
RUN git clone https://github.com/locusrobotics/deb-s3.git && \
RUN git clone -b master-noble https://github.com/locusrobotics/deb-s3.git && \
cd deb-s3 && bundle update --bundler && bundle install && ln -sf $(pwd)/bin/deb-s3 /usr/local/bin/deb-s3

# Build and install rosdistro
COPY tailor-distro tailor-distro
RUN pip3 install -e tailor-distro --break-system-packages

# Inject the rosdep definitions from source
RUN if [[ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]] ; then rosdep init ; fi
RUN echo "yaml file:///etc/ros/rosdep/rosdep.yaml" > /etc/ros/rosdep/sources.list.d/10-tailor.list
COPY rosdistro/rosdep/rosdep.yaml /etc/ros/rosdep/rosdep.yaml

COPY tailor-distro tailor-distro
RUN pip3 install -e tailor-distro

RUN groupadd -r tailor && useradd -ms /bin/bash -g tailor -G sudo tailor
RUN usermod -md /home/tailor -s /bin/bash -l tailor ubuntu && \
groupmod -n tailor ubuntu && \
echo "tailor:tailor" | chpasswd && \
echo "tailor ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
USER tailor

RUN mkdir -p /home/tailor && \
usermod -d /home/tailor tailor

RUN rosdep update
25 changes: 13 additions & 12 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,24 @@ description = Build bundles of ROS distributions.
long_description = file: README.md

[options]
python_requires = >=3.6
python_requires = >=3.10
install_requires =
bloom ==0.11.2
catkin_pkg ==0.5.2
Click ==8.1.3
Jinja2 ==3.1.2
gitpython ==3.1.31
PyGithub ==2.6.1
PyYaml ==6.0
rosdistro ==0.9.0
bloom ==0.12.0
catkin_pkg ==1.0.0
Click ==8.1.7
Jinja2 ==3.1.4
gitpython ==3.1.43
PyGithub ==2.5.0
PyYaml ==6.0.2
rosdistro ==1.0.1
rosdep ==0.25.1
packages = find:
setup_requires =
pytest-runner ==5.1
tests_require =
pytest ==5.1.3
pytest-mypy ==0.4.1
pytest-flake8 ==1.0.4
pytest ==8.4.3
pytest-mypy ==0.10.3
pytest-flake8 ==1.3.0

[options.entry_points]
console_scripts =
Expand Down
14 changes: 12 additions & 2 deletions tailor_distro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ def gpg_import_keys(keys: Iterable[pathlib.Path]) -> None:
run_command(['gpg1', '--import', str(key)])


def get_gpg_key_id() -> str:
"""Get gpg's key id."""
gpg_key = run_command(['gpg1', '--fingerprint'], capture_output=True)
gpg_key = gpg_key.stdout.decode('utf-8').split('\n')
gpg_key = ''.join([line for line in gpg_key if 'Key fingerprint' in line])
return ''.join(gpg_key.split(' ')[-2:])


def aptly_configure(apt_repo, release_label):
bucket_name = get_bucket_name(apt_repo)
aptly_endpoint = f"s3:{bucket_name}:{release_label}/ubuntu/"
Expand Down Expand Up @@ -98,21 +106,23 @@ def deb_s3_list_packages(common_args: Iterable[str]) -> List[PackageEntry]:


def deb_s3_upload_packages(package_files: Iterable[pathlib.Path], visibility: str, common_args: Iterable[str]):
gpg_key = get_gpg_key_id()
command = [
'deb-s3', 'upload',
*map(str, package_files),
f'--visibility={visibility}', '--sign', '--gpg-provider=gpg1', '--preserve-versions'
f'--visibility={visibility}', f'--sign={gpg_key}', '--gpg-provider=gpg1', '--preserve-versions'
]
command.extend(common_args)
run_command(command)


def deb_s3_delete_packages(packages: Iterable[PackageEntry], visibility: str, common_args: Iterable[str]):
gpg_key = get_gpg_key_id()
for package in packages:
command = [
'deb-s3', 'delete', package.name,
f'--versions={package.version}', f'--arch={package.arch}', '--do-package-remove',
f'--visibility={visibility}', '--sign', '--gpg-provider=gpg1'
f'--visibility={visibility}', f'--sign={gpg_key}', '--gpg-provider=gpg1'
]
command.extend(common_args)
run_command(command)
5 changes: 4 additions & 1 deletion tailor_distro/debian_templates/rules.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/make -f

%:
dh $@
dh $@ --parallel

export PYTHONUNBUFFERED=1
export PYTHONDONTWRITEBYTECODE=1
Expand Down Expand Up @@ -77,3 +77,6 @@ override_dh_installdeb:
find . -type f -exec grep -I -q . {} \; -print0 | xargs -0 sed -ri "s|($(CURDIR)/)?debian/tmp/opt|/opt|g" && \
find . -name '*.pyc' -delete && \
dh_installdeb

overide_dh_builddeb:
dh_builddeb -- -Zzstd --threads-max=32