Skip to content

Commit

Permalink
Build Ubuntu 24.04 packages
Browse files Browse the repository at this point in the history
Utilize `dpkg-shlibdeps(1)` to build the list of dependencies, this was needed as the old approach was not compatible with Noble.

Under Noble, we have "diversions" to handle:

```
$ dpkg -S ld-linux-aarch64.so.1
libc6:arm64: /usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1
libc6:arm64: /usr/lib/ld-linux-aarch64.so.1
diversion by libc6 from: /lib/ld-linux-aarch64.so.1
diversion by libc6 to: /lib/ld-linux-aarch64.so.1.usr-is-merged
diversion by libc6 from: /lib/ld-linux-aarch64.so.1
diversion by libc6 to: /lib/ld-linux-aarch64.so.1.usr-is-merged
```

Using `dpkg-shlibdeps` will also make a difference in that it will add version constraints while our older approach would not. I believe it is an improvement though.

Example:

```
$ docker build --progress=plain --target tester --build-arg image=ubuntu:jammy --build-arg erlang_version=26.0 --build-arg rabbitmq_version=3.13.0 .

# now
=> Depends: procps, libc6 (>= 2.34), libgcc-s1 (>= 3.0), libstdc++6 (>= 11), libtinfo6 (>= 6), zlib1g (>= 1:1.2.8)

# before
=> Depends: procps, libc6,libgcc-s1,libstdc++6,libtinfo6,zlib1g
```
  • Loading branch information
walro committed Aug 26, 2024
1 parent 24b3f98 commit a832a12
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ WORKDIR /tmp/erlang
RUN curl -fL https://api.github.com/repos/erlang/otp/tarball/refs/tags/OTP-${erlang_version} | tar zx --strip-components=1

# erlang before 24.1 requires gcc-9 and autoconf-2.69
RUN if (grep -q -e jammy -e bullseye /etc/os-release && dpkg --compare-versions "$erlang_version" lt 24.1); then \
RUN if (grep -q -e noble -e jammy -e bullseye /etc/os-release && dpkg --compare-versions "$erlang_version" lt 24.1); then \
apt-get install -y gcc-9 autoconf2.69 && \
ln -sf /usr/bin/gcc-9 /usr/bin/gcc && \
ln -sf /usr/bin/autoconf2.69 /usr/bin/autoconf; \
Expand Down Expand Up @@ -69,7 +69,10 @@ RUN libssl_version=$(dpkg-query --showformat='${Version}' --show libssl-dev); \
# when cross compiling the target version of strip is required

ARG erlang_iteration=1
RUN fpm -s dir -t deb \
RUN mkdir debian && touch debian/control; \
DEPS=$(dpkg-shlibdeps -O -e $(find /tmp/install/usr -name beam.smp) 2> /dev/null); \
SHLIBS_PREFIX="shlibs:Depends="; \
fpm -s dir -t deb \
--chdir /tmp/install \
--name esl-erlang \
--version $erlang_version \
Expand All @@ -81,7 +84,7 @@ RUN fpm -s dir -t deb \
--url "https://erlang.org" \
--license "Apache 2.0" \
--depends "procps" \
--depends "$(readelf -d $(find /tmp/install/usr -name beam.smp) | awk '/NEEDED/{gsub(/[\[\]]/, "");print $5}' | xargs dpkg -S | cut -d: -f1 | sort -u | paste -sd,)" \
--depends "${DEPS#$SHLIBS_PREFIX}" \
--conflicts "erlang-asn1,erlang-base,erlang-base-hipe,erlang-common-test,erlang-corba,erlang-crypto,erlang-debugger,erlang-dev,erlang-dialyzer,erlang-diameter,erlang-doc,erlang-edoc,erlang-eldap,erlang-erl-docgen,erlang-et,erlang-eunit,erlang-examples,erlang-ftp,erlang-ic,erlang-ic-java,erlang-inets,erlang-inviso,erlang-jinterface,erlang-manpages,erlang-megaco,erlang-mnesia,erlang-mode,erlang-nox,erlang-observer,erlang-odbc,erlang-os-mon,erlang-parsetools,erlang-percept,erlang-public-key,erlang-reltool,erlang-runtime-tools,erlang-snmp,erlang-src,erlang-ssh,erlang-ssl,erlang-syntax-tools,erlang-tftp,erlang-tools,erlang-webtool,erlang-wx,erlang-xmerl"

#RUN apt-get install -y lintian
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Excluded erlang packages:

## Versions

Every [version of Erlang that is released on GitHub](https://github.com/erlang/otp/releases) is built, currently for Ubuntu 20.04 and 22.04.
Every [version of Erlang that is released on GitHub](https://github.com/erlang/otp/releases) is built, currently for Ubuntu 20.04, 22.04 and 24.04.

## Install

Expand Down
2 changes: 1 addition & 1 deletion bin/missing-versions
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require_relative "../lib/github"
require_relative "../lib/packagecloud"

DISTS = %w[ubuntu/jammy ubuntu/focal debian/bookworm debian/bullseye].freeze
DISTS = %w[ubuntu/noble ubuntu/jammy ubuntu/focal debian/bookworm debian/bullseye].freeze
PLATFORMS = %w[amd64 arm64].freeze
# 24.2 supports OpenSSL 3 and modern gcc/autoconf versions
FIRST_SANE_VERSION = Gem::Version.new("24.2")
Expand Down

0 comments on commit a832a12

Please sign in to comment.