system: separate build profile from development
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
#:base-packages %freebsd-native-system-packages
|
||||
#:development-packages (list freebsd-native-headers
|
||||
freebsd-clang-toolchain)
|
||||
#:build-packages (list freebsd-native-headers
|
||||
freebsd-clang-toolchain)
|
||||
#:groups (list (user-group #:name "wheel" #:gid 0 #:system? #t)
|
||||
(user-group #:name "sshd" #:gid 22 #:system? #t)
|
||||
(user-group #:name "_dhcp" #:gid 65 #:system? #t)
|
||||
|
||||
@@ -50,8 +50,10 @@ guile_module_smoke=$(sed -n 's/^guile_module_smoke=//p' "$inner_metadata")
|
||||
activate_log=$(sed -n 's/^activate_log=//p' "$inner_metadata")
|
||||
|
||||
development_profile_path=$closure_path/development-profile
|
||||
build_profile_path=$closure_path/build-profile
|
||||
runtime_profile_path=$closure_path/profile
|
||||
development_env_script=$closure_path/usr/local/bin/fruix-development-environment
|
||||
build_env_script=$closure_path/usr/local/bin/fruix-build-environment
|
||||
|
||||
[ "$shepherd_pid" = 1 ] || { echo "shepherd was not PID 1" >&2; exit 1; }
|
||||
[ "$sshd_status" = running ] || { echo "sshd is not running" >&2; exit 1; }
|
||||
@@ -68,7 +70,11 @@ for path in \
|
||||
"$development_profile_path/bin/ar" \
|
||||
"$development_profile_path/usr/include/sys/param.h" \
|
||||
"$development_profile_path/usr/share/mk/bsd.prog.mk" \
|
||||
"$development_env_script"
|
||||
"$build_profile_path/bin/cc" \
|
||||
"$build_profile_path/usr/include/sys/param.h" \
|
||||
"$build_profile_path/usr/share/mk/bsd.prog.mk" \
|
||||
"$development_env_script" \
|
||||
"$build_env_script"
|
||||
do
|
||||
[ -e "$path" ] || {
|
||||
echo "required development environment path missing: $path" >&2
|
||||
@@ -96,8 +102,11 @@ guest_dev_metadata=$(ssh -i "$root_ssh_private_key_file" \
|
||||
root@"$guest_ip" 'sh -s' <<'EOF'
|
||||
set -eu
|
||||
[ -x /usr/local/bin/fruix-development-environment ]
|
||||
[ -x /usr/local/bin/fruix-build-environment ]
|
||||
[ -L /run/current-development ]
|
||||
[ "$(readlink /run/current-development)" = "/run/current-system/development-profile" ]
|
||||
[ -L /run/current-build ]
|
||||
[ "$(readlink /run/current-build)" = "/run/current-system/build-profile" ]
|
||||
exports=$(/usr/local/bin/fruix-development-environment)
|
||||
printf '%s\n' "$exports" | grep '^export FRUIX_DEVELOPMENT_PROFILE="/run/current-system/development-profile"$' >/dev/null
|
||||
printf '%s\n' "$exports" | grep '^export MAKEFLAGS="-m /run/current-system/development-profile/usr/share/mk"$' >/dev/null
|
||||
@@ -109,6 +118,20 @@ eval "$exports"
|
||||
[ -f "$FRUIX_DEVELOPMENT_INCLUDE/sys/param.h" ]
|
||||
[ -f "$FRUIX_DEVELOPMENT_SHARE_MK/bsd.prog.mk" ]
|
||||
cc_version=$($FRUIX_CC --version | awk 'NR==1 { print; exit }')
|
||||
build_exports=$(/usr/local/bin/fruix-build-environment)
|
||||
printf '%s\n' "$build_exports" | grep '^unset MAKEOBJDIRPREFIX MAKEFLAGS CC CXX AR RANLIB NM CPPFLAGS CFLAGS CXXFLAGS LDFLAGS$' >/dev/null
|
||||
printf '%s\n' "$build_exports" | grep '^export FRUIX_BUILD_PROFILE="/run/current-system/build-profile"$' >/dev/null
|
||||
eval "$build_exports"
|
||||
[ -d "$FRUIX_BUILD_PROFILE" ]
|
||||
[ -f "$FRUIX_BUILD_INCLUDE/sys/param.h" ]
|
||||
[ -f "$FRUIX_BUILD_SHARE_MK/bsd.prog.mk" ]
|
||||
[ "${MAKEFLAGS-unset}" = unset ]
|
||||
[ "${CPPFLAGS-unset}" = unset ]
|
||||
[ "${CFLAGS-unset}" = unset ]
|
||||
[ "${LDFLAGS-unset}" = unset ]
|
||||
[ "$FRUIX_BMAKE" = make ]
|
||||
build_profile_value=$FRUIX_BUILD_PROFILE
|
||||
eval "$exports"
|
||||
tmp=/tmp/fruix-phase20-development-env
|
||||
rm -rf "$tmp"
|
||||
mkdir -p "$tmp/direct" "$tmp/mk"
|
||||
@@ -142,25 +165,34 @@ hello_make=$(./hello)
|
||||
make_log_tail=$(tail -n 20 "$tmp/mk/make.log" | tr '\n' ' ')
|
||||
exports_flat=$(printf '%s' "$exports" | tr '\n' ' ')
|
||||
printf 'development_profile=%s\n' "$FRUIX_DEVELOPMENT_PROFILE"
|
||||
printf 'build_profile=%s\n' "$build_profile_value"
|
||||
printf 'cc_version=%s\n' "$cc_version"
|
||||
printf 'hello_direct=%s\n' "$hello_direct"
|
||||
printf 'hello_make=%s\n' "$hello_make"
|
||||
build_exports_flat=$(printf '%s' "$build_exports" | tr '\n' ' ')
|
||||
printf 'exports=%s\n' "$exports_flat"
|
||||
printf 'build_exports=%s\n' "$build_exports_flat"
|
||||
printf 'make_log_tail=%s\n' "$make_log_tail"
|
||||
EOF
|
||||
)
|
||||
|
||||
development_profile=$(printf '%s\n' "$guest_dev_metadata" | sed -n 's/^development_profile=//p')
|
||||
build_profile=$(printf '%s\n' "$guest_dev_metadata" | sed -n 's/^build_profile=//p')
|
||||
cc_version=$(printf '%s\n' "$guest_dev_metadata" | sed -n 's/^cc_version=//p')
|
||||
hello_direct=$(printf '%s\n' "$guest_dev_metadata" | sed -n 's/^hello_direct=//p')
|
||||
hello_make=$(printf '%s\n' "$guest_dev_metadata" | sed -n 's/^hello_make=//p')
|
||||
development_exports=$(printf '%s\n' "$guest_dev_metadata" | sed -n 's/^exports=//p')
|
||||
build_exports=$(printf '%s\n' "$guest_dev_metadata" | sed -n 's/^build_exports=//p')
|
||||
make_log_tail=$(printf '%s\n' "$guest_dev_metadata" | sed -n 's/^make_log_tail=//p')
|
||||
|
||||
[ "$development_profile" = "/run/current-system/development-profile" ] || {
|
||||
echo "unexpected guest development profile path: $development_profile" >&2
|
||||
exit 1
|
||||
}
|
||||
[ "$build_profile" = "/run/current-system/build-profile" ] || {
|
||||
echo "unexpected guest build profile path: $build_profile" >&2
|
||||
exit 1
|
||||
}
|
||||
case "$cc_version" in
|
||||
*"FreeBSD clang version"*) : ;;
|
||||
*) echo "unexpected cc version output: $cc_version" >&2; exit 1 ;;
|
||||
@@ -177,6 +209,10 @@ case "$development_exports" in
|
||||
*'export FRUIX_CC="/run/current-system/development-profile/bin/cc"'*) : ;;
|
||||
*) echo "development environment exports do not include FRUIX_CC" >&2; exit 1 ;;
|
||||
esac
|
||||
case "$build_exports" in
|
||||
*'export FRUIX_BUILD_PROFILE="/run/current-system/build-profile"'*) : ;;
|
||||
*) echo "build environment exports do not include FRUIX_BUILD_PROFILE" >&2; exit 1 ;;
|
||||
esac
|
||||
|
||||
cat >"$metadata_file" <<EOF
|
||||
workdir=$workdir
|
||||
@@ -189,16 +225,20 @@ vdi_id=$vdi_id
|
||||
guest_ip=$guest_ip
|
||||
root_size=$root_size
|
||||
development_profile_path=$development_profile_path
|
||||
build_profile_path=$build_profile_path
|
||||
development_env_script=$development_env_script
|
||||
build_env_script=$build_env_script
|
||||
shepherd_pid=$shepherd_pid
|
||||
sshd_status=$sshd_status
|
||||
compat_prefix_shims=$compat_prefix_shims
|
||||
guile_module_smoke=$guile_module_smoke
|
||||
development_profile_guest=$development_profile
|
||||
build_profile_guest=$build_profile
|
||||
cc_version=$cc_version
|
||||
hello_direct=$hello_direct
|
||||
hello_make=$hello_make
|
||||
development_exports=$development_exports
|
||||
build_exports=$build_exports
|
||||
make_log_tail=$make_log_tail
|
||||
boot_backend=xcp-ng-xo-cli
|
||||
init_mode=shepherd-pid1
|
||||
|
||||
@@ -73,10 +73,11 @@ esac
|
||||
native_build_metadata=$(ssh_guest env BUILD_JOBS="$guest_build_jobs" GUEST_IP="$guest_ip" VM_ID="$vm_id" VDI_ID="$vdi_id" sh -s <<'EOF'
|
||||
set -eu
|
||||
[ -L /run/current-development ]
|
||||
[ -L /run/current-build ]
|
||||
[ -L /usr/include ]
|
||||
[ "$(readlink /usr/include)" = "/run/current-system/development-profile/usr/include" ]
|
||||
[ "$(readlink /usr/include)" = "/run/current-system/build-profile/usr/include" ]
|
||||
[ -L /usr/share/mk ]
|
||||
[ "$(readlink /usr/share/mk)" = "/run/current-system/development-profile/usr/share/mk" ]
|
||||
[ "$(readlink /usr/share/mk)" = "/run/current-system/build-profile/usr/share/mk" ]
|
||||
guest_host_name=$(hostname)
|
||||
closure=$(readlink /run/current-system)
|
||||
source_store=$(sed -n 's/.*"\(\/frx\/store\/[^"]*-freebsd-source-[^"]*\)".*/\1/p' "$closure/metadata/store-layout.scm" | head -n 1)
|
||||
@@ -171,7 +172,7 @@ cat >"$promotion_file" <<EOF2
|
||||
(run-id . "$run_id")
|
||||
(guest-host-name . "$guest_host_name")
|
||||
(closure-path . "$closure")
|
||||
(development-profile . "/run/current-system/development-profile")
|
||||
(build-profile . "/run/current-system/build-profile")
|
||||
(freebsd-base . ((name . "default")
|
||||
(version-label . "15.0-STABLE")
|
||||
(release . "15.0-STABLE")
|
||||
|
||||
@@ -118,7 +118,7 @@ bootloader_store=$(field bootloader_store)
|
||||
|
||||
[ "$executor_kind" = self-hosted ] || { echo "unexpected executor kind: $executor_kind" >&2; exit 1; }
|
||||
[ "$executor_name" = guest-self-hosted ] || { echo "unexpected executor name: $executor_name" >&2; exit 1; }
|
||||
[ "$executor_version" = 4 ] || { echo "unexpected executor version: $executor_version" >&2; exit 1; }
|
||||
[ "$executor_version" = 5 ] || { echo "unexpected executor version: $executor_version" >&2; exit 1; }
|
||||
[ "$artifact_store_count" = 4 ] || { echo "unexpected artifact store count: $artifact_store_count" >&2; exit 1; }
|
||||
case "$result_store" in
|
||||
/frx/store/*-fruix-native-build-result-*-guest-self-hosted) : ;;
|
||||
@@ -178,6 +178,10 @@ grep -F "$source_store" "$result_metadata_file" >/dev/null || {
|
||||
echo "result metadata file is missing source store provenance" >&2
|
||||
exit 1
|
||||
}
|
||||
grep -F '(build-profile . "/run/current-system/build-profile")' "$result_metadata_file" >/dev/null || {
|
||||
echo "result metadata file is missing build-profile provenance" >&2
|
||||
exit 1
|
||||
}
|
||||
grep -F '(artifact-kind . kernel)' "$kernel_store/.fruix-native-build-object.scm" >/dev/null || {
|
||||
echo "kernel store metadata is missing artifact kind" >&2
|
||||
exit 1
|
||||
|
||||
@@ -70,7 +70,9 @@ case "$guest_build_jobs" in
|
||||
;;
|
||||
esac
|
||||
|
||||
ssh_guest '[ -x /usr/local/bin/fruix-build-environment ]'
|
||||
ssh_guest '[ -x /usr/local/bin/fruix-self-hosted-native-build ]'
|
||||
ssh_guest '[ -L /run/current-build ]'
|
||||
ssh_guest '[ -L /usr/include ]'
|
||||
ssh_guest '[ -L /usr/share/mk ]'
|
||||
|
||||
@@ -81,6 +83,7 @@ helper_version=$(printf '%s\n' "$self_hosted_metadata" | sed -n 's/^helper_versi
|
||||
executor_kind=$(printf '%s\n' "$self_hosted_metadata" | sed -n 's/^executor_kind=//p')
|
||||
executor_name=$(printf '%s\n' "$self_hosted_metadata" | sed -n 's/^executor_name=//p')
|
||||
executor_version=$(printf '%s\n' "$self_hosted_metadata" | sed -n 's/^executor_version=//p')
|
||||
build_profile=$(printf '%s\n' "$self_hosted_metadata" | sed -n 's/^build_profile=//p')
|
||||
source_store=$(printf '%s\n' "$self_hosted_metadata" | sed -n 's/^source_store=//p')
|
||||
source_root=$(printf '%s\n' "$self_hosted_metadata" | sed -n 's/^source_root=//p')
|
||||
build_jobs=$(printf '%s\n' "$self_hosted_metadata" | sed -n 's/^build_jobs=//p')
|
||||
@@ -121,10 +124,11 @@ latest_target=$(ssh_guest "readlink '$latest_link'")
|
||||
ssh_guest "[ -f '$promotion_file' ]"
|
||||
ssh_guest "[ -f '$world_artifact/bin/sh' ]"
|
||||
|
||||
[ "$helper_version" = 4 ] || { echo "unexpected helper version: $helper_version" >&2; exit 1; }
|
||||
[ "$helper_version" = 5 ] || { echo "unexpected helper version: $helper_version" >&2; exit 1; }
|
||||
[ "$executor_kind" = self-hosted ] || { echo "unexpected executor kind: $executor_kind" >&2; exit 1; }
|
||||
[ "$executor_name" = guest-self-hosted ] || { echo "unexpected executor name: $executor_name" >&2; exit 1; }
|
||||
[ "$executor_version" = 4 ] || { echo "unexpected executor version: $executor_version" >&2; exit 1; }
|
||||
[ "$executor_version" = 5 ] || { echo "unexpected executor version: $executor_version" >&2; exit 1; }
|
||||
[ "$build_profile" = /run/current-system/build-profile ] || { echo "unexpected build profile: $build_profile" >&2; exit 1; }
|
||||
[ "$build_jobs" = "$guest_build_jobs" ] || { echo "unexpected build job count: $build_jobs" >&2; exit 1; }
|
||||
[ "$status_value" = ok ] || { echo "self-hosted build status is not ok: $status_value" >&2; exit 1; }
|
||||
[ "$latest_target" = "$result_root" ] || { echo "latest link target mismatch: $latest_target" >&2; exit 1; }
|
||||
@@ -207,6 +211,7 @@ executor_kind=$executor_kind
|
||||
executor_name=$executor_name
|
||||
executor_version=$executor_version
|
||||
build_jobs=$build_jobs
|
||||
build_profile=$build_profile
|
||||
source_store=$source_store
|
||||
source_root=$source_root
|
||||
build_common=$build_common
|
||||
|
||||
Reference in New Issue
Block a user