From a7d5ea15f3f233263eebc9818004bec3a46c1087 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Mon, 17 Jul 2017 18:20:12 -0400 Subject: Simplify libreboot_setup_variables() w/ new func. Reproducibility-related variable assignments are moved to a separate function in order to make libreboot_setup_variables() less busy. --- libreboot | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'libreboot') diff --git a/libreboot b/libreboot index 4a3aceb3..9cb069e7 100755 --- a/libreboot +++ b/libreboot @@ -173,6 +173,28 @@ libreboot_setup_variables() { local epoch_path="${root}/${DOTEPOCH}" local rnd_seed_path="${root}/${DOTRNDSEED}" + if [[ -z "${VERSION}" ]]; then + if git_check "${root}"; then + VERSION="${BUILD_SYSTEM}-$(git_describe "${root}" 2> /dev/null || echo 'git')" + elif [[ -f "${version_path}" ]]; then + VERSION="$(cat "${version_path}")" + else + VERSION="${BUILD_SYSTEM}" + fi + fi + + if [[ -d "${vboot_tools_path}/devkeys/" ]]; then + VBOOT_KEYS_PATH="${VBOOT_KEYS_PATH:-${vboot_tools_path}/devkeys/}" + fi + + CONFIG_SHELL="${CONFIG_SHELL:-$(which bash)}" + EDITOR="${EDITOR:-$(which vi || true)}" + TASKS="${TASKS:-1}" + + libreboot_setup_reproducible_builds_variables +} + +libreboot_setup_reproducible_builds_variables() { # Used by GCC, e.g., -frandom-seed="${RANDOM_SEED}" if [[ -z "${RANDOM_SEED}" ]]; then if [[ -f "${rnd_seed_path}" ]]; then @@ -193,25 +215,7 @@ libreboot_setup_variables() { fi fi - if [[ -z "${VERSION}" ]]; then - if git_check "${root}"; then - VERSION="${BUILD_SYSTEM}-$(git_describe "${root}" 2> /dev/null || echo 'git')" - elif [[ -f "${version_path}" ]]; then - VERSION="$(cat "${version_path}")" - else - VERSION="${BUILD_SYSTEM}" - fi - fi - - if [[ -d "${vboot_tools_path}/devkeys/" ]]; then - VBOOT_KEYS_PATH="${VBOOT_KEYS_PATH:-${vboot_tools_path}/devkeys/}" - fi - - CONFIG_SHELL="${CONFIG_SHELL:-$(which bash)}" - EDITOR="${EDITOR:-$(which vi || true)}" - TASKS="${TASKS:-1}" - - # Environment variables useful for creating reproducible builds + # Relevant only when libfaketime is preloaded if [[ -n "${LIBFAKETIME_PATH}" ]]; then BUILD_DATE_FMT="%Y-%m-%d %H:%M:%S" BUILD_DATE="$(date -u -d "@${SOURCE_DATE_EPOCH}" "+${BUILD_DATE_FMT}" 2>/dev/null || date -u -r "${SOURCE_DATE_EPOCH}" "+${BUILD_DATE_FMT}" 2>/dev/null || date -u "+${BUILD_DATE_FMT}")" -- cgit v1.2.3-70-g09d2