prepare_host: handle PRE_PREPARED_HOST inside prepare_host_init() so WORKDIR etc is always available
This commit is contained in:
parent
0251d65b7a
commit
c17a041637
@ -22,7 +22,7 @@ function prepare_temp_dir_in_workdir_and_schedule_cleanup() {
|
||||
|
||||
# if no WORKDIR set, or not an existing directory, bail with error
|
||||
if [[ -z "${WORKDIR}" ]] || [[ ! -d "${WORKDIR}" ]]; then
|
||||
exit_with_error "prepare_temp_dir_in_workdir_and_schedule_cleanup: WORKDIR is not set or not a directory: ${temp_dir_id}"
|
||||
exit_with_error "prepare_temp_dir_in_workdir_and_schedule_cleanup: WORKDIR ('${WORKDIR}') is not set or not a directory: ${temp_dir_id}"
|
||||
fi
|
||||
|
||||
nameref_temp_dir="$(mktemp -d --tmpdir "${temp_dir_id}-XXXXX")" # subject to TMPDIR/WORKDIR
|
||||
|
||||
@ -14,9 +14,7 @@ function main_default_start_build() {
|
||||
produce_repeat_args_array
|
||||
display_alert "Repeat Build Options (early)" "${repeat_args[*]}" "ext"
|
||||
|
||||
if [[ "${PRE_PREPARED_HOST:-"no"}" != "yes" ]]; then
|
||||
prepare_host_init # this has its own logging sections, and is possibly interactive.
|
||||
fi
|
||||
prepare_host_init # this has its own logging sections, and is possibly interactive.
|
||||
|
||||
# Prepare ccache, cthreads, etc for the build
|
||||
LOG_SECTION="prepare_compilation_vars" do_with_logging prepare_compilation_vars
|
||||
@ -33,6 +31,9 @@ function main_default_start_build() {
|
||||
}
|
||||
|
||||
function prepare_host_init() {
|
||||
declare -g start_timestamp # global timestamp; read below by main_default_end_build()
|
||||
start_timestamp=$(date +%s)
|
||||
|
||||
wait_for_disk_sync "before starting build" # fsync, wait for disk to sync, and then continue. alert user if takes too long.
|
||||
|
||||
# Check that WORKDIR_BASE_TMP exists; if not, create it.
|
||||
@ -55,32 +56,14 @@ function prepare_host_init() {
|
||||
declare -g -x CCACHE_TEMPDIR="${WORKDIR}/ccache_tmp" # Export CCACHE_TEMPDIR, under Workdir, which is hopefully under tmpfs. Thanks @the-Going for this.
|
||||
declare -g -x XDG_RUNTIME_DIR="${WORKDIR}/xdg_tmp" # XDG_RUNTIME_DIR is used by the likes of systemd/freedesktop centric apps.
|
||||
|
||||
declare -g start_timestamp # global timestamp; read below by main_default_end_build()
|
||||
start_timestamp=$(date +%s)
|
||||
if [[ "${PRE_PREPARED_HOST:-"no"}" != "yes" ]]; then
|
||||
### Write config summary # @TODO: or not? this is a bit useless
|
||||
LOG_SECTION="config_summary" do_with_logging write_config_summary_output_file
|
||||
|
||||
### Write config summary # @TODO: or not? this is a bit useless
|
||||
LOG_SECTION="config_summary" do_with_logging write_config_summary_output_file
|
||||
|
||||
# Check and install dependencies, directory structure and settings
|
||||
prepare_host # this has its own logging sections, and is possibly interactive.
|
||||
|
||||
# Create a directory inside WORKDIR with a "python" symlink to "/usr/bin/python2"; add it to PATH first.
|
||||
# -> what if there is no python2? bookworm/sid, currently. not long until more
|
||||
# ---> just try to use python3 and hope it works. it probably won't.
|
||||
BIN_WORK_DIR="${WORKDIR}/bin"
|
||||
# No cleanup of this is necessary, since it's inside WORKDIR.
|
||||
mkdir -p "${BIN_WORK_DIR}"
|
||||
if [[ -f "/usr/bin/python2" ]]; then
|
||||
display_alert "Found python2" "symlinking to ${BIN_WORK_DIR}/python" "debug"
|
||||
ln -s "/usr/bin/python2" "${BIN_WORK_DIR}/python"
|
||||
elif [[ -f "/usr/bin/python3" ]]; then
|
||||
display_alert "Found python3" "symlinking to ${BIN_WORK_DIR}/python and ${BIN_WORK_DIR}/python2" "debug"
|
||||
ln -s "/usr/bin/python3" "${BIN_WORK_DIR}/python"
|
||||
ln -s "/usr/bin/python3" "${BIN_WORK_DIR}/python2"
|
||||
else
|
||||
display_alert "No python2 or python3 found" "this is a problem" "error"
|
||||
# Check and install dependencies, directory structure and settings
|
||||
prepare_host # this has its own logging sections, and is possibly interactive.
|
||||
fi
|
||||
declare -g PATH="${BIN_WORK_DIR}:${PATH}"
|
||||
|
||||
}
|
||||
|
||||
function main_default_end_build() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user