diff --git a/.travis.yml b/.travis.yml index 312d104..ae100b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ env: - VERSION=1.41.0 VARIANT=stretch/slim - VERSION=1.41.0 VARIANT=buster - VERSION=1.41.0 VARIANT=buster/slim + - VERSION=1.41.0 VARIANT=bionic - VERSION=1.41.0 VARIANT=alpine3.10 - VERSION=1.41.0 VARIANT=alpine3.11 #VERSIONS diff --git a/1.41.0/bionic/Dockerfile b/1.41.0/bionic/Dockerfile new file mode 100644 index 0000000..3f19abc --- /dev/null +++ b/1.41.0/bionic/Dockerfile @@ -0,0 +1,26 @@ +FROM buildpack-deps:bionic + +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH \ + RUST_VERSION=1.41.0 + +RUN set -eux; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='ad1f8b5199b3b9e231472ed7aa08d2e5d1d539198a15c5b1e53c746aad81d27b' ;; \ + armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='6c6c3789dabf12171c7f500e06d21d8004b5318a5083df8b0b02c0e5ef1d017b' ;; \ + arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='26942c80234bac34b3c1352abbd9187d3e23b43dae3cf56a9f9c1ea8ee53076d' ;; \ + i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='27ae12bc294a34e566579deba3e066245d09b8871dc021ef45fc715dced05297' ;; \ + *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ + esac; \ + url="https://static.rust-lang.org/rustup/archive/1.21.1/${rustArch}/rustup-init"; \ + wget "$url"; \ + echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ + chmod +x rustup-init; \ + ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION; \ + rm rustup-init; \ + chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ + rustup --version; \ + cargo --version; \ + rustc --version; diff --git a/Dockerfile-ubuntu.template b/Dockerfile-ubuntu.template new file mode 100644 index 0000000..57a8653 --- /dev/null +++ b/Dockerfile-ubuntu.template @@ -0,0 +1,19 @@ +FROM buildpack-deps:%%UBUNTU-SUITE%% + +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH \ + RUST_VERSION=%%RUST-VERSION%% + +RUN set -eux; \ + %%ARCH-CASE%%; \ + url="https://static.rust-lang.org/rustup/archive/%%RUSTUP-VERSION%%/${rustArch}/rustup-init"; \ + wget "$url"; \ + echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ + chmod +x rustup-init; \ + ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION; \ + rm rustup-init; \ + chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ + rustup --version; \ + cargo --version; \ + rustc --version; diff --git a/x.py b/x.py index c391705..7721046 100755 --- a/x.py +++ b/x.py @@ -25,6 +25,12 @@ default_debian_variant = "buster" +ubuntu_variants = [ + "bionic" +] + +default_ubuntu_variant = ubuntu_variants[0] + alpine_versions = [ "3.10", "3.11", @@ -48,6 +54,25 @@ def write_file(file, contents): with open(file, "w") as f: f.write(contents) +def update_ubuntu(): + arch_case = 'dpkgArch="$(dpkg --print-architecture)"; \\\n' + arch_case += ' case "${dpkgArch##*-}" in \\\n' + for arch in debian_arches: # Ubuntu and debian arch are the same! + 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' + + template = read_file("Dockerfile-ubuntu.template") + + for variant in ubuntu_variants: + rendered = template \ + .replace("%%RUST-VERSION%%", rust_version) \ + .replace("%%RUSTUP-VERSION%%", rustup_version) \ + .replace("%%UBUNTU-SUITE%%", variant) \ + .replace("%%ARCH-CASE%%", arch_case) + write_file(f"{rust_version}/{variant}/Dockerfile", rendered) + def update_debian(): arch_case = 'dpkgArch="$(dpkg --print-architecture)"; \\\n' arch_case += ' case "${dpkgArch##*-}" in \\\n' @@ -95,6 +120,9 @@ def update_travis(): versions += f" - VERSION={rust_version} VARIANT={variant}\n" versions += f" - VERSION={rust_version} VARIANT={variant}/slim\n" + for variant in ubuntu_variants: + versions += f" - VERSION={rust_version} VARIANT={variant}\n" + for version in alpine_versions: versions += f" - VERSION={rust_version} VARIANT=alpine{version}\n" @@ -165,6 +193,21 @@ def generate_stackbrew_library(): map(lambda a: a.bashbrew, debian_arches), os.path.join(rust_version, variant, "slim")) + for variant in ubuntu_variants: + tags = [] + for version_tag in version_tags(): + tags.append(f"{version_tag}-{variant}") + tags.append(variant) + if variant == default_ubuntu_variant: + for version_tag in version_tags(): + tags.append(version_tag) + tags.append("ubuntu") + + library += single_library( + tags, + map(lambda a: a.bashbrew, debian_arches), + os.path.join(rust_version, variant)) + for version in alpine_versions: tags = [] for version_tag in version_tags(): @@ -193,6 +236,7 @@ def usage(): task = sys.argv[1] if task == "update": update_debian() + update_ubuntu() update_alpine() update_travis() elif task == "generate-stackbrew-library":