Save SOURCE_DATE_EPOCH to a file and read it from the file when resuming a build

Print the build date.
Don't re-run mksquashfs if it succeeded, but the failure was in gpg signing. For example, if the gpg pinentry timed out.
This commit is contained in:
nl6720 2020-09-28 20:12:01 +03:00
parent 455e2b94c0
commit f45fc29fe0
No known key found for this signature in database
GPG Key ID: 5CE88535E188D369

View File

@ -149,7 +149,8 @@ ENDUSAGETEXT
# Shows configuration according to command mode. # Shows configuration according to command mode.
# $1: build_profile | init | install | run | prepare | iso # $1: build_profile | init | install | run | prepare | iso
_show_config() { _show_config() {
local _mode="$1" local _mode="$1" build_date
build_date="$(date --utc --iso-8601=seconds -d "@${SOURCE_DATE_EPOCH}")"
_msg_info "${app_name} configuration settings" _msg_info "${app_name} configuration settings"
[[ ! -d "${command_name}" ]] && _msg_info " Legacy Command: ${command_name}" [[ ! -d "${command_name}" ]] && _msg_info " Legacy Command: ${command_name}"
_msg_info " Architecture: ${arch}" _msg_info " Architecture: ${arch}"
@ -157,6 +158,7 @@ _show_config() {
_msg_info " Installation directory: ${install_dir}" _msg_info " Installation directory: ${install_dir}"
case "${_mode}" in case "${_mode}" in
build_profile) build_profile)
_msg_info " Build date: ${build_date}"
_msg_info " Output directory: ${out_dir}" _msg_info " Output directory: ${out_dir}"
_msg_info " GPG key: ${gpg_key:-None}" _msg_info " GPG key: ${gpg_key:-None}"
_msg_info " Profile: ${profile}" _msg_info " Profile: ${profile}"
@ -597,9 +599,9 @@ _make_boot_uefi-x64.systemd-boot.eltorito() {
# Build airootfs filesystem image # Build airootfs filesystem image
_make_prepare() { _make_prepare() {
if [[ "${sfs_mode}" == "sfs" ]]; then if [[ "${sfs_mode}" == "sfs" ]]; then
_mkairootfs_sfs _run_once _mkairootfs_sfs
else else
_mkairootfs_img _run_once _mkairootfs_img
fi fi
_mkchecksum _mkchecksum
if [[ "${gpg_key}" ]]; then if [[ "${gpg_key}" ]]; then
@ -783,12 +785,16 @@ command_build_profile() {
isofs_dir="${work_dir}/iso" isofs_dir="${work_dir}/iso"
# Set ISO file name # Set ISO file name
img_name="${iso_name}-${iso_version}-${arch}.iso" img_name="${iso_name}-${iso_version}-${arch}.iso"
_show_config "${FUNCNAME[0]#command_}"
# Create working directory # Create working directory
[[ -d "${work_dir}" ]] || install -d -- "${work_dir}" [[ -d "${work_dir}" ]] || install -d -- "${work_dir}"
# Write build date to file or if the file exists, read it from there
if [[ -e "${work_dir}/build_date" ]]; then
SOURCE_DATE_EPOCH="$(<"${work_dir}/build_date")"
else
printf '%s\n' "$SOURCE_DATE_EPOCH" > "${work_dir}/build_date"
fi
_show_config "${FUNCNAME[0]#command_}"
_run_once _make_pacman_conf _run_once _make_pacman_conf
_run_once _export_gpg_publickey _run_once _export_gpg_publickey
_run_once _make_custom_airootfs _run_once _make_custom_airootfs