Skip to content

Commit

Permalink
Add ppc64le support
Browse files Browse the repository at this point in the history
Add ppc64le support to Debian bullseye and bookworm. Debian buster does
not support the ppc64le architecture.
  • Loading branch information
Jenkins-J committed Jan 10, 2024
1 parent e04165e commit 743e6f4
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
1 change: 1 addition & 0 deletions 1.75.0/bookworm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN set -eux; \
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a' ;; \
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800' ;; \
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e7b0f47557c1afcd86939b118cbcf7fb95a5d1d917bdd355157b63ca00fc4333' ;; \
ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='1032934fb154ad2d365e02dcf770c6ecfaec6ab2987204c618c21ba841c97b44' ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \
Expand Down
1 change: 1 addition & 0 deletions 1.75.0/bookworm/slim/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ RUN set -eux; \
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a' ;; \
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800' ;; \
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e7b0f47557c1afcd86939b118cbcf7fb95a5d1d917bdd355157b63ca00fc4333' ;; \
ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='1032934fb154ad2d365e02dcf770c6ecfaec6ab2987204c618c21ba841c97b44' ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \
Expand Down
1 change: 1 addition & 0 deletions 1.75.0/bullseye/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN set -eux; \
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a' ;; \
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800' ;; \
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e7b0f47557c1afcd86939b118cbcf7fb95a5d1d917bdd355157b63ca00fc4333' ;; \
ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='1032934fb154ad2d365e02dcf770c6ecfaec6ab2987204c618c21ba841c97b44' ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \
Expand Down
1 change: 1 addition & 0 deletions 1.75.0/bullseye/slim/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ RUN set -eux; \
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a' ;; \
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800' ;; \
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e7b0f47557c1afcd86939b118cbcf7fb95a5d1d917bdd355157b63ca00fc4333' ;; \
ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='1032934fb154ad2d365e02dcf770c6ecfaec6ab2987204c618c21ba841c97b44' ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \
Expand Down
34 changes: 25 additions & 9 deletions x.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@

DebianArch = namedtuple("DebianArch", ["bashbrew", "dpkg", "rust"])

debian_arches = [
debian_buster_arches = [
DebianArch("amd64", "amd64", "x86_64-unknown-linux-gnu"),
DebianArch("arm32v7", "armhf", "armv7-unknown-linux-gnueabihf"),
DebianArch("arm64v8", "arm64", "aarch64-unknown-linux-gnu"),
DebianArch("i386", "i386", "i686-unknown-linux-gnu"),
]

debian_other_arches = [
DebianArch("ppc64le", "ppc64el", "powerpc64le-unknown-linux-gnu"),
]

debian_variants = [
"buster",
"bullseye",
Expand Down Expand Up @@ -57,30 +61,42 @@ def write_file(file, contents):
f.write(contents)

def update_debian():
arch_case = 'dpkgArch="$(dpkg --print-architecture)"; \\\n'
arch_case += ' case "${dpkgArch##*-}" in \\\n'
for arch in debian_arches:
buster_arch_case = 'dpkgArch="$(dpkg --print-architecture)"; \\\n'
buster_arch_case += ' case "${dpkgArch##*-}" in \\\n'
for arch in debian_buster_arches:
hash = rustup_hash(arch.rust)
arch_case += f" {arch.dpkg}) rustArch='{arch.rust}'; rustupSha256='{hash}' ;; \\\n"
arch_case += ' *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \\\n'
arch_case += ' esac'
buster_arch_case += f" {arch.dpkg}) rustArch='{arch.rust}'; rustupSha256='{hash}' ;; \\\n"

debian_arch_case = buster_arch_case
for arch in debian_other_arches:
hash = rustup_hash(arch.rust)
debian_arch_case += f" {arch.dpkg}) rustArch='{arch.rust}'; rustupSha256='{hash}' ;; \\\n"

end_case = ' *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \\\n'
end_case += ' esac'

debian_arch_case += end_case
buster_arch_case += end_case

template = read_file("Dockerfile-debian.template")
slim_template = read_file("Dockerfile-slim.template")

for variant in debian_variants:
case = debian_arch_case
if variant == "buster":
case = buster_arch_case
rendered = template \
.replace("%%RUST-VERSION%%", rust_version) \
.replace("%%RUSTUP-VERSION%%", rustup_version) \
.replace("%%DEBIAN-SUITE%%", variant) \
.replace("%%ARCH-CASE%%", arch_case)
.replace("%%ARCH-CASE%%", case)
write_file(f"{rust_version}/{variant}/Dockerfile", rendered)

rendered = slim_template \
.replace("%%RUST-VERSION%%", rust_version) \
.replace("%%RUSTUP-VERSION%%", rustup_version) \
.replace("%%DEBIAN-SUITE%%", variant) \
.replace("%%ARCH-CASE%%", arch_case)
.replace("%%ARCH-CASE%%", case)
write_file(f"{rust_version}/{variant}/slim/Dockerfile", rendered)

def update_alpine():
Expand Down

0 comments on commit 743e6f4

Please sign in to comment.