Skip to content

Commit

Permalink
[RootFS] Install samurai instead of ninja (#2356)
Browse files Browse the repository at this point in the history
Co-authored-by: Elliot Saba <staticfloat@gmail.com>
  • Loading branch information
giordano and staticfloat authored Jan 12, 2021
1 parent 0a4ba26 commit 73fc6d0
Show file tree
Hide file tree
Showing 8 changed files with 208 additions and 159 deletions.
12 changes: 8 additions & 4 deletions 0_RootFS/Rootfs/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ version = VersionNumber("$(year(today())).$(month(today())).$(day(today()))")
verbose = "--verbose" in ARGS

# We begin by downloading the alpine rootfs and using THAT as a bootstrap rootfs.
rootfs_url = "https://github.com/alpinelinux/docker-alpine/raw/v3.12/x86_64/alpine-minirootfs-3.12.0-x86_64.tar.gz"
rootfs_hash = "0beb54cf9bf69d085f9fcd291ff28b3335184d08b706d535f425e8180851edc9"
rootfs_url = "https://github.com/alpinelinux/docker-alpine/raw/v3.12/x86_64/alpine-minirootfs-3.12.3-x86_64.tar.gz"
rootfs_hash = "1770f9f2214497f3c1caccc6b9e692c34e2dce00924bab5102e76388f770a64c"
mkpath(joinpath(@__DIR__, "build"))
mkpath(joinpath(@__DIR__, "products"))
rootfs_targz_path = joinpath(@__DIR__, "build", "rootfs.tar.gz")
download_verify(rootfs_url, rootfs_hash, rootfs_targz_path; verbose=verbose, force=true)
Pkg.PlatformEngines.download_verify(rootfs_url, rootfs_hash, rootfs_targz_path; verbose=verbose, force=true)

# Unpack the rootfs (using `tar` on the local machine), then pack it up again (again using tools on the local machine) and squashify it:
rootfs_extracted = joinpath(@__DIR__, "build", "rootfs_extracted")
Expand Down Expand Up @@ -134,8 +134,11 @@ NET_TOOLS="curl wget git openssl ca-certificates"
MISC_TOOLS="python2 python3 py3-pip sudo file libintl patchutils grep zlib"
FILE_TOOLS="tar zip unzip xz findutils squashfs-tools unrar rsync"
INTERACTIVE_TOOLS="bash gdb vim nano tmux strace"
BUILD_TOOLS="make patch gawk autoconf automake libtool bison flex pkgconfig cmake ninja ccache"
BUILD_TOOLS="make patch gawk autoconf automake libtool bison flex pkgconfig cmake samurai ccache"
apk add --update --root $prefix ${NET_TOOLS} ${MISC_TOOLS} ${FILE_TOOLS} ${INTERACTIVE_TOOLS} ${BUILD_TOOLS}
# Install a more recent version of `apk`, which understands `--no-chown`.
# TODO: remove this when we move to Alpine v3.13+.
apk add --root $prefix --upgrade apk-tools --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main
# chgrp and chown should be no-ops since we run in a single-user mode
rm -f ./bin/chown ./bin/chgrp
Expand All @@ -159,6 +162,7 @@ cp -vd ${WORKSPACE}/srcdir/utils/tar_wrapper.sh ./usr/local/bin/tar
cp -vd ${WORKSPACE}/srcdir/utils/update_configure_scripts.sh ./usr/local/bin/update_configure_scripts
cp -vd ${WORKSPACE}/srcdir/utils/flagon ./usr/local/bin/flagon
cp -vd ${WORKSPACE}/srcdir/utils/fake_uname.sh ./usr/bin/uname
cp -vd ${WORKSPACE}/srcdir/utils/apk_wrapper.sh ./usr/local/bin/apk
mv ./sbin/sysctl ./sbin/_sysctl
cp -vd ${WORKSPACE}/srcdir/utils/fake_sysctl.sh ./sbin/sysctl
cp -vd ${WORKSPACE}/srcdir/utils/fake_sha512sum.sh ./usr/local/bin/sha512sum
Expand Down
7 changes: 7 additions & 0 deletions 0_RootFS/Rootfs/bundled/testsuite/rust/cargo_build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "cargo_build"
version = "0.1.0"
authors = ["Binary Builder <bb@julialang.org>"]
edition = "2018"

[dependencies]
9 changes: 9 additions & 0 deletions 0_RootFS/Rootfs/bundled/testsuite/rust/cargo_build/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
PROJECT_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
BINS = $(PROJECT_NAME)$(exeext)

include ../../common.mk

$(PROJECT_BUILD)/$(PROJECT_NAME)$(exeext): src/main.rs
$(call color,$(CARGO),install --verbose --path . --root $(PROJECT_BUILD))
mv $(PROJECT_BUILD)/bin/* $(PROJECT_BUILD)/
rm -rf $(PROJECT_BUILD)/bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("I was built by cargo! How cool is that?!");
}
5 changes: 5 additions & 0 deletions 0_RootFS/Rootfs/bundled/utils/apk_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

# We run in a single-user environment, we can't afford running `chown` when
# installing packages.
/sbin/apk --no-chown "$@"
Loading

0 comments on commit 73fc6d0

Please sign in to comment.